-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(isolated-test-runner): Support regexes (#146)
* Add support for communicating regexes (and functions) from the stryker process to test runners running in child processes. * Add dependency to 'serialize-javascript'. A minimalistic module for serializing regexes and functions in a json structure.
- Loading branch information
Showing
7 changed files
with
62 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/integration/isolated-runner/DiscoverRegexTestRunner.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { TestRunnerFactory, RunnerOptions, TestRunner, RunOptions, RunResult, TestResult } from 'stryker-api/test_runner'; | ||
import { isRegExp } from 'util'; | ||
|
||
class DiscoverRegexTestRunner implements TestRunner { | ||
|
||
constructor(private runnerOptions: RunnerOptions) { | ||
} | ||
|
||
run(options: RunOptions) { | ||
if (isRegExp(this.runnerOptions.strykerOptions['someRegex'])) { | ||
return Promise.resolve({ result: TestResult.Complete, testNames: []}); | ||
} else { | ||
return Promise.resolve({ result: TestResult.Error, testNames: [], errorMessages: ['No regex found in runnerOptions.strykerOptions.someRegex'] }); | ||
} | ||
} | ||
} | ||
|
||
TestRunnerFactory.instance().register('discover-regex', DiscoverRegexTestRunner); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters