proby 0.16.0 → 0.16.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.
- package/lib/Schema.js +1 -1
- package/lib/bin.js +1 -16
- package/lib/run.js +10 -3
- package/package.json +6 -6
package/lib/Schema.js
CHANGED
package/lib/bin.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import Schema from "#Schema";
|
|
3
3
|
import env from "@rcompat/env";
|
|
4
|
-
import fs from "@rcompat/fs";
|
|
5
4
|
import io from "@rcompat/io";
|
|
6
5
|
import is from "@rcompat/is";
|
|
7
6
|
import runtime from "@rcompat/runtime";
|
|
8
|
-
async function read_conditions(file) {
|
|
9
|
-
const json = await file.json();
|
|
10
|
-
if (json.compilerOptions?.customConditions?.length) {
|
|
11
|
-
return json.compilerOptions.customConditions;
|
|
12
|
-
}
|
|
13
|
-
if (json.extends === undefined) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
const next = runtime.resolve(json.extends, file.directory.path);
|
|
17
|
-
return read_conditions(fs.ref(next));
|
|
18
|
-
}
|
|
19
7
|
const root = await runtime.projectRoot();
|
|
20
8
|
const ts_config_file = root.join("proby.config.ts");
|
|
21
9
|
const js_config_file = root.join("proby.config.js");
|
|
@@ -25,10 +13,7 @@ const user_config = await ts_config_file.exists()
|
|
|
25
13
|
? (await js_config_file.import("default"))
|
|
26
14
|
: {};
|
|
27
15
|
const { include, packages, monorepo } = Schema.parse(user_config);
|
|
28
|
-
const
|
|
29
|
-
const conditions = await ts_config.exists()
|
|
30
|
-
? await read_conditions(ts_config)
|
|
31
|
-
: [];
|
|
16
|
+
const conditions = await runtime.conditions(root);
|
|
32
17
|
const conditions_flags = conditions
|
|
33
18
|
.map(c => ` --conditions="${c}"`)
|
|
34
19
|
.join("");
|
package/lib/run.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import assert from "@rcompat/assert";
|
|
2
2
|
import color from "@rcompat/cli/color";
|
|
3
3
|
import print from "@rcompat/cli/print";
|
|
4
|
+
import fs from "@rcompat/fs";
|
|
4
5
|
import repository from "@rcompat/test/repository";
|
|
5
6
|
import { Worker } from "node:worker_threads";
|
|
6
7
|
const extensions = [".spec.ts", ".spec.js"];
|
|
@@ -74,17 +75,23 @@ async function run_in_worker(spec, env) {
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
export default async (root, subrepo, target, group) => {
|
|
78
|
+
const resolved = target === undefined ? undefined : fs.resolve(target).path;
|
|
77
79
|
const files = await root.list({
|
|
78
80
|
recursive: true,
|
|
79
|
-
filter: info =>
|
|
81
|
+
filter: info => {
|
|
82
|
+
const path = info.path;
|
|
83
|
+
if (resolved === undefined)
|
|
84
|
+
return extensions.some(e => path.endsWith(e));
|
|
85
|
+
if (extensions.some(e => resolved.endsWith(e)))
|
|
86
|
+
return path.endsWith(resolved);
|
|
87
|
+
return info.path.startsWith(resolved) && extensions.some(e => path.endsWith(e));
|
|
88
|
+
},
|
|
80
89
|
});
|
|
81
90
|
if (files.length === 0)
|
|
82
91
|
return;
|
|
83
92
|
if (subrepo !== undefined)
|
|
84
93
|
print(`${color.blue(subrepo)}\n`);
|
|
85
94
|
for (const file of files) {
|
|
86
|
-
if (target !== undefined && !file.path.endsWith(target))
|
|
87
|
-
continue;
|
|
88
95
|
const env_file = await file.sibling(file.name.replace(/\.spec\.(ts|js)$/, ".env.ts")).or(() => null);
|
|
89
96
|
if (env_file !== null) {
|
|
90
97
|
await run_in_worker(file, env_file);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proby",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "Standard library test runner",
|
|
5
5
|
"bugs": "https://github.com/rcompat/rcompat/issues",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@rcompat/assert": "^0.11.0",
|
|
20
|
-
"@rcompat/env": "^0.20.0",
|
|
21
|
-
"@rcompat/fs": "^0.31.0",
|
|
22
20
|
"@rcompat/cli": "^0.21.0",
|
|
21
|
+
"@rcompat/env": "^0.20.1",
|
|
22
|
+
"@rcompat/fs": "^0.31.0",
|
|
23
23
|
"@rcompat/is": "^0.9.0",
|
|
24
|
-
"@rcompat/
|
|
25
|
-
"@rcompat/
|
|
24
|
+
"@rcompat/io": "^0.8.0",
|
|
25
|
+
"@rcompat/runtime": "^0.14.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@rcompat/type": "^0.15.
|
|
28
|
+
"@rcompat/type": "^0.15.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@rcompat/test": "^0.15.0"
|