Skip to content

Commit

Permalink
fix(testing): fix migration path error on windows (#9969)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbados-clemens committed Apr 23, 2022
1 parent 8897146 commit 1297f06
Showing 1 changed file with 8 additions and 4 deletions.
@@ -1,5 +1,6 @@
import {
formatFiles,
joinPathFragments,
logger,
offsetFromRoot,
ProjectConfiguration,
Expand Down Expand Up @@ -39,7 +40,10 @@ function updateJestPreset(
tree,
options.jestConfig,
'preset',
join(offsetFromRoot(dirname(options.jestConfig)), 'jest.preset.ts'),
joinPathFragments(
offsetFromRoot(dirname(options.jestConfig)),
'jest.preset.ts'
),
{ valueAsString: false }
);
}
Expand Down Expand Up @@ -79,7 +83,7 @@ function updateTsconfigSpec(
projectConfig: ProjectConfiguration,
path
) {
updateJson(tree, join(projectConfig.root, path), (json) => {
updateJson(tree, joinPathFragments(projectConfig.root, path), (json) => {
json.include = Array.from(
new Set([...(json.include || []), 'jest.config.ts'])
);
Expand Down Expand Up @@ -115,7 +119,7 @@ export async function updateJestConfigExt(tree: Tree) {
const rootFiles = tree.children(projectConfig.root);
for (const fileName of rootFiles) {
if (fileName === 'tsconfig.json') {
const filePath = join(projectConfig.root, fileName);
const filePath = joinPathFragments(projectConfig.root, fileName);
const tsConfig = readJson(tree, filePath);

if (tsConfig.references) {
Expand All @@ -125,7 +129,7 @@ export async function updateJestConfigExt(tree: Tree) {
continue;
}

updateTsConfig(tree, join(projectConfig.root, path));
updateTsConfig(tree, joinPathFragments(projectConfig.root, path));
}
} else {
updateTsConfig(tree, filePath);
Expand Down

0 comments on commit 1297f06

Please sign in to comment.