qunitx-cli 0.7.0 → 0.9.0

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 CHANGED
@@ -7,13 +7,14 @@
7
7
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
8
8
 
9
9
  Browser-based test runner for [QUnitX](https://github.com/izelnakri/qunitx) — bundles your JS/TS tests
10
- with esbuild, runs them in headless Chrome, and streams TAP output to the terminal.
10
+ with esbuild, runs them in a headless browser via [Playwright](https://playwright.dev), and streams TAP
11
+ output to the terminal.
11
12
 
12
13
  ![qunitx-cli demo](docs/demo.gif)
13
14
 
14
15
  ## Features
15
16
 
16
- - Runs `.js` and `.ts` test files in headless Chrome (Puppeteer + esbuild)
17
+ - Runs `.js` and `.ts` test files in headless Chrome, Firefox, or WebKit (Playwright + esbuild)
17
18
  - TypeScript works with zero configuration — esbuild handles transpilation
18
19
  - Inline source maps for accurate stack traces pointing to original source files
19
20
  - Streams TAP-formatted output to the terminal in real time
@@ -23,6 +24,7 @@ with esbuild, runs them in headless Chrome, and streams TAP output to the termin
23
24
  - `--debug` prints the local server URL and pipes browser console to stdout
24
25
  - `--before` / `--after` hook scripts for server setup and teardown
25
26
  - `--timeout` controls the maximum ms to wait for the full suite to finish
27
+ - `--browser` flag to run tests in Chromium, Firefox, or WebKit
26
28
  - Docker image for zero-install CI usage
27
29
 
28
30
  ## Installation
@@ -69,7 +71,7 @@ qunitx test/**/*.js --watch
69
71
  # Stop on the first failure
70
72
  qunitx test/**/*.js --failFast
71
73
 
72
- # Print the server URL and pipe Chrome console to stdout
74
+ # Print the server URL and pipe browser console to stdout
73
75
  qunitx test/**/*.js --debug
74
76
 
75
77
  # Custom timeout (ms)
@@ -80,8 +82,18 @@ qunitx test/**/*.js --before=scripts/start-server.js
80
82
 
81
83
  # Run a teardown script after tests (can be async)
82
84
  qunitx test/**/*.js --after=scripts/stop-server.js
85
+
86
+ # Run in Firefox or WebKit instead of Chromium
87
+ qunitx test/**/*.js --browser=firefox
88
+ qunitx test/**/*.js --browser=webkit
83
89
  ```
84
90
 
91
+ > **Prerequisite for Firefox / WebKit:** install the Playwright browser binaries once:
92
+ > ```sh
93
+ > npx playwright install firefox
94
+ > npx playwright install webkit
95
+ > ```
96
+
85
97
  ## Writing Tests
86
98
 
87
99
  qunitx-cli runs [QUnitX](https://github.com/izelnakri/qunitx) tests — a superset of QUnit with async
@@ -123,7 +135,7 @@ module('Basic sanity check', (hooks) => {
123
135
  Run it:
124
136
 
125
137
  ```sh
126
- # Headless Chrome (recommended for CI)
138
+ # Headless Chromium (default, recommended for CI)
127
139
  qunitx some-test.js
128
140
 
129
141
  # With browser console output
@@ -145,7 +157,8 @@ All CLI flags can also be set in `package.json` under the `qunitx` key, so you d
145
157
  "output": "tmp",
146
158
  "timeout": 20000,
147
159
  "failFast": false,
148
- "port": 1234
160
+ "port": 1234,
161
+ "browser": "chromium"
149
162
  }
150
163
  }
151
164
  ```
@@ -158,6 +171,7 @@ All CLI flags can also be set in `package.json` under the `qunitx` key, so you d
158
171
  | `timeout` | `20000` | Maximum milliseconds to wait for the full test suite before timing out. |
159
172
  | `failFast` | `false` | Stop the run after the first failing test. |
160
173
  | `port` | `1234` | Preferred HTTP server port. qunitx auto-selects a free port if this one is taken. |
174
+ | `browser` | `"chromium"` | Browser engine to use: `"chromium"`, `"firefox"`, or `"webkit"`. Overridden by `--browser` on the CLI. |
161
175
 
162
176
  CLI flags always override `package.json` values when both are present.
163
177
 
@@ -176,16 +190,26 @@ Options:
176
190
  --before=<file> Script to run (and optionally await) before tests start
177
191
  --after=<file> Script to run (and optionally await) after tests finish
178
192
  --port=<n> HTTP server port (auto-selects a free port if taken)
193
+ --browser=<name> Browser engine: chromium (default), firefox, or webkit
179
194
  ```
180
195
 
181
196
  ## Development
182
197
 
183
198
  ```sh
184
199
  npm install
185
- make check # lint + test (run before every commit)
186
- make test # run tests only
187
- make demo # regenerate docs/demo.gif
188
- make release LEVEL=patch # bump version, update changelog, tag, push
200
+ make check # lint + test (run before every commit)
201
+ make test # run full test suite (Chromium)
202
+ make test-firefox # run browser tests with Firefox
203
+ make test-webkit # run browser tests with WebKit
204
+ make test-all-browsers # run full suite on all three browsers
205
+ make demo # regenerate docs/demo.gif
206
+ make release LEVEL=patch # bump version, update changelog, tag, push
207
+ ```
208
+
209
+ Use `--trace-perf` to print internal timing to stderr — useful when investigating startup or e2e regressions:
210
+
211
+ ```sh
212
+ qunitx test/my-test.js --trace-perf
189
213
  ```
190
214
 
191
215
  ## License
package/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import process from 'node:process';
3
+ import './lib/utils/early-chrome.js';
3
4
  import displayHelpOutput from './lib/commands/help.js';
4
5
  import initializeProject from './lib/commands/init.js';
5
6
  import generateTestFiles from './lib/commands/generate.js';
6
- import run from './lib/commands/run.js';
7
7
  import setupConfig from './lib/setup/config.js';
8
8
 
9
9
  process.title = 'qunitx';
@@ -19,7 +19,13 @@ process.title = 'qunitx';
19
19
  return await initializeProject();
20
20
  }
21
21
 
22
- const config = await setupConfig();
22
+ // Lazy import: run.js (and its static imports like esbuild and playwright-core) are
23
+ // only loaded when actually running tests. Importing in parallel with setupConfig()
24
+ // lets playwright-core start loading while config is being assembled.
25
+ const [config, { default: run }] = await Promise.all([
26
+ setupConfig(),
27
+ import('./lib/commands/run.js'),
28
+ ]);
23
29
 
24
30
  return await run(config);
25
31
  })();
package/deno.json CHANGED
@@ -1,14 +1,8 @@
1
1
  {
2
2
  "nodeModulesDir": "auto",
3
3
  "imports": {
4
- "cheerio": "npm:cheerio",
5
- "chokidar": "npm:chokidar",
6
4
  "esbuild": "npm:esbuild",
7
- "js-yaml": "npm:js-yaml",
8
- "kleur": "npm:kleur",
9
5
  "picomatch": "npm:picomatch",
10
- "puppeteer": "npm:puppeteer",
11
- "recursive-lookup": "npm:recursive-lookup",
12
6
  "ws": "npm:ws"
13
7
  },
14
8
  "tasks": {