proby 0.0.1 → 0.1.1

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/bin.js CHANGED
@@ -1,4 +1,33 @@
1
1
  #!/usr/bin/env node
2
- console.log("test");
3
- export {};
2
+ import red from "@rcompat/cli/color/red";
3
+ import print from "@rcompat/cli/print";
4
+ import root from "@rcompat/package/root";
5
+ import run from "./run.js";
6
+ const $root = await root();
7
+ const spec_json = $root.join("spec.json");
8
+ if (await spec_json.exists()) {
9
+ // console.log(`spec.json exists, reading`);
10
+ }
11
+ else {
12
+ // console.log(`spec.json missing, continuing with defaults`);
13
+ }
14
+ const type = await (async (base) => {
15
+ if (await base.join("packages").exists()) {
16
+ return "monorepo";
17
+ }
18
+ if (await base.join("src").exists()) {
19
+ return "repo";
20
+ }
21
+ })($root);
22
+ if (type === "monorepo") {
23
+ for (const repo of await $root.join("packages").list()) {
24
+ await run(repo.join("src"), repo.name);
25
+ }
26
+ }
27
+ else if (type === "repo") {
28
+ await run($root.join("src"));
29
+ }
30
+ else {
31
+ print(`${red("src")} or ${red("packages")} not found\n`);
32
+ }
4
33
  //# sourceMappingURL=bin.js.map
package/lib/run.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import FileRef from "@rcompat/fs/FileRef";
2
+ declare const _default: (root: FileRef, subrepo?: string) => Promise<void>;
3
+ export default _default;
4
+ //# sourceMappingURL=run.d.ts.map
package/lib/run.js ADDED
@@ -0,0 +1,42 @@
1
+ import blue from "@rcompat/cli/color/blue";
2
+ import green from "@rcompat/cli/color/green";
3
+ import red from "@rcompat/cli/color/red";
4
+ import print from "@rcompat/cli/print";
5
+ import repository from "@rcompat/test/repository";
6
+ const endings = [".spec.ts", ".spec.js"];
7
+ export default async (root, subrepo) => {
8
+ const files = await root.list(file => endings.some(ending => file.endsWith(ending)), { recursive: true });
9
+ if (files.length === 0) {
10
+ return;
11
+ }
12
+ for (const file of files) {
13
+ repository.current(file);
14
+ await file.import();
15
+ }
16
+ if (subrepo !== undefined) {
17
+ print(`${blue(subrepo)}\n`);
18
+ }
19
+ const failed = [];
20
+ for (const test of repository.run()) {
21
+ for (const result of test.results) {
22
+ if (result.passed) {
23
+ print(green("o"));
24
+ }
25
+ else {
26
+ failed.push([test, result]);
27
+ print(red("x"));
28
+ }
29
+ }
30
+ }
31
+ repository.reset();
32
+ if (failed.length > 0) {
33
+ print("\n");
34
+ for (const [test, result] of failed) {
35
+ print(`${test.file.debase(root)} ${red(test.name)} \n`);
36
+ print(` expected ${result.expected}\n`);
37
+ print(` actual ${result.actual}\n`);
38
+ }
39
+ }
40
+ print("\n");
41
+ };
42
+ //# sourceMappingURL=run.js.map
package/package.json CHANGED
@@ -1,44 +1,43 @@
1
1
  {
2
2
  "name": "proby",
3
- "version": "0.0.1",
4
- "description": "test runner for rcompat",
3
+ "version": "0.1.1",
4
+ "description": "Standard library test runner",
5
5
  "bugs": "https://github.com/rcompat/rcompat/issues",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "/lib/**/*.js",
9
9
  "/lib/**/*.d.ts",
10
- "/src/**/*.ts",
11
10
  "!/**/*.spec.*"
12
11
  ],
13
- "bin": "src/bin.ts",
12
+ "bin": "lib/bin.js",
14
13
  "repository": {
15
14
  "type": "git",
16
15
  "url": "https://github.com/rcompat/rcompat",
17
16
  "directory": "packages/proby"
18
17
  },
19
18
  "dependencies": {
20
- "@rcompat/test": "^0.0.2"
19
+ "@rcompat/cli": "^0.8.1",
20
+ "@rcompat/package": "^0.11.1",
21
+ "@rcompat/fs": "^0.12.4"
22
+ },
23
+ "peerDependencies": {
24
+ "@rcompat/test": "^0.1.14"
25
+ },
26
+ "peerDependenciesMeta": {
27
+ "@rcompat/test": {
28
+ "optional": true
29
+ }
21
30
  },
22
31
  "type": "module",
23
32
  "imports": {
24
- "#types/*": {
25
- "livetypes": "./src/private/types/*.ts",
26
- "default": "./lib/private/types/*.js"
27
- },
28
33
  "#*": {
29
- "livetypes": "./src/private/*.ts",
30
- "default": "./lib/private/*.js"
31
- }
32
- },
33
- "exports": {
34
- "./*": {
35
- "livetypes": "./src/public/*.ts",
36
- "default": "./lib/public/*.js"
34
+ "apekit": "./src/*.ts",
35
+ "default": "./lib/*.js"
37
36
  }
38
37
  },
39
38
  "scripts": {
40
39
  "build": "npm run clean && tsc",
41
40
  "clean": "rm -rf ./lib",
42
- "test": "tsx --conditions=livetypes ../../node_modules/debris/src/bin.js"
41
+ "test": "npx proby"
43
42
  }
44
43
  }
package/src/bin.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- console.log("test");