Skip to content

Commit bea5f11

Browse files
authored
feat(test-runner): Support lifecycle events (#132)
Add support for test runner lifecycle events: init and dispose. These are called once in every test runner life cycle (if implemented). If they return a promise, we will wait for those promises to be resolved before proceding. We will only wait for max 2 seconds with the dispose before forcing the child process to be killed.
1 parent ec30a06 commit bea5f11

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/TestRunnerOrchestrator.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class TestRunnerOrchestrator {
4141

4242
private initalRunWithoutTestSelector() {
4343
let testRunner = this.createTestRunner(this.files, true);
44-
return testRunner.init().then( () => testRunner.run({ timeout: 10000 }).then(testResults => {
44+
return testRunner.init().then(() => testRunner.run({ timeout: 10000 }).then(testResults => {
4545
testRunner.dispose();
4646
return [testResults];
4747
}));
@@ -197,12 +197,7 @@ export default class TestRunnerOrchestrator {
197197
}
198198
let runnerFiles = this.files.map(originalFile => <InputFile>_.assign(_.cloneDeep(originalFile), { path: fileMap[originalFile.path] }));
199199
let runner = this.createTestRunner(runnerFiles, false, testSelectionFilePath, index);
200-
return {
201-
index,
202-
fileMap,
203-
runner,
204-
testSelectionFilePath
205-
}
200+
return runner.init().then(() => ({index, fileMap, runner, testSelectionFilePath }));
206201
});
207202
}
208203

0 commit comments

Comments
 (0)