-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from inversify/fix/update-test-config-to-dedu…
…plicate-jest-haste-map Update test config roots
- Loading branch information
Showing
6 changed files
with
38 additions
and
21 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
13 changes: 13 additions & 0 deletions
13
packages/foundation/tools/jest-config/lib/config/getProjectRoot.js
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,13 @@ | ||
const projectRoot = '<rootDir>'; | ||
|
||
/** | ||
* @param { !boolean } isTargetingSource True if test are under the source folder | ||
* @returns {!string } Project root path | ||
*/ | ||
export default function getProjectRoot(isTargetingSource) { | ||
if (isTargetingSource) { | ||
return `${projectRoot}/src`; | ||
} else { | ||
return `${projectRoot}/lib/cjs`; | ||
} | ||
} |
15 changes: 3 additions & 12 deletions
15
packages/foundation/tools/jest-config/lib/config/getTestMatch.js
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 |
---|---|---|
@@ -1,23 +1,14 @@ | ||
import projectRoot from './projectRoot.js'; | ||
import getProjectRoot from './getProjectRoot.js'; | ||
|
||
/** | ||
* @param { !string } testExtension Test extension files | ||
* @param { !boolean } isTargetingSource True if test are under the source folder | ||
* @returns { !Array.<string> } | ||
*/ | ||
function getTestMatch(testExtension, isTargetingSource) { | ||
let testMatch; | ||
const projectRoot = getProjectRoot(isTargetingSource); | ||
|
||
if (isTargetingSource) { | ||
testMatch = [`${projectRoot}/src/**/*${testExtension}`]; | ||
} else { | ||
testMatch = [ | ||
`${projectRoot}/{dist,lib}/*${testExtension}`, | ||
`${projectRoot}/{dist,lib}/!(esm)/**/*${testExtension}`, | ||
]; | ||
} | ||
|
||
return testMatch; | ||
return [`${projectRoot}/**/*${testExtension}`]; | ||
} | ||
|
||
export default getTestMatch; |
3 changes: 0 additions & 3 deletions
3
packages/foundation/tools/jest-config/lib/config/projectRoot.js
This file was deleted.
Oops, something went wrong.