@testrigor/testrigor-cli 0.0.42-beta

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.
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidUrl = exports.extractRunIdFromDetailsUrl = exports.extractUrlWithoutQueryParams = exports.removeExtension = exports.getExtensionLength = exports.isValidFileExtensionToUpload = exports.isJsonFile = exports.isTextFile = exports.isYamlFile = exports.rendererToUse = exports.isRunningOnCi = exports.pathExists = exports.getHomeDir = exports.createDirectory = exports.UPLOAD_TIMEOUT_MS = exports.MAX_FILE_SIZE_100_MB = void 0;
4
+ const Fs = require("@supercharge/fs");
5
+ const path = require("path");
6
+ // eslint-disable-next-line @typescript-eslint/no-var-requires, no-undef
7
+ const isCi = require("is-ci");
8
+ const YAML_EXTENSION = ".yaml";
9
+ const YML_EXTENSION = ".yml";
10
+ const TXT_EXTENSION = ".txt";
11
+ const JSON_EXTENSION = ".json";
12
+ const FILE_UPLOAD_EXTENSIONS = [".zip", ".exe", ".msi", ".apk", ".aab", ".ipa"];
13
+ const DIRECTORY_NAME = ".testrigor";
14
+ const TESTRIGOR_CLI_HOME = process.env.TESTRIGOR_CLI_HOME || path.join(Fs.homeDir(), DIRECTORY_NAME);
15
+ const NOT_AVAILABLE_TEST_SUITE_RUN = "not-available";
16
+ exports.MAX_FILE_SIZE_100_MB = 100 * 1024 * 1024;
17
+ exports.UPLOAD_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes for large file uploads
18
+ async function createDirectory(name) {
19
+ const directoryPath = path.join(TESTRIGOR_CLI_HOME, name);
20
+ await Fs.ensureDir(directoryPath);
21
+ return directoryPath;
22
+ }
23
+ exports.createDirectory = createDirectory;
24
+ function getHomeDir() {
25
+ return TESTRIGOR_CLI_HOME;
26
+ }
27
+ exports.getHomeDir = getHomeDir;
28
+ async function pathExists(name) {
29
+ if (!name) {
30
+ return false;
31
+ }
32
+ return Fs.pathExists(path.join(TESTRIGOR_CLI_HOME, name));
33
+ }
34
+ exports.pathExists = pathExists;
35
+ function isRunningOnCi() {
36
+ return isCi;
37
+ }
38
+ exports.isRunningOnCi = isRunningOnCi;
39
+ function rendererToUse() {
40
+ return isRunningOnCi() ? "verbose" : "default";
41
+ }
42
+ exports.rendererToUse = rendererToUse;
43
+ function isYamlFile(fileName) {
44
+ return fileName.endsWith(YAML_EXTENSION) || fileName.endsWith(YML_EXTENSION);
45
+ }
46
+ exports.isYamlFile = isYamlFile;
47
+ function isTextFile(fileName) {
48
+ return fileName.endsWith(TXT_EXTENSION);
49
+ }
50
+ exports.isTextFile = isTextFile;
51
+ function isJsonFile(fileName) {
52
+ return fileName.endsWith(JSON_EXTENSION);
53
+ }
54
+ exports.isJsonFile = isJsonFile;
55
+ function isValidFileExtensionToUpload(fileName) {
56
+ return FILE_UPLOAD_EXTENSIONS.some((ext) => fileName.endsWith(ext));
57
+ }
58
+ exports.isValidFileExtensionToUpload = isValidFileExtensionToUpload;
59
+ function getExtensionLength(fileName) {
60
+ if (fileName.endsWith(YAML_EXTENSION)) {
61
+ return 5;
62
+ }
63
+ if (fileName.endsWith(YML_EXTENSION) || fileName.endsWith(TXT_EXTENSION)) {
64
+ return 4;
65
+ }
66
+ return 0;
67
+ }
68
+ exports.getExtensionLength = getExtensionLength;
69
+ function removeExtension(fileName) {
70
+ return fileName.slice(0, -getExtensionLength(fileName));
71
+ }
72
+ exports.removeExtension = removeExtension;
73
+ function extractUrlWithoutQueryParams(urlString) {
74
+ const url = new URL(urlString);
75
+ url.search = "";
76
+ return url.toString();
77
+ }
78
+ exports.extractUrlWithoutQueryParams = extractUrlWithoutQueryParams;
79
+ function extractRunIdFromDetailsUrl(detailsUrl) {
80
+ if (!detailsUrl) {
81
+ return NOT_AVAILABLE_TEST_SUITE_RUN;
82
+ }
83
+ const parts = detailsUrl.split("/");
84
+ return parts[parts.length - 1];
85
+ }
86
+ exports.extractRunIdFromDetailsUrl = extractRunIdFromDetailsUrl;
87
+ function isValidUrl(url) {
88
+ try {
89
+ // Basic URL validation - accepts http, https, localhost, self, and supports ports
90
+ const urlPattern = /^(https?:\/\/)?([\w.-]+|localhost|self)(:\d+)?(\/[^\s]*)?$/i;
91
+ return urlPattern.test(url);
92
+ }
93
+ catch {
94
+ return false;
95
+ }
96
+ }
97
+ exports.isValidUrl = isValidUrl;
@@ -0,0 +1,265 @@
1
+ {
2
+ "version": "0.0.42-beta",
3
+ "commands": {
4
+ "authenticate": {
5
+ "id": "authenticate",
6
+ "description": "Set your testRigor authentication token",
7
+ "strict": true,
8
+ "pluginName": "@testrigor/testrigor-cli",
9
+ "pluginAlias": "@testrigor/testrigor-cli",
10
+ "pluginType": "core",
11
+ "aliases": [],
12
+ "hiddenAliases": [],
13
+ "examples": [
14
+ "testrigor authenticate",
15
+ "Prompts for your API authentication token",
16
+ "Use 'testrigor test-suite config' to set default test suite ID separately",
17
+ "Config will be stored in ~/.testrigor/testrigor.yml"
18
+ ],
19
+ "flags": {},
20
+ "args": {}
21
+ },
22
+ "test-suite:config": {
23
+ "id": "test-suite:config",
24
+ "description": "Configure test suite settings and default test suite ID",
25
+ "strict": true,
26
+ "pluginName": "@testrigor/testrigor-cli",
27
+ "pluginAlias": "@testrigor/testrigor-cli",
28
+ "pluginType": "core",
29
+ "aliases": [],
30
+ "hiddenAliases": [],
31
+ "examples": [
32
+ "testrigor test-suite config --default TEST-SUITE-ID",
33
+ "testrigor test-suite config --show",
34
+ "testrigor test-suite config --delete"
35
+ ],
36
+ "flags": {
37
+ "default": {
38
+ "name": "default",
39
+ "type": "option",
40
+ "description": "Set the default test suite ID",
41
+ "multiple": false,
42
+ "exclusive": [
43
+ "delete",
44
+ "show"
45
+ ]
46
+ },
47
+ "delete": {
48
+ "name": "delete",
49
+ "type": "boolean",
50
+ "description": "Remove the default test suite ID",
51
+ "allowNo": false,
52
+ "exclusive": [
53
+ "default",
54
+ "show"
55
+ ]
56
+ },
57
+ "show": {
58
+ "name": "show",
59
+ "type": "boolean",
60
+ "description": "Show current configuration",
61
+ "allowNo": false,
62
+ "exclusive": [
63
+ "default",
64
+ "delete"
65
+ ]
66
+ }
67
+ },
68
+ "args": {}
69
+ },
70
+ "test-suite:run": {
71
+ "id": "test-suite:run",
72
+ "description": "Run all tests of a Test Suite",
73
+ "strict": true,
74
+ "pluginName": "@testrigor/testrigor-cli",
75
+ "pluginAlias": "@testrigor/testrigor-cli",
76
+ "pluginType": "core",
77
+ "aliases": [],
78
+ "hiddenAliases": [],
79
+ "examples": [],
80
+ "flags": {
81
+ "auth-token": {
82
+ "name": "auth-token",
83
+ "type": "option",
84
+ "description": "Personal authentication token",
85
+ "required": false,
86
+ "helpGroup": "GLOBAL",
87
+ "multiple": false
88
+ },
89
+ "token": {
90
+ "name": "token",
91
+ "type": "option",
92
+ "char": "t",
93
+ "description": "Suite authentication token",
94
+ "required": false,
95
+ "helpGroup": "GLOBAL",
96
+ "multiple": false
97
+ },
98
+ "min-port": {
99
+ "name": "min-port",
100
+ "type": "option",
101
+ "description": "Min port for tunnel",
102
+ "multiple": false,
103
+ "default": 40000
104
+ },
105
+ "max-port": {
106
+ "name": "max-port",
107
+ "type": "option",
108
+ "description": "Max port for tunnel",
109
+ "multiple": false,
110
+ "default": 50000
111
+ },
112
+ "verbose": {
113
+ "name": "verbose",
114
+ "type": "boolean",
115
+ "description": "Verbose output",
116
+ "helpGroup": "GLOBAL",
117
+ "allowNo": false
118
+ },
119
+ "async": {
120
+ "name": "async",
121
+ "type": "boolean",
122
+ "char": "w",
123
+ "description": "Don't wait for the test suite to finish",
124
+ "allowNo": false,
125
+ "aliases": [
126
+ "nowait"
127
+ ]
128
+ },
129
+ "branch": {
130
+ "name": "branch",
131
+ "type": "option",
132
+ "description": "The branch name",
133
+ "multiple": false,
134
+ "dependsOn": [
135
+ "commit"
136
+ ]
137
+ },
138
+ "commit": {
139
+ "name": "commit",
140
+ "type": "option",
141
+ "description": "The commit",
142
+ "multiple": false,
143
+ "dependsOn": [
144
+ "branch"
145
+ ]
146
+ },
147
+ "localhost": {
148
+ "name": "localhost",
149
+ "type": "boolean",
150
+ "description": "Localhost run",
151
+ "allowNo": false,
152
+ "dependsOn": [
153
+ "url"
154
+ ],
155
+ "aliases": [
156
+ "tunnel"
157
+ ]
158
+ },
159
+ "url": {
160
+ "name": "url",
161
+ "type": "option",
162
+ "description": "The url",
163
+ "multiple": false
164
+ },
165
+ "file-path": {
166
+ "name": "file-path",
167
+ "type": "option",
168
+ "description": "Path to the file stored locally. It will upload the new file to be used. File type should be according to the file type accepted for the Test Suite type of testing. If the parameter --url is used, this parameter will be ignored.",
169
+ "multiple": false
170
+ },
171
+ "junit-report-save-path": {
172
+ "name": "junit-report-save-path",
173
+ "type": "option",
174
+ "description": "JUnit report save path",
175
+ "multiple": false
176
+ },
177
+ "variables-path": {
178
+ "name": "variables-path",
179
+ "type": "option",
180
+ "description": "Variables path",
181
+ "multiple": false
182
+ },
183
+ "test-cases-path": {
184
+ "name": "test-cases-path",
185
+ "type": "option",
186
+ "description": "Test cases files",
187
+ "multiple": false
188
+ },
189
+ "rules-path": {
190
+ "name": "rules-path",
191
+ "type": "option",
192
+ "description": "Rules path",
193
+ "multiple": false
194
+ },
195
+ "settings-path": {
196
+ "name": "settings-path",
197
+ "type": "option",
198
+ "description": "Settings path",
199
+ "multiple": false
200
+ },
201
+ "test-case-uuid": {
202
+ "name": "test-case-uuid",
203
+ "type": "option",
204
+ "description": "Test case uuid",
205
+ "multiple": false,
206
+ "dependsOn": [
207
+ "url"
208
+ ]
209
+ },
210
+ "auto-create-ai-rules": {
211
+ "name": "auto-create-ai-rules",
212
+ "type": "boolean",
213
+ "description": "Enable auto create AI based rules",
214
+ "allowNo": false
215
+ },
216
+ "explicit-mutations": {
217
+ "name": "explicit-mutations",
218
+ "type": "boolean",
219
+ "description": "In cases where you are always using mutations, such as storing test cases in your own repository, and you always send us the set of test cases you have through our API you should send \"--explicit-mutations\"",
220
+ "allowNo": false
221
+ },
222
+ "labels": {
223
+ "name": "labels",
224
+ "type": "option",
225
+ "description": "Run tests of specific labels",
226
+ "multiple": true
227
+ },
228
+ "excluded-labels": {
229
+ "name": "excluded-labels",
230
+ "type": "option",
231
+ "description": "Not run tests of specific labels",
232
+ "multiple": true
233
+ },
234
+ "base-url-web": {
235
+ "name": "base-url-web",
236
+ "type": "option",
237
+ "description": "Base URL for web interface (e.g., https://app.testrigor.com)",
238
+ "multiple": false
239
+ },
240
+ "base-url-api": {
241
+ "name": "base-url-api",
242
+ "type": "option",
243
+ "description": "Base URL for API2 (e.g., https://api2.testrigor.com)",
244
+ "multiple": false
245
+ },
246
+ "chrome-extension": {
247
+ "name": "chrome-extension",
248
+ "type": "option",
249
+ "description": "Chrome extension: \"name=EXT_NAME file=PATH_TO_CRX\"",
250
+ "multiple": true,
251
+ "exclusive": [
252
+ "file-path"
253
+ ]
254
+ }
255
+ },
256
+ "args": {
257
+ "testSuiteId": {
258
+ "name": "testSuiteId",
259
+ "description": "The test suite id (optional if set in config)",
260
+ "required": false
261
+ }
262
+ }
263
+ }
264
+ }
265
+ }
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@testrigor/testrigor-cli",
3
+ "version": "0.0.42-beta",
4
+ "description": "TestRigor Command Line",
5
+ "author": "Ivo Parun Rua @parunruaivo",
6
+ "bin": {
7
+ "testrigor": "bin/run"
8
+ },
9
+ "homepage": "https://github.com/TestRigor/testrigor-cli",
10
+ "license": "MIT",
11
+ "main": "dist/index.ts",
12
+ "repository": "TestRigor/testrigor-cli",
13
+ "files": [
14
+ "/bin",
15
+ "/dist",
16
+ "/npm-shrinkwrap.json",
17
+ "oclif.manifest.json"
18
+ ],
19
+ "dependencies": {
20
+ "@oclif/core": "^2",
21
+ "@oclif/plugin-help": "^5",
22
+ "@oclif/plugin-plugins": "^3.2.0",
23
+ "@supercharge/fs": "^3.4.0",
24
+ "form-data": "^4.0.1",
25
+ "glob": "^10.3.10",
26
+ "gunzip-maybe": "^1.4.2",
27
+ "is-ci": "^3.0.1",
28
+ "listr2": "^8.0.1",
29
+ "node-fetch-commonjs": "3.3.1",
30
+ "tar-stream": "^3.1.6",
31
+ "unzip-stream": "^0.3.1",
32
+ "yaml": "^2.3.4"
33
+ },
34
+ "devDependencies": {
35
+ "@oclif/test": "^2.4.2",
36
+ "@types/chai": "^4",
37
+ "@types/eslint__js": "^8.42.3",
38
+ "@types/is-ci": "^3.0.4",
39
+ "@types/mocha": "^9.0.0",
40
+ "@types/node": "^16.18.39",
41
+ "@types/tar-stream": "^3.1.3",
42
+ "@types/unzip-stream": "^0.3.4",
43
+ "@types/unzipper": "^0.10.9",
44
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
45
+ "chai": "^4",
46
+ "eslint": "^8.57.0",
47
+ "eslint-config-prettier": "^9.1.0",
48
+ "eslint-plugin-mocha": "^10.5.0",
49
+ "eslint-plugin-prettier": "^5.2.1",
50
+ "globals": "^15.12.0",
51
+ "mocha": "^10.1.0",
52
+ "oclif": "^3.11.2",
53
+ "shx": "^0.3.4",
54
+ "ts-node": "^10.9.1",
55
+ "tslib": "^2.6.1",
56
+ "typescript": "^4.9.5",
57
+ "typescript-eslint": "^7.18.0"
58
+ },
59
+ "oclif": {
60
+ "bin": "testrigor",
61
+ "dirname": "testrigor-cli",
62
+ "commands": "./dist/commands",
63
+ "plugins": [
64
+ "@oclif/plugin-help",
65
+ "@oclif/plugin-plugins"
66
+ ],
67
+ "topicSeparator": " ",
68
+ "topics": {
69
+ "test-suite": {
70
+ "description": "Commands for managing and running test suites"
71
+ },
72
+ "test-suite:run": {
73
+ "description": "Run all tests of a Test Suite"
74
+ },
75
+ "authenticate": {
76
+ "description": "Set your testRigor personal authentication token"
77
+ }
78
+ }
79
+ },
80
+ "scripts": {
81
+ "build": "shx rm -rf dist && tsc -b",
82
+ "lint": "eslint .",
83
+ "postpack": "shx rm -f oclif.manifest.json",
84
+ "posttest": "npm run lint",
85
+ "prepack": "npm run build && oclif manifest && oclif readme",
86
+ "test": "mocha --forbid-only \"test/**/*.ts\"",
87
+ "version": "oclif readme && git add README.md",
88
+ "tarballs": "npm run prepack && oclif pack tarballs"
89
+ },
90
+ "engines": {
91
+ "node": ">=18.0.0"
92
+ },
93
+ "bugs": "https://github.com/TestRigor/testrigor-cli/issues",
94
+ "keywords": [
95
+ "oclif"
96
+ ],
97
+ "types": "dist/index.d.ts"
98
+ }