mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore(testrunner): introduce tests for TestRunner (#4773)
This adds some basic tests for the test runner.
This commit is contained in:
@@ -64,7 +64,7 @@ class UserCallback {
|
||||
const from = frame.indexOf('(');
|
||||
frame = frame.substring(from + 1, frame.length - 1);
|
||||
} else {
|
||||
frame = frame.substring('at '.length + 1);
|
||||
frame = frame.substring('at '.length);
|
||||
}
|
||||
|
||||
const match = frame.match(/^(.*):(\d+):(\d+)$/);
|
||||
@@ -348,14 +348,21 @@ class TestRunner extends EventEmitter {
|
||||
async run() {
|
||||
const runnableTests = this._runnableTests();
|
||||
this.emit(TestRunner.Events.Started, runnableTests);
|
||||
const pass = new TestPass(this, this._rootSuite, runnableTests, this._parallel, this._breakOnFailure);
|
||||
const termination = await pass.run();
|
||||
this._runningPass = new TestPass(this, this._rootSuite, runnableTests, this._parallel, this._breakOnFailure);
|
||||
const termination = await this._runningPass.run();
|
||||
this._runningPass = null;
|
||||
if (termination)
|
||||
this.emit(TestRunner.Events.Terminated, termination.message, termination.error);
|
||||
else
|
||||
this.emit(TestRunner.Events.Finished);
|
||||
}
|
||||
|
||||
terminate() {
|
||||
if (!this._runningPass)
|
||||
return;
|
||||
this._runningPass._terminate('Terminated with |TestRunner.terminate()| call', null);
|
||||
}
|
||||
|
||||
timeout() {
|
||||
return this._timeout;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user