@nx/playwright 21.3.0-canary.20250715-cf994df → 21.3.0-canary.20250716-46d21c7
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 +4 -4
- package/src/plugins/plugin.js +19 -12
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/playwright",
|
3
|
-
"version": "21.3.0-canary.
|
3
|
+
"version": "21.3.0-canary.20250716-46d21c7",
|
4
4
|
"type": "commonjs",
|
5
5
|
"homepage": "https://nx.dev",
|
6
6
|
"private": false,
|
@@ -35,9 +35,9 @@
|
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
37
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
38
|
-
"@nx/devkit": "21.3.0-canary.
|
39
|
-
"@nx/eslint": "21.3.0-canary.
|
40
|
-
"@nx/js": "21.3.0-canary.
|
38
|
+
"@nx/devkit": "21.3.0-canary.20250716-46d21c7",
|
39
|
+
"@nx/eslint": "21.3.0-canary.20250716-46d21c7",
|
40
|
+
"@nx/js": "21.3.0-canary.20250716-46d21c7",
|
41
41
|
"tslib": "^2.3.0",
|
42
42
|
"minimatch": "9.0.3"
|
43
43
|
},
|
package/src/plugins/plugin.js
CHANGED
@@ -142,11 +142,26 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
142
142
|
// Playwright defaults to the following pattern.
|
143
143
|
playwrightConfig.testMatch ??= '**/*.@(spec|test).?(c|m)[jt]s?(x)';
|
144
144
|
const dependsOn = [];
|
145
|
-
await
|
145
|
+
const testFiles = await getAllTestFiles({
|
146
|
+
context,
|
147
|
+
path: testDir,
|
148
|
+
config: playwrightConfig,
|
149
|
+
});
|
150
|
+
for (const testFile of testFiles) {
|
146
151
|
const outputSubfolder = (0, node_path_1.relative)(projectRoot, testFile)
|
147
152
|
.replace(/[\/\\]/g, '-')
|
148
153
|
.replace(/\./g, '-');
|
149
154
|
const relativeSpecFilePath = (0, devkit_1.normalizePath)((0, node_path_1.relative)(projectRoot, testFile));
|
155
|
+
if (relativeSpecFilePath.includes('../')) {
|
156
|
+
throw new Error('@nx/playwright/plugin attempted to run tests outside of the project root. This is not supported and should not happen. Please open an issue at https://github.com/nrwl/nx/issues/new/choose with the following information:\n\n' +
|
157
|
+
`\n\n${JSON.stringify({
|
158
|
+
projectRoot,
|
159
|
+
testFile,
|
160
|
+
testFiles,
|
161
|
+
context,
|
162
|
+
config: playwrightConfig,
|
163
|
+
}, null, 2)}`);
|
164
|
+
}
|
150
165
|
const targetName = `${options.ciTargetName}--${relativeSpecFilePath}`;
|
151
166
|
ciTargetGroup.push(targetName);
|
152
167
|
targets[targetName] = {
|
@@ -175,11 +190,7 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
175
190
|
projects: 'self',
|
176
191
|
params: 'forward',
|
177
192
|
});
|
178
|
-
}
|
179
|
-
context,
|
180
|
-
path: testDir,
|
181
|
-
config: playwrightConfig,
|
182
|
-
});
|
193
|
+
}
|
183
194
|
targets[options.ciTargetName] ??= {};
|
184
195
|
targets[options.ciTargetName] = {
|
185
196
|
executor: 'nx:noop',
|
@@ -208,17 +219,13 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
208
219
|
}
|
209
220
|
return { targets, metadata };
|
210
221
|
}
|
211
|
-
async function
|
222
|
+
async function getAllTestFiles(opts) {
|
212
223
|
const files = await (0, workspace_context_1.getFilesInDirectoryUsingContext)(opts.context.workspaceRoot, opts.path);
|
213
224
|
const matcher = createMatcher(opts.config.testMatch);
|
214
225
|
const ignoredMatcher = opts.config.testIgnore
|
215
226
|
? createMatcher(opts.config.testIgnore)
|
216
227
|
: () => false;
|
217
|
-
|
218
|
-
if (matcher(file) && !ignoredMatcher(file)) {
|
219
|
-
cb(file);
|
220
|
-
}
|
221
|
-
}
|
228
|
+
return files.filter((file) => matcher(file) && !ignoredMatcher(file));
|
222
229
|
}
|
223
230
|
function createMatcher(pattern) {
|
224
231
|
if (Array.isArray(pattern)) {
|