mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
tests: drop jasmine test runner (#1519)
This patch introduces a tiny test runner to run puppeteer tests. The test runner is self-container and allows parallel (wrt IO) test execution. It will also allow us to split tests into multiple files if necessary. Comparing to the jasmine, the testrunner supports parallel execution, properly handles "unhandled promise rejection" event and signals. Comparing to ava/jest, the testrunner doesn't run multiple node processes, which makes it simpler but sufficient for our goals.
This commit is contained in:
@@ -19,6 +19,15 @@ const SourceFactory = require('../SourceFactory');
|
||||
const factory = new SourceFactory();
|
||||
const VERSION = require('../../../package.json').version;
|
||||
|
||||
const {TestRunner, Reporter, Matchers} = require('../../testrunner/');
|
||||
const runner = new TestRunner();
|
||||
new Reporter(runner);
|
||||
|
||||
const {describe, xdescribe, fdescribe} = runner;
|
||||
const {it, fit, xit} = runner;
|
||||
const {beforeAll, beforeEach, afterAll, afterEach} = runner;
|
||||
const {expect} = new Matchers();
|
||||
|
||||
describe('preprocessor', function() {
|
||||
it('should throw for unknown command', function() {
|
||||
const source = factory.createForTest('doc.md', getCommand('unknownCommand()'));
|
||||
@@ -54,6 +63,8 @@ describe('preprocessor', function() {
|
||||
});
|
||||
});
|
||||
|
||||
runner.run();
|
||||
|
||||
function getCommand(name, body = '') {
|
||||
return `<!--gen:${name}-->${body}<!--gen:stop-->`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user