qunitx-cli 0.5.5 → 0.5.7
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/deno.json +12 -0
- package/deno.lock +1341 -0
- package/lib/commands/generate.js +7 -2
- package/lib/commands/help.js +2 -1
- package/lib/commands/init.js +3 -2
- package/lib/commands/run/tests-in-browser.js +13 -6
- package/lib/commands/run.js +18 -2
- package/lib/servers/http.js +40 -19
- package/lib/setup/bind-server-to-port.js +4 -0
- package/lib/setup/browser.js +16 -0
- package/lib/setup/config.js +5 -1
- package/lib/setup/default-project-config-values.js +7 -0
- package/lib/setup/file-watcher.js +12 -4
- package/lib/setup/fs-tree.js +6 -0
- package/lib/setup/keyboard-events.js +4 -0
- package/lib/setup/recursive-lookup.d.ts +7 -0
- package/lib/setup/test-file-paths.js +5 -0
- package/lib/setup/web-server.js +7 -7
- package/lib/setup/write-output-static-files.js +4 -0
- package/lib/tap/display-final-result.js +8 -1
- package/lib/tap/display-test-result.js +7 -2
- package/lib/utils/find-chrome.js +4 -0
- package/lib/utils/find-internal-assets-from-html.js +4 -0
- package/lib/utils/find-project-root.js +5 -1
- package/lib/utils/indent-string.js +9 -0
- package/lib/utils/listen-to-keyboard-key.js +4 -0
- package/lib/utils/parse-cli-flags.js +6 -2
- package/lib/utils/path-exists.js +10 -0
- package/lib/utils/read-boilerplate.js +7 -3
- package/lib/utils/resolve-port-number-for.js +4 -0
- package/lib/utils/run-user-module.js +4 -0
- package/lib/utils/search-in-parent-directories.js +4 -0
- package/lib/utils/time-counter.js +12 -1
- package/package.json +6 -2
- package/lib/boilerplates/default-project-config-values.js +0 -6
- /package/{lib/boilerplates → templates}/setup/tests.hbs +0 -0
- /package/{lib/boilerplates → templates}/setup/tsconfig.json +0 -0
- /package/{lib/boilerplates → templates}/test.js +0 -0
package/lib/utils/path-exists.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Returns `true` if the given filesystem path is accessible, `false` otherwise.
|
|
5
|
+
* @example
|
|
6
|
+
* ```js
|
|
7
|
+
* import pathExists from './lib/utils/path-exists.js';
|
|
8
|
+
* console.assert(await pathExists('/tmp') === true);
|
|
9
|
+
* console.assert(await pathExists('/tmp/nonexistent-qunitx-file') === false);
|
|
10
|
+
* ```
|
|
11
|
+
* @returns {Promise<boolean>}
|
|
12
|
+
*/
|
|
3
13
|
export default async function pathExists(path) {
|
|
4
14
|
try {
|
|
5
15
|
await fs.access(path);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { isSea, getAsset } from 'node:sea';
|
|
2
1
|
import fs from 'node:fs/promises';
|
|
3
2
|
import { dirname, join } from 'node:path';
|
|
4
3
|
import { fileURLToPath } from 'node:url';
|
|
5
4
|
|
|
6
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Reads a boilerplate file by relative path, using the SEA asset store when running as a Node.js binary.
|
|
9
|
+
* @returns {Promise<string>}
|
|
10
|
+
*/
|
|
8
11
|
export default async function readBoilerplate(relativePath) {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const sea = await import('node:sea').catch(() => null);
|
|
13
|
+
if (sea?.isSea()) return sea.getAsset(relativePath, 'utf8');
|
|
14
|
+
return (await fs.readFile(join(__dirname, '../../templates', relativePath))).toString();
|
|
11
15
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns `portNumber` if it is free, otherwise recursively tries `portNumber + 1` until a free port is found.
|
|
3
|
+
* @returns {Promise<number>}
|
|
4
|
+
*/
|
|
1
5
|
export default async function resolvePortNumberFor(portNumber) {
|
|
2
6
|
if (await portIsAvailable(portNumber)) {
|
|
3
7
|
return portNumber;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import kleur from 'kleur';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Dynamically imports `modulePath` and calls its default export with `params`; exits with code 1 on error.
|
|
5
|
+
* @returns {Promise<void>}
|
|
6
|
+
*/
|
|
3
7
|
export default async function runUserModule(modulePath, params, scriptPosition) {
|
|
4
8
|
try {
|
|
5
9
|
const func = await import(modulePath);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import pathExists from './path-exists.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Recursively searches `directory` and its ancestors for a file or folder named `targetEntry`; returns the absolute path or `undefined`.
|
|
5
|
+
* @returns {Promise<string|undefined>}
|
|
6
|
+
*/
|
|
3
7
|
async function searchInParentDirectories(directory, targetEntry) {
|
|
4
8
|
const resolvedDirectory = directory === '.' ? process.cwd() : directory;
|
|
5
9
|
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Returns a timer object with a `startTime` Date and a `stop()` method that returns elapsed milliseconds.
|
|
3
|
+
* @example
|
|
4
|
+
* ```js
|
|
5
|
+
* import timeCounter from './lib/utils/time-counter.js';
|
|
6
|
+
* const t = timeCounter();
|
|
7
|
+
* const ms = t.stop();
|
|
8
|
+
* console.assert(ms >= 0);
|
|
9
|
+
* ```
|
|
10
|
+
* @returns {{ startTime: Date, stop: () => number }}
|
|
11
|
+
*/
|
|
12
|
+
export default function timeCounter() {
|
|
2
13
|
const startTime = new Date();
|
|
3
14
|
|
|
4
15
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qunitx-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.7",
|
|
5
5
|
"description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
|
|
6
6
|
"main": "cli.js",
|
|
7
7
|
"author": "Izel Nakri",
|
|
@@ -19,17 +19,21 @@
|
|
|
19
19
|
"format": "prettier --check \"lib/**/*.js\" \"test/**/*.js\" \"*.js\" \"package.json\" \".github/**/*.yml\"",
|
|
20
20
|
"format:fix": "prettier --write \"lib/**/*.js\" \"test/**/*.js\" \"*.js\" \"package.json\" \".github/**/*.yml\"",
|
|
21
21
|
"lint": "deno lint lib/ cli.js",
|
|
22
|
+
"lint:docs": "node scripts/lint-docs.js",
|
|
23
|
+
"docs": "deno doc --html --name=\"qunitx-cli\" --output=docs/lib 'lib/**/*.js' README.md",
|
|
22
24
|
"build": "node build.js",
|
|
23
25
|
"changelog:unreleased": "git-cliff --unreleased --strip all",
|
|
24
26
|
"changelog:preview": "git-cliff",
|
|
25
27
|
"changelog:update": "git-cliff --output CHANGELOG.md",
|
|
28
|
+
"postinstall": "deno install --allow-scripts=npm:puppeteer || true",
|
|
26
29
|
"prepack": "npm run build",
|
|
27
30
|
"test": "node test/setup.js && FORCE_COLOR=0 node --test test/**/*-test.js",
|
|
28
31
|
"test:sanity-first": "./cli.js test/helpers/failing-tests.js test/helpers/failing-tests.ts",
|
|
29
32
|
"test:sanity-second": "./cli.js test/helpers/passing-tests.js test/helpers/passing-tests.ts"
|
|
30
33
|
},
|
|
31
34
|
"engines": {
|
|
32
|
-
"node": ">=24.0.0"
|
|
35
|
+
"node": ">=24.0.0",
|
|
36
|
+
"deno": ">=2.7.0"
|
|
33
37
|
},
|
|
34
38
|
"bin": {
|
|
35
39
|
"qunitx": "cli.js"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|