qunitx-cli 0.1.0 → 0.1.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/flake.lock +64 -0
- package/flake.nix +26 -0
- package/package.json +4 -4
- package/.github/dependabot.yml +0 -7
- package/.github/workflows/push.yml +0 -36
- package/CHANGELOG.md +0 -25
- package/Dockerfile +0 -24
- package/TODO +0 -90
- package/build.js +0 -54
- package/test/commands/help-test.js +0 -72
- package/test/commands/index.js +0 -2
- package/test/commands/init-test.js +0 -44
- package/test/flags/after-test.js +0 -23
- package/test/flags/before-test.js +0 -23
- package/test/flags/coverage-test.js +0 -6
- package/test/flags/failfast-test.js +0 -5
- package/test/flags/index.js +0 -2
- package/test/flags/output-test.js +0 -6
- package/test/flags/reporter-test.js +0 -6
- package/test/flags/timeout-test.js +0 -6
- package/test/flags/watch-test.js +0 -6
- package/test/helpers/after-script-async.js +0 -13
- package/test/helpers/after-script-basic.js +0 -1
- package/test/helpers/assert-stdout.js +0 -112
- package/test/helpers/before-script-async.js +0 -35
- package/test/helpers/before-script-basic.js +0 -1
- package/test/helpers/before-script-web-server-tests.js +0 -28
- package/test/helpers/failing-tests.js +0 -49
- package/test/helpers/failing-tests.ts +0 -49
- package/test/helpers/fs-writers.js +0 -36
- package/test/helpers/index-with-content.html +0 -20
- package/test/helpers/index-without-content.html +0 -22
- package/test/helpers/passing-tests-dist.js +0 -4883
- package/test/helpers/passing-tests.js +0 -44
- package/test/helpers/passing-tests.ts +0 -44
- package/test/helpers/shell.js +0 -37
- package/test/index.js +0 -22
- package/test/inputs/advanced-htmls-test.js +0 -21
- package/test/inputs/error-edge-cases-test.js +0 -11
- package/test/inputs/file-and-folder-test.js +0 -11
- package/test/inputs/file-test.js +0 -169
- package/test/inputs/folder-test.js +0 -193
- package/test/inputs/index.js +0 -5
- package/test/setup/index.js +0 -1
- package/test/setup/test-file-paths-test.js +0 -33
- package/test/setup.js +0 -17
package/flake.lock
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodes": {
|
|
3
|
+
"flake-utils": {
|
|
4
|
+
"locked": {
|
|
5
|
+
"lastModified": 1659877975,
|
|
6
|
+
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
|
7
|
+
"owner": "numtide",
|
|
8
|
+
"repo": "flake-utils",
|
|
9
|
+
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
|
10
|
+
"type": "github"
|
|
11
|
+
},
|
|
12
|
+
"original": {
|
|
13
|
+
"owner": "numtide",
|
|
14
|
+
"repo": "flake-utils",
|
|
15
|
+
"type": "github"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"napalm": {
|
|
19
|
+
"inputs": {
|
|
20
|
+
"flake-utils": "flake-utils",
|
|
21
|
+
"nixpkgs": [
|
|
22
|
+
"nixpkgs"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"locked": {
|
|
26
|
+
"lastModified": 1672245824,
|
|
27
|
+
"narHash": "sha256-i596lbPiA/Rfx3DiJiCluxdgxWY7oGSgYMT7OmM+zik=",
|
|
28
|
+
"owner": "nix-community",
|
|
29
|
+
"repo": "napalm",
|
|
30
|
+
"rev": "7c25a05cef52dc405f4688422ce0046ca94aadcf",
|
|
31
|
+
"type": "github"
|
|
32
|
+
},
|
|
33
|
+
"original": {
|
|
34
|
+
"owner": "nix-community",
|
|
35
|
+
"repo": "napalm",
|
|
36
|
+
"type": "github"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"nixpkgs": {
|
|
40
|
+
"locked": {
|
|
41
|
+
"lastModified": 1690860117,
|
|
42
|
+
"narHash": "sha256-srkCfjMlg777HxDVMfhkIFgRhhtuZjIOIyR2ejLYK+Y=",
|
|
43
|
+
"owner": "NixOS",
|
|
44
|
+
"repo": "nixpkgs",
|
|
45
|
+
"rev": "96d403ee2479f2070050353b94808209f1352edb",
|
|
46
|
+
"type": "github"
|
|
47
|
+
},
|
|
48
|
+
"original": {
|
|
49
|
+
"owner": "NixOS",
|
|
50
|
+
"ref": "nixpkgs-unstable",
|
|
51
|
+
"repo": "nixpkgs",
|
|
52
|
+
"type": "github"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"root": {
|
|
56
|
+
"inputs": {
|
|
57
|
+
"napalm": "napalm",
|
|
58
|
+
"nixpkgs": "nixpkgs"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"root": "root",
|
|
63
|
+
"version": 7
|
|
64
|
+
}
|
package/flake.nix
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
description = "A flake for napalm";
|
|
3
|
+
|
|
4
|
+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
5
|
+
inputs.napalm.url = "github:nix-community/napalm";
|
|
6
|
+
|
|
7
|
+
# NOTE: This is optional, but is how to configure napalm's env
|
|
8
|
+
inputs.napalm.inputs.nixpkgs.follows = "nixpkgs";
|
|
9
|
+
|
|
10
|
+
outputs = { self, nixpkgs, napalm }:
|
|
11
|
+
let
|
|
12
|
+
system = "x86_64-linux";
|
|
13
|
+
pkgs = nixpkgs.legacyPackages."${system}";
|
|
14
|
+
in {
|
|
15
|
+
packages."${system}".default = napalm.legacyPackages."${system}".buildPackage ./. {
|
|
16
|
+
nodejs = pkgs.nodejs-slim_20;
|
|
17
|
+
PUPPETEER_SKIP_DOWNLOAD=1;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
devShells."${system}".default = pkgs.mkShell {
|
|
21
|
+
nativeBuildInputs = with pkgs; [
|
|
22
|
+
nodejs-slim_20
|
|
23
|
+
];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qunitx-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Browser runner for QUnitx: run your qunitx tests in google-chrome",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "cli.js",
|
|
7
7
|
"author": "Izel Nakri",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"jsdom": "^22.0.0",
|
|
47
47
|
"kleur": "^4.1.5",
|
|
48
48
|
"picomatch": "^2.3.1",
|
|
49
|
-
"puppeteer": "20.
|
|
49
|
+
"puppeteer": "20.9.0",
|
|
50
50
|
"recursive-lookup": "1.1.0",
|
|
51
51
|
"ws": "^8.13.0"
|
|
52
52
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"express": "^4.17.3",
|
|
57
57
|
"prettier": "^3.0.0",
|
|
58
58
|
"qunit": "^2.19.4",
|
|
59
|
-
"qunitx": "^0.
|
|
59
|
+
"qunitx": "^0.9.1",
|
|
60
60
|
"release-it": "^16.1.2"
|
|
61
61
|
},
|
|
62
62
|
"volta": {
|
package/.github/dependabot.yml
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
name: docker-based-ci
|
|
2
|
-
on: push
|
|
3
|
-
jobs:
|
|
4
|
-
test:
|
|
5
|
-
runs-on: ubuntu-latest
|
|
6
|
-
steps:
|
|
7
|
-
- name: Checkout
|
|
8
|
-
uses: actions/checkout@v3
|
|
9
|
-
- name: Set ENV variables
|
|
10
|
-
run: |
|
|
11
|
-
echo "REGISTRY=ghcr.io" >> $GITHUB_ENV
|
|
12
|
-
echo "REPO_OWNER=$(echo ${GITHUB_REPOSITORY%/*})" >> $GITHUB_ENV
|
|
13
|
-
echo "REPO_NAME=$(echo ${GITHUB_REPOSITORY#*/})" >> $GITHUB_ENV
|
|
14
|
-
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
|
|
15
|
-
echo "DOCKER_TAG=$(echo ${GITHUB_REPOSITORY#*/}):$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
|
|
16
|
-
- name: Set up Docker Buildx
|
|
17
|
-
uses: docker/setup-buildx-action@v2.9.0
|
|
18
|
-
with:
|
|
19
|
-
install: true
|
|
20
|
-
- name: Login to GitHub Container Registry
|
|
21
|
-
uses: docker/login-action@v2.2.0
|
|
22
|
-
with:
|
|
23
|
-
registry: ${{env.REGISTRY}}
|
|
24
|
-
username: ${{env.REPO_OWNER}}
|
|
25
|
-
password: ${{secrets.CR_PAT}}
|
|
26
|
-
- name: Build and push
|
|
27
|
-
uses: docker/build-push-action@v4.1.1
|
|
28
|
-
with:
|
|
29
|
-
context: .
|
|
30
|
-
file: ./Dockerfile
|
|
31
|
-
push: true
|
|
32
|
-
tags: ${{env.REGISTRY}}/${{env.REPO_OWNER}}/${{env.DOCKER_TAG}}
|
|
33
|
-
cache-from: type=gha
|
|
34
|
-
cache-to: type=gha,mode=max
|
|
35
|
-
- name: Execute tests
|
|
36
|
-
run: docker run -t --entrypoint="npm" ${REGISTRY}/${REPO_OWNER}/${DOCKER_TAG} run test
|
package/CHANGELOG.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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.1.0](https://github.com/izelnakri/qunitx-cli/compare/0.0.3...0.1.0)
|
|
8
|
-
|
|
9
|
-
- pkg upgrades & github CI [`7a33c07`](https://github.com/izelnakri/qunitx-cli/commit/7a33c07ef9c7b404458ac8b46f97c11009fe32fa)
|
|
10
|
-
- remove --browser flag from help [`011c5ae`](https://github.com/izelnakri/qunitx-cli/commit/011c5aecb1e293bb57aa396d7ceac0fca349298f)
|
|
11
|
-
- add TODO [`35a5121`](https://github.com/izelnakri/qunitx-cli/commit/35a512135d9b5abab740bfde9ae6ecb1781ab26b)
|
|
12
|
-
|
|
13
|
-
#### [0.0.3](https://github.com/izelnakri/qunitx-cli/compare/0.0.2...0.0.3)
|
|
14
|
-
|
|
15
|
-
> 13 July 2023
|
|
16
|
-
|
|
17
|
-
- Release 0.0.3 [`0379477`](https://github.com/izelnakri/qunitx-cli/commit/037947750cc372bdd5c45389d78131bd0b8fa51e)
|
|
18
|
-
- built the foundation for development [`569d860`](https://github.com/izelnakri/qunitx-cli/commit/569d8606b75287aceeaaf0b711139650182cd6c4)
|
|
19
|
-
|
|
20
|
-
#### 0.0.2
|
|
21
|
-
|
|
22
|
-
> 13 July 2023
|
|
23
|
-
|
|
24
|
-
- Release 0.0.2 [`73f444d`](https://github.com/izelnakri/qunitx-cli/commit/73f444d385dd8c08188f5a992f172bd5ff898d89)
|
|
25
|
-
- init [`4d2ac8f`](https://github.com/izelnakri/qunitx-cli/commit/4d2ac8fd98ce7a4c988f9036064a6ef592b55f8f)
|
package/Dockerfile
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
FROM node:20.4.0-slim
|
|
2
|
-
|
|
3
|
-
ENV PUPPETEER_SKIP_DOWNLOAD=true CHROME_BIN=/usr/bin/google-chrome-stable
|
|
4
|
-
|
|
5
|
-
RUN apt-get update \
|
|
6
|
-
&& apt-get install -y wget gnupg \
|
|
7
|
-
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
|
8
|
-
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
|
|
9
|
-
&& apt-get update \
|
|
10
|
-
&& apt-get install -y git libxshmfence-dev google-chrome-stable --no-install-recommends \
|
|
11
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
12
|
-
|
|
13
|
-
WORKDIR /code/
|
|
14
|
-
|
|
15
|
-
ADD package.json package-lock.json /code/
|
|
16
|
-
|
|
17
|
-
RUN npm install
|
|
18
|
-
|
|
19
|
-
ADD lib /code/lib
|
|
20
|
-
ADD vendor /code/vendor
|
|
21
|
-
ADD test /code/test
|
|
22
|
-
ADD . /code/
|
|
23
|
-
|
|
24
|
-
ENTRYPOINT "/bin/bash"
|
package/TODO
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
- "$ qunitx sanity-test.ts" made redundant due to (node --test mode) this should impact dependencies and internal modules
|
|
2
|
-
- Implement other test cases in deno
|
|
3
|
-
|
|
4
|
-
Shim dir structure should be: shims/nodejs/ shims/deno shims/browser
|
|
5
|
-
Make package.json point to them correctly
|
|
6
|
-
Make the package so esbuild build so esbuild builds when qunitx is vendored(if it needs to)
|
|
7
|
-
|
|
8
|
-
Turn import { module, test } from '../../shims/nodejs.js' to import { module, test } from 'qunitx'; For this to happen browser bundler should pick up actual qunit
|
|
9
|
-
|
|
10
|
-
Combine nix with Docker for faster container builds
|
|
11
|
-
|
|
12
|
-
- also watch subdependencies on browser mode (-- how? investigate esbuild watch)
|
|
13
|
-
- maybe make browser tests per file loading <script>, also could add asset maps maybe if puppeteer supports, this could fix initial "qf" bug
|
|
14
|
-
|
|
15
|
-
implement and test require and timeout flags
|
|
16
|
-
implement concurrency
|
|
17
|
-
|
|
18
|
-
fix watcher for file removals make the logic smarter
|
|
19
|
-
|
|
20
|
-
allow passing absolutePaths(maybe)
|
|
21
|
-
|
|
22
|
-
- globs: test dynamically added file is watched on global input configuration | also check added files on watch gets put to config.fileOrFolderInputs
|
|
23
|
-
currently parse-fs-inputs might be less performant on big folders(?) dependending on how watch is implemented
|
|
24
|
-
- coverage
|
|
25
|
-
watch parsed files from html(?)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
$ qunitx some-test --browser | default html doesnt match with $ qunitx init and also no html mode should be there
|
|
29
|
-
|
|
30
|
-
try this: $ npx ava --tap | npx tap-difflet
|
|
31
|
-
or this: $ npx ava --tap | npx faucet
|
|
32
|
-
|
|
33
|
-
research mocha reporter(TAP > reporters | json stream metada then it consumes this metadata(how?))
|
|
34
|
-
example good reporters: spec(reporter), dot, tap, landing strip(interesting instead put percentage), jest
|
|
35
|
-
|
|
36
|
-
esbuild ./tmp/test/passing-tests.js --bundle > test.js
|
|
37
|
-
parse qunitx in the package.json for config
|
|
38
|
-
|
|
39
|
-
failFast and babelOptions?
|
|
40
|
-
files(and to ignore), require, timeout
|
|
41
|
-
concurrencyStrategies
|
|
42
|
-
|
|
43
|
-
add node and browser options
|
|
44
|
-
add functionality to execute only one test
|
|
45
|
-
add reporters
|
|
46
|
-
|
|
47
|
-
pass timezone: https://stackoverflow.com/questions/16448754/how-to-use-a-custom-time-in-browser-to-test-for-client-vs-server-time-difference/39533934#39533934
|
|
48
|
-
= qunitx --timezone="US/Pacific"
|
|
49
|
-
|
|
50
|
-
QUnit regex filters
|
|
51
|
-
|
|
52
|
-
Jest Notes
|
|
53
|
-
==========
|
|
54
|
-
TestSequencer
|
|
55
|
-
- this failed in the past? run first
|
|
56
|
-
- when file changed latest
|
|
57
|
-
- this test run in the past and was long? long tests run first
|
|
58
|
-
- file size
|
|
59
|
-
|
|
60
|
-
TestScheduler
|
|
61
|
-
- schedule across threads
|
|
62
|
-
- reporters
|
|
63
|
-
- dont spawn many threads if total test count is small
|
|
64
|
-
jest-runner/jest-puppeteer(check this)
|
|
65
|
-
|
|
66
|
-
read jest-worker/worker_thread implementation
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
check if jest-qunit exists
|
|
70
|
-
|
|
71
|
-
jest-runtime(creates VM context)
|
|
72
|
-
allows module mocking, custom require implementation, also does transforms
|
|
73
|
-
runs the tests
|
|
74
|
-
transform is sync in jest(dep tracking problem)
|
|
75
|
-
|
|
76
|
-
TestResult / Repoter
|
|
77
|
-
- all data has to be json serializable for threads
|
|
78
|
-
- stack trace of errors
|
|
79
|
-
- how many assertions
|
|
80
|
-
|
|
81
|
-
AggregatedRestResult[]
|
|
82
|
-
- finished test case, how long, each assertion
|
|
83
|
-
- check jest runners
|
|
84
|
-
|
|
85
|
-
qunitx init
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
write test metadata(each test) if flag is provided
|
|
89
|
-
|
|
90
|
-
markdown reporter(interesting: https://mochajs.org/#markdown)
|
package/build.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
|
|
3
|
-
let [qunitJS, qunitCSS, _] = await Promise.all([
|
|
4
|
-
fs.readFile('./node_modules/qunit/qunit/qunit.js'),
|
|
5
|
-
fs.readFile('./node_modules/qunit/qunit/qunit.css'),
|
|
6
|
-
fs.mkdir('./vendor', { recursive: true })
|
|
7
|
-
]);
|
|
8
|
-
|
|
9
|
-
let newQUnit = qunitJS.toString().replace(
|
|
10
|
-
'start: function start(count) {',
|
|
11
|
-
`reset: function() {
|
|
12
|
-
ProcessingQueue.finished = false;
|
|
13
|
-
globalStartCalled = false;
|
|
14
|
-
runStarted = false;
|
|
15
|
-
|
|
16
|
-
config.queue.length = 0;
|
|
17
|
-
config.modules.length = 0;
|
|
18
|
-
config.autostart = false;
|
|
19
|
-
|
|
20
|
-
Object.assign(config.stats, { total: 0, passed: 0, failed: 0, skipped: 0, todo: 0 });
|
|
21
|
-
|
|
22
|
-
[
|
|
23
|
-
"started", "updateRate", "filter", "depth", "current",
|
|
24
|
-
"pageLoaded", "timeoutHandler", "timeout", "pollution"
|
|
25
|
-
].forEach( ( key ) => delete config[ key ] );
|
|
26
|
-
|
|
27
|
-
const suiteReport = config.currentModule.suiteReport;
|
|
28
|
-
|
|
29
|
-
suiteReport.childSuites.length = 0;
|
|
30
|
-
delete suiteReport._startTime;
|
|
31
|
-
delete suiteReport._endTime;
|
|
32
|
-
|
|
33
|
-
config.modules.push( config.currentModule );
|
|
34
|
-
},
|
|
35
|
-
start: function start(count) {`);
|
|
36
|
-
|
|
37
|
-
await Promise.all([
|
|
38
|
-
fs.writeFile('./vendor/qunit.js', newQUnit),
|
|
39
|
-
fs.writeFile('./vendor/qunit.css', qunitCSS),
|
|
40
|
-
createPackageJSONIfNotExists()
|
|
41
|
-
]);
|
|
42
|
-
|
|
43
|
-
async function createPackageJSONIfNotExists() {
|
|
44
|
-
try {
|
|
45
|
-
await fs.stat('./vendor/package.json');
|
|
46
|
-
|
|
47
|
-
return true;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
await fs.writeFile('./vendor/package.json', JSON.stringify({
|
|
50
|
-
name: 'qunitx-vendor',
|
|
51
|
-
version: '0.0.1'
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { module, test } from 'qunitx';
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import { promisify } from 'node:util';
|
|
5
|
-
import { exec } from 'node:child_process';
|
|
6
|
-
|
|
7
|
-
const CWD = process.cwd();
|
|
8
|
-
const VERSION = JSON.parse(fs.readFileSync(`${CWD}/package.json`)).version;
|
|
9
|
-
const shell = promisify(exec);
|
|
10
|
-
const cli = async function(arg = '') {
|
|
11
|
-
if (process.argv[0].includes('deno')) {
|
|
12
|
-
return await shell(`deno run --allow-read --allow-env ${CWD}/deno/cli.js ${arg}`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return await shell(`node ${CWD}/cli.js ${arg}`);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const printedHelpOutput = `[qunitx v${VERSION}] Usage: qunitx [targets] --$flags
|
|
19
|
-
|
|
20
|
-
Input options:
|
|
21
|
-
- File: $ qunitx test/foo.js
|
|
22
|
-
- Folder: $ qunitx test/login
|
|
23
|
-
- Globs: $ qunitx test/**/*-test.js
|
|
24
|
-
- Combination: $ qunitx test/foo.js test/bar.js test/*-test.js test/logout
|
|
25
|
-
|
|
26
|
-
Optional flags:
|
|
27
|
-
--debug : print console output when tests run in browser
|
|
28
|
-
--watch : run the target file or folders, watch them for continuous run and expose http server under localhost
|
|
29
|
-
--timeout : change default timeout per test case
|
|
30
|
-
--output : folder to distribute built qunitx html and js that a webservers can run[default: tmp]
|
|
31
|
-
--failFast : run the target file or folders with immediate abort if a single test fails
|
|
32
|
-
--before : run a script before the tests(i.e start a new web server before tests)
|
|
33
|
-
--after : run a script after the tests(i.e save test results to a file)
|
|
34
|
-
|
|
35
|
-
Example: $ qunitx test/foo.ts app/e2e --debug --watch --before=scripts/start-new-webserver.js --after=scripts/write-test-results.js
|
|
36
|
-
|
|
37
|
-
Commands:
|
|
38
|
-
$ qunitx init # Bootstraps qunitx base html and add qunitx config to package.json if needed
|
|
39
|
-
$ qunitx new $testFileName # Creates a qunitx test file`;
|
|
40
|
-
|
|
41
|
-
module('Commands | Help tests', () => {
|
|
42
|
-
test('$ qunitx -> prints help text', async (assert) => {
|
|
43
|
-
const { stdout } = await cli();
|
|
44
|
-
|
|
45
|
-
console.log(stdout);
|
|
46
|
-
assert.ok(stdout.includes(printedHelpOutput));
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('$ qunitx print -> prints help text', async (assert) => {
|
|
50
|
-
const { stdout } = await cli('print');
|
|
51
|
-
|
|
52
|
-
assert.ok(stdout.includes(printedHelpOutput));
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test('$ qunitx p -> prints help text', async (assert) => {
|
|
56
|
-
const { stdout } = await cli('p');
|
|
57
|
-
|
|
58
|
-
assert.ok(stdout.includes(printedHelpOutput));
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('$ qunitx help -> prints help text', async (assert) => {
|
|
62
|
-
const { stdout } = await cli('help');
|
|
63
|
-
|
|
64
|
-
assert.ok(stdout.includes(printedHelpOutput));
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('$ qunitx h -> prints help text', async (assert) => {
|
|
68
|
-
const { stdout } = await cli('h');
|
|
69
|
-
|
|
70
|
-
assert.ok(stdout.includes(printedHelpOutput));
|
|
71
|
-
});
|
|
72
|
-
});
|
package/test/commands/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { module, test } from 'qunitx';
|
|
2
|
-
import assert from 'node:assert';
|
|
3
|
-
import { promisify } from 'node:util';
|
|
4
|
-
import { exec } from 'node:child_process';
|
|
5
|
-
|
|
6
|
-
const shell = promisify(exec);
|
|
7
|
-
const cli = async function(arg = '') {
|
|
8
|
-
if (process.argv[0].includes('deno')) {
|
|
9
|
-
return await shell(`deno run --allow-read ${CWD}/deno/cli.js ${arg}`);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return await shell(`deno run --allow-read ${CWD}/cli.js ${arg}`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module('Commands | init tests', () => {
|
|
16
|
-
test('$ qunitx init -> creates the test.html and correctly', async () => {
|
|
17
|
-
// assert missing
|
|
18
|
-
const { stdout } = await cli('init');
|
|
19
|
-
// assert added
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// it('$ qunitx init warns existing files and assigns attributes to package.json', async function() {
|
|
23
|
-
|
|
24
|
-
// });
|
|
25
|
-
|
|
26
|
-
// it('$ qunitx init -> recreates missing files from package.json if it exists', async function() {
|
|
27
|
-
|
|
28
|
-
// });
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
async function stripQUnitXFromPackageJSON() {
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// it('$ qunitx unknown -> raises error', async function() {
|
|
36
|
-
// t.plan(2);
|
|
37
|
-
|
|
38
|
-
// try {
|
|
39
|
-
// await shell(`node ${process.cwd()}/cli.js dasd`);
|
|
40
|
-
// } catch ({ stdout }) {
|
|
41
|
-
// assert.ok(stdout.includes('qunitx unknown command. Available options are:'));
|
|
42
|
-
// assert.ok(stdout.includes(printedHelpOutput));
|
|
43
|
-
// }
|
|
44
|
-
// });
|
package/test/flags/after-test.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { module, test } from 'qunitx';
|
|
2
|
-
import { assertPassingTestCase, assertFailingTestCase, assertTAPResult } from '../helpers/assert-stdout.js';
|
|
3
|
-
import shell from '../helpers/shell.js';
|
|
4
|
-
|
|
5
|
-
module('--after script tests for browser mode', { concurrency: false }, (_hooks, moduleMetadata) => {
|
|
6
|
-
test('--after works when it doesnt need to be awaited', async (assert, testMetadata) => {
|
|
7
|
-
const { stdout } = await shell('node cli.js test/helpers/passing-tests.js --after=test/helpers/after-script-basic.js', { ...moduleMetadata, ...testMetadata });
|
|
8
|
-
|
|
9
|
-
assert.ok(stdout.includes('This is running from after script!!'));
|
|
10
|
-
assertPassingTestCase(assert, stdout, { debug: false, testNo: 1, moduleName: '{{moduleName}}' });
|
|
11
|
-
assertTAPResult(assert, stdout, { testCount: 3 });
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test('--after works when it needs to be awaited', async (assert, testMetadata) => {
|
|
15
|
-
const { stdout } = await shell('node cli.js test/helpers/passing-tests.js --after=test/helpers/after-script-async.js', { ...moduleMetadata, ...testMetadata });
|
|
16
|
-
|
|
17
|
-
assert.ok(stdout.includes('This is running from after script!!'));
|
|
18
|
-
assert.ok(stdout.includes('After script result is written:'));
|
|
19
|
-
assert.ok(stdout.includes(JSON.stringify({ testCount: 3, failCount: 0, skipCount: 0, passCount: 3 }, null, 2)));
|
|
20
|
-
assertPassingTestCase(assert, stdout, { testNo: 1, moduleName: '{{moduleName}}' });
|
|
21
|
-
assertTAPResult(assert, stdout, { testCount: 3 });
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { module, test } from 'qunitx';
|
|
2
|
-
import { assertPassingTestCase, assertFailingTestCase, assertTAPResult } from '../helpers/assert-stdout.js';
|
|
3
|
-
import shell from '../helpers/shell.js';
|
|
4
|
-
|
|
5
|
-
module('--before script tests for browser mode', { concurrency: false }, (_hooks, moduleMetadata) => {
|
|
6
|
-
test('--before works when it doesnt need to be awaited', async (assert, testMetadata) => {
|
|
7
|
-
const { stdout } = await shell('node cli.js test/helpers/passing-tests.js --before=test/helpers/before-script-basic.js', { ...moduleMetadata, ...testMetadata });
|
|
8
|
-
|
|
9
|
-
assert.ok(stdout.includes('This is running from before script!!'));
|
|
10
|
-
assertPassingTestCase(assert, stdout, { testNo: 1, moduleName: '{{moduleName}}' });
|
|
11
|
-
assertTAPResult(assert, stdout, { testCount: 3 });
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test('--before works it needs to be awaited', { concurrency: false }, async (assert, testMetadata) => {
|
|
15
|
-
const { stdout } = await shell('node cli.js test/helpers/passing-tests.js test/helpers/before-script-web-server-tests.js --before=test/helpers/before-script-async.js', { ...moduleMetadata, ...testMetadata });
|
|
16
|
-
|
|
17
|
-
assert.ok(stdout.includes('This is running from before script!!'));
|
|
18
|
-
assert.ok(stdout.includes('Starting before script with:'));
|
|
19
|
-
assertPassingTestCase(assert, stdout, { testNo: 1, moduleName: '{{moduleName}}' });
|
|
20
|
-
assertPassingTestCase(assert, stdout, { testNo: 4, moduleName: '{{moduleName}} Before script web server tests' });
|
|
21
|
-
assertTAPResult(assert, stdout, { testCount: 4 });
|
|
22
|
-
});
|
|
23
|
-
});
|
package/test/flags/index.js
DELETED
package/test/flags/watch-test.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import './after-script-basic.js';
|
|
3
|
-
|
|
4
|
-
export default async function(results) {
|
|
5
|
-
let resultsInString = JSON.stringify(results, null, 2);
|
|
6
|
-
|
|
7
|
-
await fs.rm(`${process.cwd()}/tmp/results.json`, { force: true, recursive: true });
|
|
8
|
-
await fs.writeFile(`${process.cwd()}/tmp/results.json`, resultsInString);
|
|
9
|
-
|
|
10
|
-
console.log('After script result is written:');
|
|
11
|
-
console.log(resultsInString);
|
|
12
|
-
}
|
|
13
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log('This is running from after script!!');
|