Skip to content

Commit

Permalink
feat(test-runner): Support lifecycle events (#132)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nicojs committed Jul 30, 2016
1 parent 3bd9697 commit 0675864
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/TestRunnerOrchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class TestRunnerOrchestrator {

private initalRunWithoutTestSelector() {
let testRunner = this.createTestRunner(this.files, true);
return testRunner.init().then( () => testRunner.run({ timeout: 10000 }).then(testResults => {
return testRunner.init().then(() => testRunner.run({ timeout: 10000 }).then(testResults => {
testRunner.dispose();
return [testResults];
}));
Expand Down Expand Up @@ -197,12 +197,7 @@ export default class TestRunnerOrchestrator {
}
let runnerFiles = this.files.map(originalFile => <InputFile>_.assign(_.cloneDeep(originalFile), { path: fileMap[originalFile.path] }));
let runner = this.createTestRunner(runnerFiles, false, testSelectionFilePath, index);
return {
index,
fileMap,
runner,
testSelectionFilePath
}
return runner.init().then(() => ({index, fileMap, runner, testSelectionFilePath }));
});
}

Expand Down

0 comments on commit 0675864

Please sign in to comment.