momentic 0.0.8 → 0.0.9
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/bin/cli.js +15 -3
- package/dist/index.js +1 -0
- package/package.json +5 -2
package/bin/cli.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
+
import exec from "@actions/exec";
|
|
5
|
+
import io from "@actions/io";
|
|
4
6
|
import chalk from "chalk";
|
|
5
7
|
import { Command as Command4, Option } from "commander";
|
|
6
|
-
import
|
|
8
|
+
import quote from "quote";
|
|
9
|
+
import parseArgsStringToArgv2 from "string-argv";
|
|
7
10
|
import waitOnFn from "wait-on";
|
|
8
11
|
|
|
9
12
|
// ../../packages/types/src/commands.ts
|
|
@@ -258,6 +261,7 @@ var AIAssertionResultSchema = z4.object({
|
|
|
258
261
|
});
|
|
259
262
|
|
|
260
263
|
// ../../packages/types/src/ai-command-generation.ts
|
|
264
|
+
import parseArgsStringToArgv from "string-argv";
|
|
261
265
|
import { z as z5 } from "zod";
|
|
262
266
|
|
|
263
267
|
// ../../packages/types/src/errors.ts
|
|
@@ -3009,8 +3013,7 @@ program.command("run-tests").addOption(
|
|
|
3009
3013
|
new Option("--api-key <key>", "API key for authenticating").env("MOMENTIC_API_KEY").makeOptionMandatory(true)
|
|
3010
3014
|
).action(async (options) => {
|
|
3011
3015
|
const { tests, start, waitOn, waitOnTimeout, apiKey } = options;
|
|
3012
|
-
|
|
3013
|
-
void $`${start}`;
|
|
3016
|
+
await execCommand(start, false);
|
|
3014
3017
|
await waitOnFn({
|
|
3015
3018
|
resources: [waitOn],
|
|
3016
3019
|
timeout: waitOnTimeout * 1e3
|
|
@@ -3046,6 +3049,15 @@ program.command("run-tests").addOption(
|
|
|
3046
3049
|
}
|
|
3047
3050
|
console.log(chalk.green(`All ${results.length} tests passed!`));
|
|
3048
3051
|
});
|
|
3052
|
+
var execCommand = async (fullCommand, waitToFinish = true) => {
|
|
3053
|
+
const args = parseArgsStringToArgv2(fullCommand);
|
|
3054
|
+
const toolPath = await io.which(args[0], true);
|
|
3055
|
+
const toolArguments = args.slice(1);
|
|
3056
|
+
const promise = exec.exec(quote(toolPath), toolArguments);
|
|
3057
|
+
if (waitToFinish) {
|
|
3058
|
+
return promise;
|
|
3059
|
+
}
|
|
3060
|
+
};
|
|
3049
3061
|
async function main() {
|
|
3050
3062
|
await program.parseAsync(process.argv);
|
|
3051
3063
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "momentic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "The Momentic SDK for Node.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,16 +37,19 @@
|
|
|
37
37
|
"selenium"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@actions/exec": "^1.1.1",
|
|
41
|
+
"@actions/io": "^1.1.3",
|
|
40
42
|
"@playwright/browser-chromium": "1.39.0",
|
|
41
43
|
"chalk": "^5.3.0",
|
|
42
44
|
"commander": "^11.1.0",
|
|
43
45
|
"cron-validator": "^1.3.1",
|
|
44
46
|
"dedent": "^1.5.1",
|
|
45
47
|
"diff-lines": "^1.1.1",
|
|
46
|
-
"execa": "^8.0.1",
|
|
47
48
|
"fetch-retry": "^5.0.6",
|
|
48
49
|
"playwright": "1.39.0",
|
|
50
|
+
"quote": "^0.4.0",
|
|
49
51
|
"set-cookie-parser": "^2.6.0",
|
|
52
|
+
"string-argv": "^0.3.2",
|
|
50
53
|
"wait-on": "^7.2.0",
|
|
51
54
|
"zod": "^3.22.4"
|
|
52
55
|
}
|