qunitx-cli 0.0.2
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/CHANGELOG.md +9 -0
- package/README.md +92 -0
- package/build.js +1 -0
- package/cli.js +2 -0
- package/package.json +78 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
### Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
|
4
|
+
|
|
5
|
+
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
|
+
|
|
7
|
+
#### 0.0.2
|
|
8
|
+
|
|
9
|
+
- init [`4d2ac8f`](https://github.com/izelnakri/qunitx-cli/commit/4d2ac8fd98ce7a4c988f9036064a6ef592b55f8f)
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# QUnitX CLI
|
|
2
|
+
|
|
3
|
+
CI browser runner for [qunitx](https://github.com/izelnakri/qunitx)
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
Default test output is TAP (_Test-Anything-Protocol_) thus you can use any tap reporter of your choice to display test
|
|
8
|
+
output in anyway you like. Example:
|
|
9
|
+
|
|
10
|
+
```zsh
|
|
11
|
+
# using it with tap-difflet TAP reporter:
|
|
12
|
+
qunitx tests/attachments tests/user | npx tap-difflet
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
#### Installation:
|
|
16
|
+
|
|
17
|
+
```zsh
|
|
18
|
+
npm install -g qunitx-cli
|
|
19
|
+
|
|
20
|
+
qunitx
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
In order to use qunitx to execute existing qunit tests please change:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { module, test } from 'qunit';
|
|
27
|
+
|
|
28
|
+
// to:
|
|
29
|
+
import { module, test } from 'qunitx';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// in some-test.js: (typescript is also supported for --browser mode and node.js with --loader flag)
|
|
36
|
+
import { module, test } from 'qunitx';
|
|
37
|
+
import $ from 'jquery';
|
|
38
|
+
|
|
39
|
+
module('Basic sanity check', function (hooks) {
|
|
40
|
+
test('it works', function (assert) {
|
|
41
|
+
assert.equal(true, true);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
module('More advanced cases', function (hooks) {
|
|
45
|
+
test('deepEqual works', function (assert) {
|
|
46
|
+
assert.deepEqual({ username: 'izelnakri' }, { username: 'izelnakri' });
|
|
47
|
+
});
|
|
48
|
+
test('can import ES & npm modules', function (assert) {
|
|
49
|
+
assert.ok(Object.keys($));
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```zsh
|
|
56
|
+
# you can run the test in node with ES modules package.json{ "type": "module" }
|
|
57
|
+
$ node --test some-test.js
|
|
58
|
+
|
|
59
|
+
# Suggested mode: if you want to run it in CI/google chrome:
|
|
60
|
+
|
|
61
|
+
$ qunitx some-test.js
|
|
62
|
+
|
|
63
|
+
# with browser output enabled:
|
|
64
|
+
|
|
65
|
+
$ qunitx some-test.js --debug
|
|
66
|
+
|
|
67
|
+
# TypeScript also works, make sure on node.js mode, tsconfig.json exists with compilerOptions.module & compilerOptions.moduleResolution set to "NodeNext":
|
|
68
|
+
|
|
69
|
+
$ node --loader=ts-node/esm/transpile-only --test some-test.ts
|
|
70
|
+
|
|
71
|
+
$ qunitx some-test.ts --debug
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Code coverage
|
|
76
|
+
|
|
77
|
+
Since QUnitX proxies to default node.js test runner in when executed with node, you can use any code coverage tool you like. When running the tests in `qunit`(the browser mode) code coverage support is limited.
|
|
78
|
+
```
|
|
79
|
+
c8 node test/attachments test/user
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You can browse [c8 documentation](https://github.com/bcoe/c8) for all configuration options.
|
|
83
|
+
|
|
84
|
+
Implementing code coverage for the browser mode is currently not possible because we use esbuild --bundle feature to
|
|
85
|
+
create a JS bundles for testing in the browser, this could be instrumented with `puppeteer-to-istanbul` however
|
|
86
|
+
instrumentation includes transpiled npm imports of `qunitx` and other potential npm imports developer
|
|
87
|
+
includes in the code, this cannot be filtered since potential filtering can only occur after the `esbuild` bundling.
|
|
88
|
+
When chrome browser and puppeteer fully supports ES asset maps we can remove esbuild from the browser mode, run
|
|
89
|
+
everything in deno and make instrumentation for code coverage possible with the default v8 instrumentation.
|
|
90
|
+
|
|
91
|
+
Esbuild plugin interface is an ongoing development, we might be able to figure out a way to generate this instrumentation
|
|
92
|
+
with esbuild in the future, which could allow code coverage for --browser mode.
|
package/build.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('TODO: build.js');
|
package/cli.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qunitx-cli",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"author": "Izel Nakri",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"test runner",
|
|
11
|
+
"testing",
|
|
12
|
+
"browser",
|
|
13
|
+
"ci",
|
|
14
|
+
"qunit",
|
|
15
|
+
"qunitx"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"bin": "chmod +x cli.js && ./cli.js",
|
|
19
|
+
"build": "node build.js",
|
|
20
|
+
"changelog:unreleased": "node_modules/.bin/auto-changelog --stdout --commit-limit false --package --unreleased-only --hide-credit --sort-commits date-desc",
|
|
21
|
+
"changelog:preview": "node_modules/.bin/auto-changelog --stdout --commit-limit false --package -u --sort-commits date-desc",
|
|
22
|
+
"changelog:update": "node_modules/.bin/auto-changelog --commit-limit false --package --sort-commits date-desc",
|
|
23
|
+
"prepack": "npm run build",
|
|
24
|
+
"release:alpha": "node_modules/.bin/release-it --preRelease=alpha --no-git.requireUpstream",
|
|
25
|
+
"release:beta": "node_modules/.bin/release-it --preRelease=beta --no-git.requireUpstream",
|
|
26
|
+
"release": "node_modules/.bin/release-it"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20.3.0"
|
|
30
|
+
},
|
|
31
|
+
"bin": {
|
|
32
|
+
"qunitx": "cli.js"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/izelnakri/qunitx-cli.git"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"cheerio": "^1.0.0-rc.10",
|
|
40
|
+
"chokidar": "^3.5.3",
|
|
41
|
+
"esbuild": "^0.18.12",
|
|
42
|
+
"js-yaml": "^4.1.0",
|
|
43
|
+
"jsdom": "^22.0.0",
|
|
44
|
+
"kleur": "^4.1.5",
|
|
45
|
+
"picomatch": "^2.3.1",
|
|
46
|
+
"puppeteer": "20.8.2",
|
|
47
|
+
"recursive-lookup": "1.1.0",
|
|
48
|
+
"ws": "^8.13.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"auto-changelog": "^2.4.0",
|
|
52
|
+
"cors": "^2.8.5",
|
|
53
|
+
"express": "^4.17.3",
|
|
54
|
+
"prettier": "^3.0.0",
|
|
55
|
+
"qunit": "^2.19.4",
|
|
56
|
+
"qunitx": "^0.6.0",
|
|
57
|
+
"release-it": "^16.1.0"
|
|
58
|
+
},
|
|
59
|
+
"volta": {
|
|
60
|
+
"node": "20.4.0"
|
|
61
|
+
},
|
|
62
|
+
"prettier": {
|
|
63
|
+
"printWidth": 100,
|
|
64
|
+
"singleQuote": true,
|
|
65
|
+
"arrowParens": "always"
|
|
66
|
+
},
|
|
67
|
+
"release-it": {
|
|
68
|
+
"git": {
|
|
69
|
+
"changelog": "npm run changelog:unreleased"
|
|
70
|
+
},
|
|
71
|
+
"github": {
|
|
72
|
+
"release": true
|
|
73
|
+
},
|
|
74
|
+
"hooks": {
|
|
75
|
+
"after:bump": "npm run changelog:update"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|