@nx/jest 21.2.3 → 21.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/plugins/plugin.js +6 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/jest",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.3.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Jest contains executors and generators allowing your workspace to use the powerful Jest testing capabilities.",
|
|
6
6
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@jest/reporters": "^29.4.1",
|
|
39
39
|
"@jest/test-result": "^29.4.1",
|
|
40
|
-
"@nx/devkit": "21.
|
|
41
|
-
"@nx/js": "21.
|
|
40
|
+
"@nx/devkit": "21.3.0-beta.1",
|
|
41
|
+
"@nx/js": "21.3.0-beta.1",
|
|
42
42
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
43
43
|
"identity-obj-proxy": "3.0.0",
|
|
44
44
|
"jest-config": "^29.4.1",
|
package/src/plugins/plugin.js
CHANGED
|
@@ -32,11 +32,11 @@ exports.createNodesV2 = [
|
|
|
32
32
|
const targetsCache = readTargetsCache(cachePath);
|
|
33
33
|
// Cache jest preset(s) to avoid penalties of module load times. Most of jest configs will use the same preset.
|
|
34
34
|
const presetCache = {};
|
|
35
|
-
const
|
|
35
|
+
const packageManagerWorkspacesGlob = (0, globs_1.combineGlobPatterns)((0, package_json_1.getGlobPatternsFromPackageManagerWorkspaces)(context.workspaceRoot));
|
|
36
36
|
options = normalizeOptions(options);
|
|
37
37
|
const { roots: projectRoots, configFiles: validConfigFiles } = configFiles.reduce((acc, configFile) => {
|
|
38
38
|
const potentialRoot = (0, path_1.dirname)(configFile);
|
|
39
|
-
if (checkIfConfigFileShouldBeProject(configFile, potentialRoot,
|
|
39
|
+
if (checkIfConfigFileShouldBeProject(configFile, potentialRoot, packageManagerWorkspacesGlob, context)) {
|
|
40
40
|
acc.roots.push(potentialRoot);
|
|
41
41
|
acc.configFiles.push(configFile);
|
|
42
42
|
}
|
|
@@ -77,8 +77,8 @@ exports.createNodes = [
|
|
|
77
77
|
async (configFilePath, options, context) => {
|
|
78
78
|
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
|
79
79
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
80
|
-
const
|
|
81
|
-
if (!checkIfConfigFileShouldBeProject(configFilePath, projectRoot,
|
|
80
|
+
const packageManagerWorkspacesGlob = (0, globs_1.combineGlobPatterns)((0, package_json_1.getGlobPatternsFromPackageManagerWorkspaces)(context.workspaceRoot));
|
|
81
|
+
if (!checkIfConfigFileShouldBeProject(configFilePath, projectRoot, packageManagerWorkspacesGlob, context)) {
|
|
82
82
|
return {};
|
|
83
83
|
}
|
|
84
84
|
options = normalizeOptions(options);
|
|
@@ -94,14 +94,7 @@ exports.createNodes = [
|
|
|
94
94
|
};
|
|
95
95
|
},
|
|
96
96
|
];
|
|
97
|
-
function
|
|
98
|
-
if (process.env.NX_INFER_ALL_PACKAGE_JSONS === 'true') {
|
|
99
|
-
return () => true;
|
|
100
|
-
}
|
|
101
|
-
const packageManagerWorkspacesGlob = (0, globs_1.combineGlobPatterns)((0, package_json_1.getGlobPatternsFromPackageManagerWorkspaces)(workspaceRoot));
|
|
102
|
-
return (path) => (0, minimatch_1.minimatch)(path, packageManagerWorkspacesGlob);
|
|
103
|
-
}
|
|
104
|
-
function checkIfConfigFileShouldBeProject(configFilePath, projectRoot, isInPackageManagerWorkspaces, context) {
|
|
97
|
+
function checkIfConfigFileShouldBeProject(configFilePath, projectRoot, packageManagerWorkspacesGlob, context) {
|
|
105
98
|
// Do not create a project if package.json and project.json isn't there.
|
|
106
99
|
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
107
100
|
if (!siblingFiles.includes('package.json') &&
|
|
@@ -111,7 +104,7 @@ function checkIfConfigFileShouldBeProject(configFilePath, projectRoot, isInPacka
|
|
|
111
104
|
else if (!siblingFiles.includes('project.json') &&
|
|
112
105
|
siblingFiles.includes('package.json')) {
|
|
113
106
|
const path = (0, devkit_1.joinPathFragments)(projectRoot, 'package.json');
|
|
114
|
-
const isPackageJsonProject =
|
|
107
|
+
const isPackageJsonProject = (0, minimatch_1.minimatch)(path, packageManagerWorkspacesGlob);
|
|
115
108
|
if (!isPackageJsonProject) {
|
|
116
109
|
return false;
|
|
117
110
|
}
|