@h-rig/test-plugin 0.0.6-alpha.186

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/README.md ADDED
@@ -0,0 +1 @@
1
+ # @h-rig/test-plugin
@@ -0,0 +1,4 @@
1
+ export declare const TEST_PLUGIN_NAME = "@rig/test-plugin";
2
+ export declare const testPlugin: import("@rig/core/config").RigPlugin;
3
+ export declare function createTestPlugin(): import("@rig/core/config").RigPlugin;
4
+ export default testPlugin;
@@ -0,0 +1,73 @@
1
+ // @bun
2
+ var __defProp = Object.defineProperty;
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true,
12
+ configurable: true,
13
+ set: __exportSetter.bind(all, name)
14
+ });
15
+ };
16
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
+
18
+ // packages/test-plugin/src/test-command.ts
19
+ var exports_test_command = {};
20
+ __export(exports_test_command, {
21
+ executeTest: () => executeTest
22
+ });
23
+ import { CliError, requireNoExtraArgs } from "@rig/std-shared/cli-args";
24
+ async function executeTest(context, args) {
25
+ const [command = "unit", ...rest] = args;
26
+ switch (command) {
27
+ case "unit":
28
+ requireNoExtraArgs(rest, "rig test unit");
29
+ await context.runCommand(["bun", "test", "tests/harness/", "--ignore", "tests/harness/e2e/**"]);
30
+ return { ok: true, group: "test", command };
31
+ case "e2e":
32
+ requireNoExtraArgs(rest, "rig test e2e");
33
+ await context.runCommand(["bun", "test", "tests/harness/e2e/"]);
34
+ return { ok: true, group: "test", command };
35
+ case "all":
36
+ requireNoExtraArgs(rest, "rig test all");
37
+ await context.runCommand(["bun", "test", "tests/harness/"]);
38
+ return { ok: true, group: "test", command };
39
+ default:
40
+ throw new CliError(`Unknown test command: ${command}`, 1, { hint: "Run `rig test --help` \u2014 commands are unit|e2e|all." });
41
+ }
42
+ }
43
+ var init_test_command = () => {};
44
+
45
+ // packages/test-plugin/src/plugin.ts
46
+ import { definePlugin } from "@rig/core/config";
47
+ var TEST_PLUGIN_NAME = "@rig/test-plugin";
48
+ var testCommand = {
49
+ id: `${TEST_PLUGIN_NAME}:test`,
50
+ family: "test",
51
+ description: "Run Rig test helpers.",
52
+ projectRequired: false,
53
+ run: async (context, args) => (await Promise.resolve().then(() => (init_test_command(), exports_test_command))).executeTest(context, [...args]),
54
+ helpDoc: { name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }], advancedOnly: true }
55
+ };
56
+ var testPlugin = definePlugin({
57
+ name: TEST_PLUGIN_NAME,
58
+ version: "0.0.0-alpha.1",
59
+ effects: { spawnsProcesses: true, contributesCliCommands: true },
60
+ contributes: {
61
+ cliCommands: [testCommand]
62
+ }
63
+ });
64
+ function createTestPlugin() {
65
+ return testPlugin;
66
+ }
67
+ var plugin_default = testPlugin;
68
+ export {
69
+ testPlugin,
70
+ plugin_default as default,
71
+ createTestPlugin,
72
+ TEST_PLUGIN_NAME
73
+ };
@@ -0,0 +1,3 @@
1
+ import type { RunnerContext } from "@rig/core/runtime-runner-context";
2
+ import type { CommandOutcome } from "@rig/contracts";
3
+ export declare function executeTest(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ // packages/test-plugin/src/test-command.ts
3
+ import { CliError, requireNoExtraArgs } from "@rig/std-shared/cli-args";
4
+ async function executeTest(context, args) {
5
+ const [command = "unit", ...rest] = args;
6
+ switch (command) {
7
+ case "unit":
8
+ requireNoExtraArgs(rest, "rig test unit");
9
+ await context.runCommand(["bun", "test", "tests/harness/", "--ignore", "tests/harness/e2e/**"]);
10
+ return { ok: true, group: "test", command };
11
+ case "e2e":
12
+ requireNoExtraArgs(rest, "rig test e2e");
13
+ await context.runCommand(["bun", "test", "tests/harness/e2e/"]);
14
+ return { ok: true, group: "test", command };
15
+ case "all":
16
+ requireNoExtraArgs(rest, "rig test all");
17
+ await context.runCommand(["bun", "test", "tests/harness/"]);
18
+ return { ok: true, group: "test", command };
19
+ default:
20
+ throw new CliError(`Unknown test command: ${command}`, 1, { hint: "Run `rig test --help` \u2014 commands are unit|e2e|all." });
21
+ }
22
+ }
23
+ export {
24
+ executeTest
25
+ };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@h-rig/test-plugin",
3
+ "version": "0.0.6-alpha.186",
4
+ "type": "module",
5
+ "description": "First-party Rig test-runner command plugin (rig test unit/e2e/all).",
6
+ "license": "UNLICENSED",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/src/plugin.d.ts",
14
+ "import": "./dist/src/plugin.js"
15
+ },
16
+ "./plugin": {
17
+ "types": "./dist/src/plugin.d.ts",
18
+ "import": "./dist/src/plugin.js"
19
+ }
20
+ },
21
+ "engines": {
22
+ "bun": ">=1.3.11"
23
+ },
24
+ "dependencies": {
25
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.186",
26
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.186",
27
+ "@rig/std-shared": "npm:@h-rig/std-shared@0.0.6-alpha.186"
28
+ }
29
+ }