Skip to content

Commit 0f777d4

Browse files
committed
Fix an issue with heft-jest-plugin/lib paths.
1 parent f5ae02a commit 0f777d4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

heft-plugins/heft-jest-plugin/src/JestPlugin.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ export default class JestPlugin implements IHeftTaskPlugin<IJestPluginOptions> {
893893
* - replace `<rootDir>` with the same rootDir
894894
* - replace `<configDir>` with the directory containing the current configuration file
895895
* - replace `<packageDir:...>` with the path to the resolved package (NOT module)
896+
* - re-path `@rushstack/heft-jest-plugin/lib/...` to `@rushstack/heft-jest-plugin/lib-commonjs/...`
896897
*/
897898
private static _getJsonPathMetadata(
898899
options: IJestResolutionOptions
@@ -970,7 +971,12 @@ export default class JestPlugin implements IHeftTaskPlugin<IJestPluginOptions> {
970971

971972
// Example: @rushstack/heft-jest-plugin/path/to/file.js
972973
if (propertyValue.startsWith(PLUGIN_PACKAGE_NAME)) {
973-
const restOfPath: string = path.normalize('./' + propertyValue.slice(PLUGIN_PACKAGE_NAME.length));
974+
debugger;
975+
let restOfPath: string = path.posix.normalize(
976+
'./' + propertyValue.slice(PLUGIN_PACKAGE_NAME.length)
977+
);
978+
restOfPath = restOfPath.replace(/^(\.\/)?lib(\/|\\)/, 'lib-commonjs/');
979+
974980
return path.join(PLUGIN_PACKAGE_FOLDER, restOfPath);
975981
}
976982

rigs/local-node-rig/profiles/default/config/jest.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
]
2626
],
2727

28-
"resolver": "@rushstack/heft-jest-plugin/lib/exports/jest-node-modules-symlink-resolver.js"
28+
"resolver": "@rushstack/heft-jest-plugin/lib-commonjs/exports/jest-node-modules-symlink-resolver.js"
2929
}

0 commit comments

Comments
 (0)