@nx/playwright 0.0.0-pr-31935-e9fb850 → 0.0.0-pr-31936-9fedb75

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/playwright",
3
- "version": "0.0.0-pr-31935-e9fb850",
3
+ "version": "0.0.0-pr-31936-9fedb75",
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": "0.0.0-pr-31935-e9fb850",
39
- "@nx/eslint": "0.0.0-pr-31935-e9fb850",
40
- "@nx/js": "0.0.0-pr-31935-e9fb850",
38
+ "@nx/devkit": "0.0.0-pr-31936-9fedb75",
39
+ "@nx/eslint": "0.0.0-pr-31936-9fedb75",
40
+ "@nx/js": "0.0.0-pr-31936-9fedb75",
41
41
  "tslib": "^2.3.0",
42
42
  "minimatch": "9.0.3"
43
43
  },
@@ -142,26 +142,11 @@ 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
- const testFiles = await getAllTestFiles({
146
- context,
147
- path: testDir,
148
- config: playwrightConfig,
149
- });
150
- for (const testFile of testFiles) {
145
+ await forEachTestFile((testFile) => {
151
146
  const outputSubfolder = (0, node_path_1.relative)(projectRoot, testFile)
152
147
  .replace(/[\/\\]/g, '-')
153
148
  .replace(/\./g, '-');
154
149
  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
- }
165
150
  const targetName = `${options.ciTargetName}--${relativeSpecFilePath}`;
166
151
  ciTargetGroup.push(targetName);
167
152
  targets[targetName] = {
@@ -190,7 +175,11 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
190
175
  projects: 'self',
191
176
  params: 'forward',
192
177
  });
193
- }
178
+ }, {
179
+ context,
180
+ path: testDir,
181
+ config: playwrightConfig,
182
+ });
194
183
  targets[options.ciTargetName] ??= {};
195
184
  targets[options.ciTargetName] = {
196
185
  executor: 'nx:noop',
@@ -219,13 +208,17 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
219
208
  }
220
209
  return { targets, metadata };
221
210
  }
222
- async function getAllTestFiles(opts) {
211
+ async function forEachTestFile(cb, opts) {
223
212
  const files = await (0, workspace_context_1.getFilesInDirectoryUsingContext)(opts.context.workspaceRoot, opts.path);
224
213
  const matcher = createMatcher(opts.config.testMatch);
225
214
  const ignoredMatcher = opts.config.testIgnore
226
215
  ? createMatcher(opts.config.testIgnore)
227
216
  : () => false;
228
- return files.filter((file) => matcher(file) && !ignoredMatcher(file));
217
+ for (const file of files) {
218
+ if (matcher(file) && !ignoredMatcher(file)) {
219
+ cb(file);
220
+ }
221
+ }
229
222
  }
230
223
  function createMatcher(pattern) {
231
224
  if (Array.isArray(pattern)) {