Skip to content

Commit

Permalink
Apply suggestion from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrick95 committed Nov 22, 2019
1 parent e6d6c66 commit b8f6009
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/jest-config/src/index.ts
Expand Up @@ -292,6 +292,11 @@ export function readConfigs(
}

if (projects.length > 0) {
const projectIsCwd =
process.platform === 'win32'
? projects[0] === realpath(process.cwd())
: projects[0] === process.cwd();

const parsedConfigs = projects
.filter(root => {
// Ignore globbed files that cannot be `require`d.
Expand All @@ -308,14 +313,10 @@ export function readConfigs(
return true;
})
.map((root, projectIndex) => {
// Skip on all except: projectIndex === 0, projects[0] === process.cwd() or realpath(process.cwd()) on Windows, and projects.length === 1
const skipArgvConfigOption = !(
projectIndex === 0 &&
(process.platform === 'win32'
? projects[0] === realpath(process.cwd())
: projects[0] === process.cwd()) &&
projects.length === 1
);
const projectIsTheOnlyProject =
projectIndex === 0 && projects.length === 1;
const skipArgvConfigOption = !(projectIsTheOnlyProject && projectIsCwd);

return readConfig(
argv,
root,
Expand Down

0 comments on commit b8f6009

Please sign in to comment.