tapflow
팀 전체가 사용할 수 있는 자체 호스팅 iOS·Android 시뮬레이터 스트리밍
Javascript 단위 테스트를 재미있게 만드는 테스트 실행기
Test'em 'Scripts! A test runner that makes Javascript unit testing fun.
개발 도구JavaScript · HTMLGitHub @testem직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
README 전체를 불러오는 중입니다.
README 전문 보기 ↗Testem is a JavaScript test runner that runs your tests in real desktop browsers—Chrome, Firefox, Safari, Edge, and others you launch—so your specs execute in the same browser engines and DOM your users get, not a pretend environment. It also runs tests in Node, Chrome (including headless runs via browser_args, e.g. --headless), or any launcher you configure. It is framework-agnostic and aimed at any kind of tests you want to run: unit, integration, end-to-end style suites, or custom setups—you pick the style; Testem wires it to the browser or process.
Unit testing in JavaScript can be tedious and painful, but Testem makes it so easy that you will actually want to write tests.
browser_args with --headless for headless runs—see docs/browser_args.md)Testem needs a supported Node.js runtime. The required range is defined in package.json under engines (currently ^22.17.0, ^24.0.0, or >= 26.0.0).
Recommended: install Testem both as a dev dependency (so your project pins a version) and globally (so the testem command is always available on your PATH):
npm install testem --save-dev
npm install testem -g
When you run the global testem inside a project directory that has a local testem install, the CLI automatically re-runs the local copy so the version stays in sync with package.json. Set TESTEM_USE_GLOBAL=1 if you ever need to force the global binary only.
This README uses the testem command in examples; add it to npm scripts or invoke it as testem from a shell after the installs above.
Testem's package is an ES module. Both of these return the same Api class:
import Api from 'testem';
const api = new Api();
api.startCI({ launch: 'Headless Chrome' });
const Api = require('testem');
const api = new Api();
api.startDev();
startDev, startCI, and startServer match the CLI modes. require('testem') stays synchronous. Deep paths such as testem/lib/config.js are not part of the package exports.
As stated before, Testem supports two use cases: test-driven-development and continuous integration. Let's go over each one.
The simplest way to use Testem, in the TDD spirit, is to start in an empty directory, install a test framework, and run the command
npm install --save-dev jasmine-core@^7
testem
The default runner uses modern Jasmine (jasmine-core). You can also use mocha, qunit, or mocha + chai by setting "framework" in testem.json and installing the matching packages (see Browser framework dependencies).
You will see a terminal-based interface which looks like this
Now open a real browser (the URL Testem prints is a normal page in Chrome, Firefox, Safari, etc.) and go to the specified URL. You should now see
We see 0/0 for tests because at this point we haven't written any code. As we write them, Testem will pick up any .js files
that were added, include them, and if there are tests, run them automatically. So let's first write hello_spec.js in the spirit of "test first" (written in Jasmine)
describe('hello', function(){
it('should say hello', function(){
expect(hello()).toBe('hello world');
});
});
Save that file and now you should see
Testem should automatically pick up the new files you've added and also any changes that you make to them and rerun the tests. The test fails as we'd expect. Now we implement the spec like so in hello.js
function hello(){
return "hello world";
}
So you should now see
In development mode, Testem has a text-based graphical user interface which uses keyboard-based controls. Here is a list of the control keys
여기까지가 README 앞부분입니다. 나머지는 원문에서 읽을 수 있습니다. README 전문 보기 ↗