@bsb/tests 9.6.9 → 9.6.10

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.
Files changed (2) hide show
  1. package/bin/bsb-tests.cjs +18 -9
  2. package/package.json +2 -2
package/bin/bsb-tests.cjs CHANGED
@@ -95,6 +95,14 @@ const resolveLocalBaseEntry = (repoRoot, useTs) => {
95
95
  return fs.existsSync(entryTs) ? entryTs : entryJs;
96
96
  };
97
97
 
98
+ const resolveInternalModule = (libRelativePath) => {
99
+ const jsPath = path.join(__dirname, "..", "lib", ...libRelativePath);
100
+ if (fs.existsSync(jsPath)) return jsPath;
101
+ const tsRelativePath = [...libRelativePath];
102
+ tsRelativePath[tsRelativePath.length - 1] = tsRelativePath[tsRelativePath.length - 1].replace(/\.js$/, ".ts");
103
+ return path.join(__dirname, "..", "src", ...tsRelativePath);
104
+ };
105
+
98
106
  const loadTestsManifest = (manifestDir) => {
99
107
  const configPath = path.join(manifestDir, "bsb-tests.json");
100
108
  if (!fs.existsSync(configPath)) return null;
@@ -184,18 +192,19 @@ if (filtered.length === 0) {
184
192
 
185
193
  const repoRoot = cwd;
186
194
  const mochaBin = resolvePackageBin("mocha", "mocha");
187
- const setupHook = path.join(__dirname, "..", "lib", "runner", "setup.js");
188
- const pluginEventsRunner = path.join(__dirname, "..", "lib", "runner", "plugin-events.js");
189
- const pluginObservableRunner = path.join(__dirname, "..", "lib", "runner", "plugin-observable.js");
190
- const pluginCustomRunner = path.join(__dirname, "..", "lib", "runner", "plugin-custom.js");
191
- const eventsDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "events-default", "index.js");
192
- const loggingDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "logging-default", "index.js");
193
- const configDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "config-default", "index.js");
194
- const observableDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "observable-default", "index.js");
195
+ const setupHook = resolveInternalModule(["runner", "setup.js"]);
196
+ const pluginEventsRunner = resolveInternalModule(["runner", "plugin-events.js"]);
197
+ const pluginObservableRunner = resolveInternalModule(["runner", "plugin-observable.js"]);
198
+ const pluginCustomRunner = resolveInternalModule(["runner", "plugin-custom.js"]);
199
+ const eventsDefaultSpec = resolveInternalModule(["plugins", "events-default", "index.js"]);
200
+ const loggingDefaultSpec = resolveInternalModule(["plugins", "logging-default", "index.js"]);
201
+ const configDefaultSpec = resolveInternalModule(["plugins", "config-default", "index.js"]);
202
+ const observableDefaultSpec = resolveInternalModule(["plugins", "observable-default", "index.js"]);
195
203
 
196
204
  const runMocha = (env, spec, useTs, coverage, coverageInclude) => {
197
205
  const mochaArgs = [];
198
- if (useTs) {
206
+ const usesTsRunner = setupHook.endsWith(".ts") || spec.endsWith(".ts");
207
+ if (useTs || usesTsRunner) {
199
208
  const tsNodeRegister = require.resolve("ts-node/register");
200
209
  mochaArgs.push("--require", tsNodeRegister);
201
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsb/tests",
3
- "version": "9.6.9",
3
+ "version": "9.6.10",
4
4
  "description": "Shared test suites for BSB Node.js core and plugins",
5
5
  "license": "(AGPL-3.0-only OR Commercial)",
6
6
  "author": {
@@ -40,7 +40,7 @@
40
40
  "typescript": "^5.9.3"
41
41
  },
42
42
  "engines": {
43
- "node": ">=23.0.0",
43
+ "node": ">=24.0.0",
44
44
  "npm": ">=11.0.0"
45
45
  },
46
46
  "bin": {