@williamthorsen/nmr 0.46.1 → 0.46.2

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.
@@ -1,4 +1,21 @@
1
1
  [
2
+ {
3
+ "version": "0.46.2",
4
+ "date": "2026-10-14",
5
+ "sections": [
6
+ {
7
+ "title": "🐛 Bug fixes",
8
+ "audience": "all",
9
+ "items": [
10
+ {
11
+ "description": "Fixes the issue that `checkTestFileConventions` failed with a bare `TypeError` when `node_modules` contained a second `@vitest/runner` copy, and replaces that error with one that names the resolved `vitest` and gives `pnpm install --force` as the remedy. (#1041)",
12
+ "hash": "ef1755d48b81e14cd4e547d7a0c8f8f0376c3a46",
13
+ "entry": 1
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ },
2
19
  {
3
20
  "version": "0.46.1",
4
21
  "date": "2026-10-13",
@@ -8939,7 +8939,7 @@ function formatPaths(paths) {
8939
8939
  ${paths.map((path7) => ` ${path7}`).join("\n")}`;
8940
8940
  }
8941
8941
  function getMinVersion() {
8942
- const pickedFields = { "version": "0.46.1" };
8942
+ const pickedFields = { "version": "0.46.2" };
8943
8943
  if (typeof pickedFields["version"] !== "string") {
8944
8944
  throw new TypeError("nmr/package.json: 'version' must be a string");
8945
8945
  }
@@ -86,7 +86,7 @@
86
86
  "path": "kits/default.ts"
87
87
  },
88
88
  {
89
- "hash": "e03b7529",
89
+ "hash": "43858381",
90
90
  "kind": "inline",
91
91
  "path": "../package.json",
92
92
  "paths": [
@@ -189,7 +189,7 @@
189
189
  "readyupVersion": "0.40.0",
190
190
  "source": "kits/default.ts",
191
191
  "sourceHash": "aaeb1a84",
192
- "targetHash": "dbfec446"
192
+ "targetHash": "32ebc3f7"
193
193
  }
194
194
  ]
195
195
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.46.2 — 2026-10-14
6
+
7
+ ### 🐛 Bug fixes
8
+
9
+ - Fixes the issue that `checkTestFileConventions` failed with a bare `TypeError` when `node_modules` contained a second `@vitest/runner` copy, and replaces that error with one that names the resolved `vitest` and gives `pnpm install --force` as the remedy. (#1041)
10
+
5
11
  ## 0.46.1 — 2026-10-13
6
12
 
7
13
  ### 🐛 Bug fixes
package/README.md CHANGED
@@ -5,11 +5,11 @@
5
5
  Context-aware script runner for pnpm monorepos. Includes an `nmr` (node-monorepo run) binary that provides centralized, consistent script execution across workspace packages and the monorepo root.
6
6
 
7
7
  <!-- section:release-notes -->
8
- ## Release notes — v0.46.1 (2026-10-13)
8
+ ## Release notes — v0.46.2 (2026-10-14)
9
9
 
10
10
  ### 🐛 Bug fixes
11
11
 
12
- - Fixes the issue that a script run by bare `nmr` inside a package failed with `command not found` on a binary installed only in that package, and found the root's binaries, such as `eslint` and `tsgo`, only when the shell's `PATH` already contained the root's `node_modules/.bin`. (#1039)
12
+ - Fixes the issue that `checkTestFileConventions` failed with a bare `TypeError` when `node_modules` contained a second `@vitest/runner` copy, and replaces that error with one that names the resolved `vitest` and gives `pnpm install --force` as the remedy. (#1041)
13
13
  <!-- /section:release-notes -->
14
14
 
15
15
  ## Installation
@@ -16,6 +16,16 @@
16
16
  * the named directories are pruned.
17
17
  */
18
18
  export declare function checkTestFileConventions(options?: TestFileConventionsOptions): void;
19
+ /**
20
+ * Rejects a `vitest` import that resolved to a runner other than the one executing the file, naming the copy and the
21
+ * remedy. Outside Vitest it does nothing.
22
+ *
23
+ * A second `@vitest/runner` copy is never handed the running state, and its `describe` fails with a bare `TypeError`.
24
+ * The default `probe` comes from `vitest/suite`, which re-exports the same copy as the `describe` imported here.
25
+ *
26
+ * @internal - Exported only to enable testing
27
+ */
28
+ export declare function assertImportedRunnerIsActive(probe?: () => unknown): void;
19
29
  /**
20
30
  * Sweeps a repo for both halves of the convention, reporting the root that it swept alongside what it found.
21
31
  *
package/dist/esm/tests.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { describe, expect, it } from 'vitest';
2
+ import { getCurrentSuite } from 'vitest/suite';
2
3
  import { findMisplacedTestFiles, findUntieredTestFiles, TIER_NAMES } from "./tiers.js";
3
4
  import { findMonorepoRoot } from "./workspace.js";
4
5
  const MISPLACED_REMEDY = 'Every test file must be under a `__tests__` directory, the only place from which the shared Vitest config collects. Move each file below into one, or name its directory in `excludedBasenames`.';
@@ -6,6 +7,7 @@ const UNTIERED_REMEDY = `Every collected test file must name its isolation tier
6
7
  const RETIRED_OPTION_KEYS = new Map([['exclude', 'excludedBasenames']]);
7
8
  export function checkTestFileConventions(options = {}) {
8
9
  assertNoRetiredOptions(options);
10
+ assertImportedRunnerIsActive();
9
11
  describe('test file conventions', () => {
10
12
  const { misplacedFiles, rootDir, untieredFiles } = reportTestFileConventions(options);
11
13
  it('every collected test file names its tier', () => {
@@ -16,6 +18,16 @@ export function checkTestFileConventions(options = {}) {
16
18
  });
17
19
  });
18
20
  }
21
+ export function assertImportedRunnerIsActive(probe = getCurrentSuite) {
22
+ if (process.env['VITEST'] === undefined)
23
+ return;
24
+ try {
25
+ probe();
26
+ }
27
+ catch (error) {
28
+ throw new Error(`The \`vitest\` that @williamthorsen/nmr/tests imports (${import.meta.resolve('vitest')}) is not the runner executing this file: node_modules contains a second vitest runner copy. Run \`pnpm install --force\` to repair it.`, { cause: error });
29
+ }
30
+ }
19
31
  export function reportTestFileConventions(options = {}) {
20
32
  assertNoRetiredOptions(options);
21
33
  const { excludedBasenames, rootDir } = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/nmr",
3
- "version": "0.46.1",
3
+ "version": "0.46.2",
4
4
  "private": false,
5
5
  "description": "Context-aware script runner for pnpm monorepos",
6
6
  "keywords": [