@telorun/test 0.4.32 → 0.4.34
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/dist/suite.js +13 -22
- package/package.json +3 -2
- package/src/suite.ts +14 -21
package/dist/suite.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { selectByPatterns } from "@telorun/glob";
|
|
1
2
|
import { Kernel, LocalFileSource } from "@telorun/kernel";
|
|
2
3
|
import { Type } from "@sinclair/typebox";
|
|
3
4
|
import * as fs from "fs";
|
|
@@ -38,35 +39,25 @@ function createColors(stream) {
|
|
|
38
39
|
dim: (t) => c("2", t),
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
function globToRegex(pattern) {
|
|
42
|
-
const re = pattern
|
|
43
|
-
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
44
|
-
.replace(/\*\*\//g, "(.+/)?")
|
|
45
|
-
.replace(/\*/g, "[^/]+");
|
|
46
|
-
return new RegExp(`^${re}$`);
|
|
47
|
-
}
|
|
48
42
|
function discoverTests(baseDir, include, exclude, filter) {
|
|
49
43
|
const entries = fs.readdirSync(baseDir, { recursive: true, encoding: "utf8" });
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
const rels = entries.map((entry) => entry.replace(/\\/g, "/"));
|
|
45
|
+
// Match with the monorepo's single glob engine. `applyDefaultIgnore: false`
|
|
46
|
+
// skips only the soft tier; the hard tier still denies `node_modules` — the
|
|
47
|
+
// symlinked workspace dupes / vendored copies that must never run as
|
|
48
|
+
// workspace tests — so discovery only adds the user-facing `exclude`
|
|
49
|
+
// (defaults to __fixtures__).
|
|
50
|
+
const selected = selectByPatterns(rels, include, {
|
|
51
|
+
applyDefaultIgnore: false,
|
|
52
|
+
exclude,
|
|
53
|
+
});
|
|
53
54
|
// Dedupe by realpath: pnpm symlinks workspace packages into multiple
|
|
54
55
|
// node_modules locations, so the same test file can be reached via
|
|
55
56
|
// many paths. Without dedupe, recursive traversal yields the same yaml
|
|
56
57
|
// dozens of times under different prefixes.
|
|
57
58
|
const seen = new Set();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// Hard-skip node_modules: those are always symlinked workspace dupes
|
|
61
|
-
// (or vendored copies that shouldn't run as workspace tests). The
|
|
62
|
-
// user-facing `exclude` defaults to `__fixtures__` only, but
|
|
63
|
-
// node_modules is a hard architectural skip.
|
|
64
|
-
if (rel.split("/").includes("node_modules"))
|
|
65
|
-
continue;
|
|
66
|
-
if (!includeRe.some((re) => re.test(rel)))
|
|
67
|
-
continue;
|
|
68
|
-
if (excludeRe.some((re) => re.test(rel)))
|
|
69
|
-
continue;
|
|
59
|
+
const results = [];
|
|
60
|
+
for (const rel of selected) {
|
|
70
61
|
if (filter && !rel.includes(filter))
|
|
71
62
|
continue;
|
|
72
63
|
const abs = path.resolve(baseDir, rel);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telorun/test",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.34",
|
|
4
4
|
"description": "Telo Test module - Test runner for Telo manifests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"telo",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@sinclair/typebox": "^0.34.48",
|
|
36
|
-
"@telorun/
|
|
36
|
+
"@telorun/glob": "0.2.0",
|
|
37
|
+
"@telorun/kernel": "0.39.1"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@types/node": "^20.0.0",
|
package/src/suite.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { selectByPatterns } from "@telorun/glob";
|
|
1
2
|
import { Kernel, LocalFileSource } from "@telorun/kernel";
|
|
2
3
|
import type { ResourceContext, Runnable } from "@telorun/sdk";
|
|
3
4
|
import { Static, Type } from "@sinclair/typebox";
|
|
@@ -62,14 +63,6 @@ function createColors(stream: NodeJS.WritableStream) {
|
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
function globToRegex(pattern: string): RegExp {
|
|
66
|
-
const re = pattern
|
|
67
|
-
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
68
|
-
.replace(/\*\*\//g, "(.+/)?")
|
|
69
|
-
.replace(/\*/g, "[^/]+");
|
|
70
|
-
return new RegExp(`^${re}$`);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
66
|
function discoverTests(
|
|
74
67
|
baseDir: string,
|
|
75
68
|
include: string[],
|
|
@@ -77,25 +70,25 @@ function discoverTests(
|
|
|
77
70
|
filter?: string,
|
|
78
71
|
): string[] {
|
|
79
72
|
const entries = fs.readdirSync(baseDir, { recursive: true, encoding: "utf8" });
|
|
80
|
-
const
|
|
81
|
-
|
|
73
|
+
const rels = entries.map((entry) => entry.replace(/\\/g, "/"));
|
|
74
|
+
|
|
75
|
+
// Match with the monorepo's single glob engine. `applyDefaultIgnore: false`
|
|
76
|
+
// skips only the soft tier; the hard tier still denies `node_modules` — the
|
|
77
|
+
// symlinked workspace dupes / vendored copies that must never run as
|
|
78
|
+
// workspace tests — so discovery only adds the user-facing `exclude`
|
|
79
|
+
// (defaults to __fixtures__).
|
|
80
|
+
const selected = selectByPatterns(rels, include, {
|
|
81
|
+
applyDefaultIgnore: false,
|
|
82
|
+
exclude,
|
|
83
|
+
});
|
|
82
84
|
|
|
83
|
-
const results: string[] = [];
|
|
84
85
|
// Dedupe by realpath: pnpm symlinks workspace packages into multiple
|
|
85
86
|
// node_modules locations, so the same test file can be reached via
|
|
86
87
|
// many paths. Without dedupe, recursive traversal yields the same yaml
|
|
87
88
|
// dozens of times under different prefixes.
|
|
88
89
|
const seen = new Set<string>();
|
|
89
|
-
|
|
90
|
-
for (const
|
|
91
|
-
const rel = entry.replace(/\\/g, "/");
|
|
92
|
-
// Hard-skip node_modules: those are always symlinked workspace dupes
|
|
93
|
-
// (or vendored copies that shouldn't run as workspace tests). The
|
|
94
|
-
// user-facing `exclude` defaults to `__fixtures__` only, but
|
|
95
|
-
// node_modules is a hard architectural skip.
|
|
96
|
-
if (rel.split("/").includes("node_modules")) continue;
|
|
97
|
-
if (!includeRe.some((re) => re.test(rel))) continue;
|
|
98
|
-
if (excludeRe.some((re) => re.test(rel))) continue;
|
|
90
|
+
const results: string[] = [];
|
|
91
|
+
for (const rel of selected) {
|
|
99
92
|
if (filter && !rel.includes(filter)) continue;
|
|
100
93
|
const abs = path.resolve(baseDir, rel);
|
|
101
94
|
let real: string;
|