@zukhruf/nx 0.8.125 → 0.8.127

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/README.md CHANGED
@@ -317,7 +317,7 @@ Thus a file outside these globs does not run, for example a build output or a `t
317
317
 
318
318
  ### Run one file or one test
319
319
 
320
- `<run.js>` is `dist/test/run.js` of this package, written relative to the project root. It starts `node` with the words of the command in their order. Each `--selection="<glob>"` is a glob of the test selection (see above).
320
+ `<run.js>` is `dist/test/run.js` of this package, written relative to the project root. It starts `node` with the words of the command, the files last. Each `--selection="<glob>"` is a glob of the test selection (see above).
321
321
 
322
322
  Put the test files after `--` to run only them, as with `@nx/jest` and `@nx/vite`. A word that does not start with `-` and ends with `.test.{ts,mts,cts,js,mjs}` names test files, and a glob does too. Then the selection goes:
323
323
 
@@ -334,7 +334,7 @@ A Node flag keeps the selection. Use it to run the tests with a name:
334
334
  nx run mutex:test --test-name-pattern=login
335
335
  ```
336
336
 
337
- Put a flag before the files, because Node reads a flag after a file as a file name. `node --test "x.test.ts" --test-timeout=1` stops with exit code 1: `Could not find 'x.test.ts, --test-timeout=1'`. Thus `nx run mutex:test -- --test-name-pattern=login src/login.test.ts` runs the tests named `login` in `src/login.test.ts`. When the run names no files, `run.js` puts the selection after all the words, so a flag on the CLI, after `--` or in `--args` always comes before the globs.
337
+ A flag can come before or after the files. `run.js` puts the files after all the other words, because Node reads a flag after a file as one more file pattern. When another pattern matches a file, Node ignores that flag and exits with code 0: `node --test src/login.test.ts --test-name-pattern=login` runs every test in `src/login.test.ts`. The other words keep their order, so a value in its own word stays after its flag. Thus `nx run mutex:test -- src/login.test.ts --test-name-pattern=login` and `nx run mutex:test -- --test-name-pattern login src/login.test.ts` run the tests named `login` in `src/login.test.ts`. When the run names no files, `run.js` puts the selection after all the words.
338
338
 
339
339
  The selection is in the command, not in `args`, because `--args` replaces `args`. Then `--args=--test-name-pattern=login` would leave Node with no file, and Node's own default pattern would run `test/helpers/*` too.
340
340
 
package/dist/test/run.js CHANGED
@@ -2,8 +2,10 @@
2
2
  // `node run.js --test <flags> --selection=<glob>… <forwarded words>`. A
3
3
  // forwarded word that names test files narrows the run, as
4
4
  // `nx test <project> -- <file>` does with `@nx/jest` and `@nx/vite`, and then
5
- // the selection goes. Else the selection comes last, after the forwarded
6
- // flags, because Node reads a flag after a file as a file (ADR 0004).
5
+ // the selection goes. The files, the named ones or else the selection, come
6
+ // after every other word, because Node reads a flag after a file as a file
7
+ // pattern and drops it with exit code 0 when another pattern matches (ADR
8
+ // 0004). The other words keep their order, so a value stays after its flag.
7
9
  import { spawn } from 'node:child_process';
8
10
  import { once } from 'node:events';
9
11
  import { testFile } from './test-file.js';
@@ -13,8 +15,10 @@ const forwarded = words.filter((word) => !word.startsWith(marker));
13
15
  const selection = words
14
16
  .filter((word) => word.startsWith(marker))
15
17
  .map((word) => word.slice(marker.length));
16
- const narrowed = forwarded.some((word) => !word.startsWith('-') && testFile.test(word));
17
- const node = spawn(process.execPath, narrowed ? forwarded : [...forwarded, ...selection], { stdio: 'inherit' });
18
+ const namesTestFile = (word) => !word.startsWith('-') && testFile.test(word);
19
+ const named = forwarded.filter(namesTestFile);
20
+ const others = forwarded.filter((word) => !namesTestFile(word));
21
+ const node = spawn(process.execPath, [...others, ...(named.length > 0 ? named : selection)], { stdio: 'inherit' });
18
22
  const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
19
23
  const forward = (signal) => node.kill(signal);
20
24
  for (const signal of signals)
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/test/run.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,2DAA2D;AAC3D,8EAA8E;AAC9E,yEAAyE;AACzE,sEAAsE;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,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@zukhruf/nx",
3
- "version": "0.8.125",
3
+ "version": "0.8.127",
4
4
  "description": "The Nx part of the monorepo standard: inference plugins for format, test, lint, opentofu and prisma targets, and generators for the root files (preset, init), apps (node-app, react-app, pair, ui-package), a db package (prisma) and delivery (dokploy).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -132,7 +132,7 @@
132
132
  "@nx/react": ">=24.0.6 <25.0.0",
133
133
  "@nx/vite": ">=24.0.6 <25.0.0",
134
134
  "@nx/vitest": ">=24.0.6 <25.0.0",
135
- "@zukhruf/testing": "^0.8.125",
135
+ "@zukhruf/testing": "^0.8.127",
136
136
  "nx": ">=24.0.6 <25.0.0",
137
137
  "prettier": "^3.0.0",
138
138
  "typescript": ">=5.8.0 <6.1.0"
@@ -159,9 +159,9 @@
159
159
  },
160
160
  "devDependencies": {
161
161
  "@sdk-it/hono": "0.46.11",
162
- "@zukhruf/eslint": "^0.8.125",
163
- "@zukhruf/fs": "^0.8.125",
164
- "@zukhruf/testing": "^0.8.125",
162
+ "@zukhruf/eslint": "^0.8.127",
163
+ "@zukhruf/fs": "^0.8.127",
164
+ "@zukhruf/testing": "^0.8.127",
165
165
  "evlog": "2.35.1",
166
166
  "hono": "4.13.20"
167
167
  }