yarn-spinner-runner-ts 0.1.1-a → 0.1.1-b

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": "yarn-spinner-runner-ts",
3
- "version": "0.1.1a",
3
+ "version": "0.1.1b",
4
4
  "private": false,
5
5
  "description": "TypeScript parser, compiler, and runtime for Yarn Spinner 3.x with React adapter",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "lint": "eslint \"src/**/*.ts\" \"src/**/*.tsx\"",
16
16
  "ts-check": "tsc -p tsconfig.json",
17
17
  "pretest": "npm run build",
18
- "test": "node --test --enable-source-maps \"dist/tests/**/*.test.js\" \"dist/tests/index.test.js\"",
18
+ "test": "node scripts/run-tests.js",
19
19
  "demo": "vite --config examples/browser/vite.config.ts --host 0.0.0.0",
20
20
  "demo:build": "vite build --config examples/browser/vite.config.ts"
21
21
  },
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Test runner script that discovers and runs all test files
5
+ * This ensures cross-platform compatibility (Windows, Linux, macOS)
6
+ */
7
+
8
+ import { readdir } from "fs/promises";
9
+ import { join, dirname } from "path";
10
+ import { fileURLToPath } from "url";
11
+ import { spawn } from "child_process";
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+ const projectRoot = join(__dirname, "..");
16
+ const testsDir = join(projectRoot, "dist", "tests");
17
+
18
+ async function findTestFiles() {
19
+ try {
20
+ const files = await readdir(testsDir);
21
+ return files
22
+ .filter((file) => file.endsWith(".test.js"))
23
+ .map((file) => join(testsDir, file));
24
+ } catch (error) {
25
+ console.error(`Error reading tests directory: ${error.message}`);
26
+ process.exit(1);
27
+ }
28
+ }
29
+
30
+ async function runTests() {
31
+ const testFiles = await findTestFiles();
32
+
33
+ if (testFiles.length === 0) {
34
+ console.error("No test files found!");
35
+ process.exit(1);
36
+ }
37
+
38
+ console.log(`Found ${testFiles.length} test file(s):`);
39
+ testFiles.forEach((file) => console.log(` - ${file}`));
40
+
41
+ const args = ["--test", "--enable-source-maps", ...testFiles];
42
+
43
+ const proc = spawn("node", args, {
44
+ stdio: "inherit",
45
+ cwd: projectRoot,
46
+ });
47
+
48
+ proc.on("exit", (code) => {
49
+ process.exit(code || 0);
50
+ });
51
+ }
52
+
53
+ runTests().catch((error) => {
54
+ console.error(`Error running tests: ${error.message}`);
55
+ process.exit(1);
56
+ });
57
+