qunitx-cli 0.1.2 → 0.5.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/README.md +120 -49
- package/cli.js +1 -1
- package/lib/boilerplates/default-project-config-values.js +2 -2
- package/lib/boilerplates/test.js +5 -4
- package/lib/commands/generate.js +6 -8
- package/lib/commands/help.js +8 -8
- package/lib/commands/init.js +35 -25
- package/lib/commands/run/tests-in-browser.js +97 -67
- package/lib/commands/run.js +165 -55
- package/lib/servers/http.js +59 -44
- package/lib/setup/bind-server-to-port.js +3 -12
- package/lib/setup/browser.js +26 -18
- package/lib/setup/config.js +8 -10
- package/lib/setup/file-watcher.js +23 -6
- package/lib/setup/fs-tree.js +29 -27
- package/lib/setup/keyboard-events.js +7 -4
- package/lib/setup/test-file-paths.js +25 -23
- package/lib/setup/web-server.js +87 -61
- package/lib/setup/write-output-static-files.js +4 -1
- package/lib/tap/display-final-result.js +2 -2
- package/lib/tap/display-test-result.js +32 -14
- package/lib/utils/find-chrome.js +16 -0
- package/lib/utils/find-internal-assets-from-html.js +7 -5
- package/lib/utils/find-project-root.js +1 -2
- package/lib/utils/indent-string.js +6 -6
- package/lib/utils/listen-to-keyboard-key.js +6 -2
- package/lib/utils/parse-cli-flags.js +34 -31
- package/lib/utils/resolve-port-number-for.js +3 -3
- package/lib/utils/run-user-module.js +5 -3
- package/lib/utils/search-in-parent-directories.js +4 -1
- package/lib/utils/time-counter.js +2 -2
- package/package.json +21 -35
- package/vendor/qunit.css +7 -7
- package/vendor/qunit.js +3772 -3324
- package/flake.lock +0 -64
- package/flake.nix +0 -26
|
@@ -1,44 +1,47 @@
|
|
|
1
1
|
// { inputs: [], debug: true, watch: true, failFast: true, htmlPaths: [], output }
|
|
2
|
-
export default
|
|
3
|
-
const providedFlags = process.argv.slice(2).reduce(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
result.htmlPaths
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
export default function (projectRoot) {
|
|
3
|
+
const providedFlags = process.argv.slice(2).reduce(
|
|
4
|
+
(result, arg) => {
|
|
5
|
+
if (arg.startsWith('--debug')) {
|
|
6
|
+
return Object.assign(result, { debug: parseBoolean(arg.split('=')[1]) });
|
|
7
|
+
} else if (arg.startsWith('--watch')) {
|
|
8
|
+
return Object.assign(result, { watch: parseBoolean(arg.split('=')[1]) });
|
|
9
|
+
} else if (arg.startsWith('--failfast') || arg.startsWith('--failFast')) {
|
|
10
|
+
return Object.assign(result, { failFast: parseBoolean(arg.split('=')[1]) });
|
|
11
|
+
} else if (arg.startsWith('--timeout')) {
|
|
12
|
+
return Object.assign(result, { timeout: arg.split('=')[1] || 10000 });
|
|
13
|
+
} else if (arg.startsWith('--output')) {
|
|
14
|
+
return Object.assign(result, { output: arg.split('=')[1] });
|
|
15
|
+
} else if (arg.endsWith('.html')) {
|
|
16
|
+
if (result.htmlPaths) {
|
|
17
|
+
result.htmlPaths.push(arg);
|
|
18
|
+
} else {
|
|
19
|
+
result.htmlPaths = [arg];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return result;
|
|
23
|
+
} else if (arg.startsWith('--port')) {
|
|
24
|
+
return Object.assign(result, { port: Number(arg.split('=')[1]) });
|
|
25
|
+
} else if (arg.startsWith('--before')) {
|
|
26
|
+
return Object.assign(result, { before: parseModule(arg.split('=')[1]) });
|
|
27
|
+
} else if (arg.startsWith('--after')) {
|
|
28
|
+
return Object.assign(result, { after: parseModule(arg.split('=')[1]) });
|
|
19
29
|
}
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return Object.assign(result, { port: Number(arg.split('=')[1]) });
|
|
24
|
-
} else if (arg.startsWith('--before')) {
|
|
25
|
-
return Object.assign(result, { before: parseModule(arg.split('=')[1]) });
|
|
26
|
-
} else if (arg.startsWith('--after')) {
|
|
27
|
-
return Object.assign(result, { after: parseModule(arg.split('=')[1]) });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// maybe set watch depth via micromatch(so incl metadata)
|
|
31
|
-
result.inputs.add(arg.startsWith(projectRoot) ? arg : `${process.cwd()}/${arg}`);
|
|
31
|
+
// maybe set watch depth via micromatch(so incl metadata)
|
|
32
|
+
result.inputs.add(arg.startsWith(projectRoot) ? arg : `${process.cwd()}/${arg}`);
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
return result;
|
|
35
|
+
},
|
|
36
|
+
{ inputs: new Set([]) },
|
|
37
|
+
);
|
|
35
38
|
|
|
36
39
|
providedFlags.inputs = Array.from(providedFlags.inputs);
|
|
37
40
|
|
|
38
41
|
return providedFlags;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
function parseBoolean(result, defaultValue=true) {
|
|
44
|
+
function parseBoolean(result, defaultValue = true) {
|
|
42
45
|
if (result === 'true') {
|
|
43
46
|
return true;
|
|
44
47
|
} else if (result === 'false') {
|
|
@@ -3,7 +3,7 @@ export default async function resolvePortNumberFor(portNumber) {
|
|
|
3
3
|
return portNumber;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
return
|
|
6
|
+
return await resolvePortNumberFor(portNumber + 1);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function portIsAvailable(portNumber) {
|
|
@@ -11,13 +11,13 @@ function portIsAvailable(portNumber) {
|
|
|
11
11
|
const net = await import('net');
|
|
12
12
|
const server = net.createServer();
|
|
13
13
|
|
|
14
|
-
server.once('error', function(err) {
|
|
14
|
+
server.once('error', function (err) {
|
|
15
15
|
if (err.code === 'EADDRINUSE') {
|
|
16
16
|
resolve(false);
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
server.once('listening', function() {
|
|
20
|
+
server.once('listening', function () {
|
|
21
21
|
server.close();
|
|
22
22
|
resolve(true);
|
|
23
23
|
});
|
|
@@ -4,9 +4,11 @@ export default async function runUserModule(modulePath, params, scriptPosition)
|
|
|
4
4
|
try {
|
|
5
5
|
let func = await import(modulePath);
|
|
6
6
|
if (func) {
|
|
7
|
-
func.default
|
|
8
|
-
await func.default(params)
|
|
9
|
-
typeof func === 'function'
|
|
7
|
+
func.default
|
|
8
|
+
? await func.default(params)
|
|
9
|
+
: typeof func === 'function'
|
|
10
|
+
? await func(params)
|
|
11
|
+
: null;
|
|
10
12
|
}
|
|
11
13
|
} catch (error) {
|
|
12
14
|
console.log('#', kleur.red(`QUnitX ${scriptPosition} script failed:`));
|
|
@@ -9,7 +9,10 @@ async function searchInParentDirectories(directory, targetEntry) {
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
return await searchInParentDirectories(
|
|
12
|
+
return await searchInParentDirectories(
|
|
13
|
+
directory.slice(0, directory.lastIndexOf('/')),
|
|
14
|
+
targetEntry,
|
|
15
|
+
);
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export default searchInParentDirectories;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qunitx-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
|
|
6
6
|
"main": "cli.js",
|
|
7
7
|
"author": "Izel Nakri",
|
|
@@ -16,20 +16,19 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"bin": "chmod +x cli.js && ./cli.js",
|
|
19
|
+
"lint": "prettier --check \"lib/**/*.js\" \"test/**/*.js\" \"*.js\" \"package.json\" \".github/**/*.yml\"",
|
|
20
|
+
"lint:fix": "prettier --write \"lib/**/*.js\" \"test/**/*.js\" \"*.js\" \"package.json\" \".github/**/*.yml\"",
|
|
19
21
|
"build": "node build.js",
|
|
20
|
-
"changelog:unreleased": "
|
|
21
|
-
"changelog:preview": "
|
|
22
|
-
"changelog:update": "
|
|
22
|
+
"changelog:unreleased": "git-cliff --unreleased --strip all",
|
|
23
|
+
"changelog:preview": "git-cliff",
|
|
24
|
+
"changelog:update": "git-cliff --output CHANGELOG.md",
|
|
23
25
|
"prepack": "npm run build",
|
|
24
|
-
"
|
|
25
|
-
"release:beta": "node_modules/.bin/release-it --preRelease=beta --no-git.requireUpstream",
|
|
26
|
-
"release": "node_modules/.bin/release-it",
|
|
27
|
-
"test": "node --test test/index.js",
|
|
26
|
+
"test": "node test/setup.js && node --test test/**/*-test.js",
|
|
28
27
|
"test:sanity-first": "./cli.js test/helpers/failing-tests.js test/helpers/failing-tests.ts",
|
|
29
28
|
"test:sanity-second": "./cli.js test/helpers/passing-tests.js test/helpers/passing-tests.ts"
|
|
30
29
|
},
|
|
31
30
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
31
|
+
"node": ">=24.0.0"
|
|
33
32
|
},
|
|
34
33
|
"bin": {
|
|
35
34
|
"qunitx": "cli.js"
|
|
@@ -39,42 +38,29 @@
|
|
|
39
38
|
"url": "https://github.com/izelnakri/qunitx-cli.git"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"cheerio": "^1.
|
|
43
|
-
"chokidar": "^
|
|
44
|
-
"esbuild": "^0.
|
|
45
|
-
"js-yaml": "^4.1.
|
|
41
|
+
"cheerio": "^1.2.0",
|
|
42
|
+
"chokidar": "^5.0.0",
|
|
43
|
+
"esbuild": "^0.27.3",
|
|
44
|
+
"js-yaml": "^4.1.1",
|
|
46
45
|
"kleur": "^4.1.5",
|
|
47
|
-
"picomatch": "^
|
|
48
|
-
"puppeteer": "
|
|
46
|
+
"picomatch": "^4.0.3",
|
|
47
|
+
"puppeteer": "^24.38.0",
|
|
49
48
|
"recursive-lookup": "1.1.0",
|
|
50
|
-
"ws": "^8.
|
|
49
|
+
"ws": "^8.19.0"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"qunitx": "^0.9.2",
|
|
59
|
-
"release-it": "^16.1.2"
|
|
52
|
+
"cors": "^2.8.6",
|
|
53
|
+
"express": "^5.2.1",
|
|
54
|
+
"prettier": "^3.8.1",
|
|
55
|
+
"qunit": "^2.25.0",
|
|
56
|
+
"qunitx": "^0.9.3"
|
|
60
57
|
},
|
|
61
58
|
"volta": {
|
|
62
|
-
"node": "
|
|
59
|
+
"node": "24.14.0"
|
|
63
60
|
},
|
|
64
61
|
"prettier": {
|
|
65
62
|
"printWidth": 100,
|
|
66
63
|
"singleQuote": true,
|
|
67
64
|
"arrowParens": "always"
|
|
68
|
-
},
|
|
69
|
-
"release-it": {
|
|
70
|
-
"git": {
|
|
71
|
-
"changelog": "npm run changelog:unreleased"
|
|
72
|
-
},
|
|
73
|
-
"github": {
|
|
74
|
-
"release": true
|
|
75
|
-
},
|
|
76
|
-
"hooks": {
|
|
77
|
-
"after:bump": "npm run changelog:update"
|
|
78
|
-
}
|
|
79
65
|
}
|
|
80
66
|
}
|
package/vendor/qunit.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* QUnit 2.
|
|
2
|
+
* QUnit 2.25.0
|
|
3
3
|
* https://qunitjs.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright OpenJS Foundation and other contributors
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
@media (min-height: 500px) {
|
|
46
46
|
#qunit {
|
|
47
47
|
position: fixed;
|
|
48
|
-
left:
|
|
49
|
-
right:
|
|
50
|
-
top:
|
|
51
|
-
bottom:
|
|
48
|
+
left: 0;
|
|
49
|
+
right: 0;
|
|
50
|
+
top: 0;
|
|
51
|
+
bottom: 0;
|
|
52
52
|
padding: 8px;
|
|
53
53
|
display: -webkit-box;
|
|
54
54
|
display: flex;
|
|
@@ -329,11 +329,11 @@
|
|
|
329
329
|
margin: 0;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
#qunit-tests li
|
|
332
|
+
#qunit-tests li .qunit-test-name {
|
|
333
333
|
cursor: pointer;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
#qunit-tests li.skipped
|
|
336
|
+
#qunit-tests li.skipped .qunit-test-name {
|
|
337
337
|
cursor: default;
|
|
338
338
|
}
|
|
339
339
|
|