Skip to content

Commit

Permalink
fix(jest-runner): support custom rootDir
Browse files Browse the repository at this point in the history
Support `rootDir: 'my-custom-rootdir'` in jest config.
  • Loading branch information
nicojs committed Jan 25, 2021
1 parent 32aea64 commit 312f6fe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
6 changes: 0 additions & 6 deletions packages/jest-runner/src/jest-test-runner.ts
Expand Up @@ -85,12 +85,6 @@ export default class JestTestRunner implements TestRunner {
'Running jest without --findRelatedTests flag. Set jest.enableFindRelatedTests to true to run only relevant tests on every mutant.'
);
}

// basePath will be used in future releases of Stryker as a way to define the project root
// Default to process.cwd when basePath is not set for now, should be removed when issue is solved
// https://github.com/stryker-mutator/stryker/issues/650
this.jestConfig.rootDir = (options.basePath as string) || process.cwd();
this.log.debug(`Project root is ${this.jestConfig.rootDir}`);
}

public async dryRun({ coverageAnalysis }: Pick<DryRunOptions, 'coverageAnalysis'>): Promise<DryRunResult> {
Expand Down
4 changes: 0 additions & 4 deletions packages/jest-runner/test/unit/jest-test-runner.spec.ts
Expand Up @@ -46,10 +46,6 @@ describe(JestTestRunner.name, () => {
});

describe('constructor', () => {
it('should log the project root when constructing the JestTestRunner', () => {
createSut();
expect(testInjector.logger.debug).calledWith(`Project root is ${basePath}`);
});
it('should log enabled find related tests helper message to debug if set', () => {
options.jest.enableFindRelatedTests = true;
createSut();
Expand Down

0 comments on commit 312f6fe

Please sign in to comment.