Skip to content

Commit

Permalink
Address code review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
chenesan committed Apr 26, 2020
1 parent 0d50802 commit 9df97b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
3 changes: 1 addition & 2 deletions packages/jest-core/src/SearchSource.ts
Expand Up @@ -352,8 +352,7 @@ export default class SearchSource {
const dependencyResolver = this._getOrBuildDependencyResolver();
const relatedSourcesSet = new Set<string>();
changedFiles.forEach(filePath => {
const isTestFile = this.isTestFilePath(filePath);
if (isTestFile) {
if (this.isTestFilePath(filePath)) {
const sourcePaths = dependencyResolver.resolve(filePath, {
skipNodeResolution: this._context.config.skipNodeResolution,
});
Expand Down
13 changes: 6 additions & 7 deletions packages/jest-core/src/__tests__/SearchSource.test.ts
Expand Up @@ -538,7 +538,7 @@ describe('SearchSource', () => {
'../../../jest-runtime/src/__tests__/test_root',
);

beforeEach(done => {
beforeEach(async () => {
const {options: config} = normalize(
{
haste: {
Expand All @@ -553,12 +553,11 @@ describe('SearchSource', () => {
},
{} as Config.Argv,
);
Runtime.createContext(config, {maxWorkers, watchman: false}).then(
context => {
searchSource = new SearchSource(context);
done();
},
);
const context = await Runtime.createContext(config, {
maxWorkers,
watchman: false,
});
searchSource = new SearchSource(context);
});

it('return empty set if no SCM', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-transform/src/shouldInstrument.ts
Expand Up @@ -93,8 +93,7 @@ export default function shouldInstrument(
return false;
}

if (options.changedFiles) {
if (!options.changedFiles.has(filename)) {
if (options.changedFiles && !options.changedFiles.has(filename)) {
if (!options.sourcesRelatedToTestsInChangedFiles) {
return false;
}
Expand Down

0 comments on commit 9df97b2

Please sign in to comment.