@bsb/tests 9.5.5 → 9.5.7
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/bin/bsb-tests.cjs +20 -12
- package/package.json +5 -4
package/bin/bsb-tests.cjs
CHANGED
|
@@ -60,8 +60,15 @@ const resolvePluginModule = (pluginRoot, pluginPath, useTs) => {
|
|
|
60
60
|
return path.join(swapped, "index.js");
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
const hasBuiltPluginModule = (pluginRoot, pluginPath) => {
|
|
64
|
+
return fs.existsSync(resolvePluginModule(pluginRoot, pluginPath, false));
|
|
65
|
+
};
|
|
66
|
+
|
|
63
67
|
const resolveLocalBaseEntry = (repoRoot, useTs) => {
|
|
64
|
-
const
|
|
68
|
+
const nestedBaseRoot = path.join(repoRoot, "nodejs");
|
|
69
|
+
const baseRoot = fs.existsSync(path.join(nestedBaseRoot, "package.json"))
|
|
70
|
+
? nestedBaseRoot
|
|
71
|
+
: repoRoot;
|
|
65
72
|
const entryTs = path.join(baseRoot, "src", "index.ts");
|
|
66
73
|
const entryJs = path.join(baseRoot, "lib", "index.js");
|
|
67
74
|
if (useTs && fs.existsSync(entryTs)) return entryTs;
|
|
@@ -158,20 +165,19 @@ if (filtered.length === 0) {
|
|
|
158
165
|
|
|
159
166
|
const repoRoot = cwd;
|
|
160
167
|
const mochaBin = require.resolve("mocha/bin/mocha.mjs");
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const configDefaultSpec = path.join(__dirname, "..", "src", "plugins", "config-default", "index.ts");
|
|
170
|
-
const observableDefaultSpec = path.join(__dirname, "..", "src", "plugins", "observable-default", "index.ts");
|
|
168
|
+
const setupHook = path.join(__dirname, "..", "lib", "runner", "setup.js");
|
|
169
|
+
const pluginEventsRunner = path.join(__dirname, "..", "lib", "runner", "plugin-events.js");
|
|
170
|
+
const pluginObservableRunner = path.join(__dirname, "..", "lib", "runner", "plugin-observable.js");
|
|
171
|
+
const pluginCustomRunner = path.join(__dirname, "..", "lib", "runner", "plugin-custom.js");
|
|
172
|
+
const eventsDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "events-default", "index.js");
|
|
173
|
+
const loggingDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "logging-default", "index.js");
|
|
174
|
+
const configDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "config-default", "index.js");
|
|
175
|
+
const observableDefaultSpec = path.join(__dirname, "..", "lib", "plugins", "observable-default", "index.js");
|
|
171
176
|
|
|
172
177
|
const runMocha = (env, spec, useTs, coverage, coverageInclude) => {
|
|
173
178
|
const mochaArgs = [];
|
|
174
179
|
if (useTs) {
|
|
180
|
+
const tsNodeRegister = require.resolve("ts-node/register");
|
|
175
181
|
mochaArgs.push("--require", tsNodeRegister);
|
|
176
182
|
}
|
|
177
183
|
mochaArgs.push("--require", setupHook, spec);
|
|
@@ -184,6 +190,7 @@ const runMocha = (env, spec, useTs, coverage, coverageInclude) => {
|
|
|
184
190
|
return result.status || 0;
|
|
185
191
|
}
|
|
186
192
|
|
|
193
|
+
const nycBin = require.resolve("nyc/bin/nyc.js");
|
|
187
194
|
const nycArgs = [
|
|
188
195
|
"--all",
|
|
189
196
|
"--check-coverage",
|
|
@@ -226,7 +233,7 @@ for (const plugin of filtered) {
|
|
|
226
233
|
continue;
|
|
227
234
|
}
|
|
228
235
|
|
|
229
|
-
const useTs = forceTs || (!forceJs && fs.existsSync(path.join(plugin.pluginRoot, "src")));
|
|
236
|
+
const useTs = forceTs || (!forceJs && !hasBuiltPluginModule(plugin.pluginRoot, plugin.pluginPath) && fs.existsSync(path.join(plugin.pluginRoot, "src")));
|
|
230
237
|
const pluginModule = resolvePluginModule(plugin.pluginRoot, plugin.pluginPath, useTs);
|
|
231
238
|
if (!fs.existsSync(pluginModule)) {
|
|
232
239
|
console.error("Plugin module not found:", pluginModule);
|
|
@@ -257,6 +264,7 @@ for (const plugin of filtered) {
|
|
|
257
264
|
const ext = path.extname(resolved).toLowerCase();
|
|
258
265
|
let result;
|
|
259
266
|
if (ext === ".ts") {
|
|
267
|
+
const tsNodeRegister = require.resolve("ts-node/register");
|
|
260
268
|
result = spawnSync(process.execPath, ["-r", tsNodeRegister, resolved], {
|
|
261
269
|
stdio: "inherit",
|
|
262
270
|
env: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsb/tests",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.7",
|
|
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": {
|
|
@@ -28,14 +28,15 @@
|
|
|
28
28
|
"cli": "node ./bin/bsb-tests.cjs"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@bsb/base": "^9.0.0"
|
|
31
|
+
"@bsb/base": "^9.0.0",
|
|
32
|
+
"mocha": "^12.0.0-beta-9.6",
|
|
33
|
+
"nyc": "^17.1.0",
|
|
34
|
+
"ts-node": "^10.9.2"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
37
|
"@types/mocha": "^10.0.6",
|
|
35
38
|
"@types/node": "^25.0.0",
|
|
36
|
-
"mocha": "^12.0.0-beta-9.6",
|
|
37
39
|
"rimraf": "^6.1.2",
|
|
38
|
-
"ts-node": "^10.9.2",
|
|
39
40
|
"typescript": "^5.9.3"
|
|
40
41
|
},
|
|
41
42
|
"engines": {
|