qunitx 0.3.8 → 0.4.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/lib/commands/run.js +9 -4
- package/lib/setup/browser.js +1 -1
- package/package.json +7 -7
- package/shims/nodejs-assert.js +26 -0
- package/shims/nodejs.js +81 -0
package/lib/commands/run.js
CHANGED
|
@@ -16,21 +16,22 @@ import writeOutputStaticFiles from '../setup/write-output-static-files.js';
|
|
|
16
16
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
|
|
18
18
|
export default async function(config) {
|
|
19
|
-
if (config.before) {
|
|
20
|
-
await runUserModule(`${process.cwd()}/${config.before}`, config, 'before');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
19
|
if (config.browser) {
|
|
24
20
|
let cachedContent = await buildCachedContent(config, config.htmlPaths);
|
|
25
21
|
let [connections, _] = await Promise.all([
|
|
26
22
|
setupBrowser(config, cachedContent),
|
|
27
23
|
writeOutputStaticFiles(config, cachedContent)
|
|
28
24
|
]);
|
|
25
|
+
config.expressApp = connections.server;
|
|
29
26
|
|
|
30
27
|
if (config.watch) {
|
|
31
28
|
setupKeyboardEvents(config, cachedContent, connections);
|
|
32
29
|
}
|
|
33
30
|
|
|
31
|
+
if (config.before) {
|
|
32
|
+
await runUserModule(`${process.cwd()}/${config.before}`, config, 'before');
|
|
33
|
+
}
|
|
34
|
+
|
|
34
35
|
await runTestsInBrowser(config, cachedContent, connections);
|
|
35
36
|
|
|
36
37
|
if (config.watch) {
|
|
@@ -60,6 +61,10 @@ export default async function(config) {
|
|
|
60
61
|
setupKeyboardEvents(config);
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
if (config.before) {
|
|
65
|
+
await runUserModule(`${process.cwd()}/${config.before}`, config, 'before');
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
await runTestsInNode(Object.keys(config.fsTree), config);
|
|
64
69
|
|
|
65
70
|
if (config.watch) {
|
package/lib/setup/browser.js
CHANGED
|
@@ -11,7 +11,7 @@ export default async function setupBrowser(config = {
|
|
|
11
11
|
setupWebServer(config, cachedContent),
|
|
12
12
|
Puppeteer.launch({
|
|
13
13
|
executablePath: process.env.CHROME_BIN || null,
|
|
14
|
-
headless:
|
|
14
|
+
headless: 'new',
|
|
15
15
|
args: ['--no-sandbox', '--disable-gpu', '--remote-debugging-port=0', '--window-size=1440,900']
|
|
16
16
|
}),
|
|
17
17
|
]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qunitx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "Experimental improvements, suggestions for qunit CLI",
|
|
6
6
|
"author": "Izel Nakri",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"@nanoexpress/middleware-static-serve": "^1.0.4",
|
|
38
38
|
"cheerio": "^1.0.0-rc.10",
|
|
39
39
|
"chokidar": "^3.5.3",
|
|
40
|
-
"esbuild": "^0.
|
|
40
|
+
"esbuild": "^0.17.18",
|
|
41
41
|
"js-yaml": "^4.1.0",
|
|
42
42
|
"kleur": "^4.1.5",
|
|
43
|
-
"nanoexpress": "^6.1
|
|
43
|
+
"nanoexpress": "^6.2.1",
|
|
44
44
|
"picomatch": "^2.3.1",
|
|
45
|
-
"puppeteer": "
|
|
46
|
-
"recursive-lookup": "1.
|
|
45
|
+
"puppeteer": "20.1.2",
|
|
46
|
+
"recursive-lookup": "1.1.0",
|
|
47
47
|
"ts-node": "^10.7.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"express": "^4.17.3",
|
|
53
53
|
"prettier": "^2.8.8",
|
|
54
54
|
"qunit": "^2.18.0",
|
|
55
|
-
"qunitx": "^0.3.
|
|
55
|
+
"qunitx": "^0.3.8",
|
|
56
56
|
"release-it": "^15.10.3"
|
|
57
57
|
},
|
|
58
58
|
"volta": {
|
|
59
|
-
"node": "
|
|
59
|
+
"node": "20.1.0"
|
|
60
60
|
},
|
|
61
61
|
"prettier": {
|
|
62
62
|
"printWidth": 100,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
|
|
3
|
+
// TODO: write test cases for these
|
|
4
|
+
export default {
|
|
5
|
+
async: assert.async,
|
|
6
|
+
deepEqual: assert.deepStrictEqual,
|
|
7
|
+
equal: assert.strictEqual,
|
|
8
|
+
expect: assert.expect,
|
|
9
|
+
false: assert.false,
|
|
10
|
+
notDeepEqual: assert.notDeepStrictEqual,
|
|
11
|
+
notEqual: assert.notEqual,
|
|
12
|
+
notOk: assert.notOk,
|
|
13
|
+
notPropContains: assert.notPropContains,
|
|
14
|
+
notPropEqual: assert.notPropEqual,
|
|
15
|
+
notStrictEqual: assert.notStrictEqual,
|
|
16
|
+
ok: assert.ok,
|
|
17
|
+
propContains: assert.propContains,
|
|
18
|
+
pushResult: assert.pushResult,
|
|
19
|
+
rejects: assert.rejects,
|
|
20
|
+
step: assert.step,
|
|
21
|
+
strictEqual: assert.strictEqual,
|
|
22
|
+
throws: assert.throws,
|
|
23
|
+
timeout: assert.timeout,
|
|
24
|
+
true: assert.true,
|
|
25
|
+
verifySteps: assert.verifySteps
|
|
26
|
+
};
|
package/shims/nodejs.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { run, describe, it, before, after, beforeEach, afterEach } from 'node:test';
|
|
2
|
+
import assert from './nodejs-assert.js';
|
|
3
|
+
|
|
4
|
+
export const module = async function(moduleName, _hooks, moduleContent) {
|
|
5
|
+
let targetModuleContent = moduleContent ? moduleContent : _hooks;
|
|
6
|
+
let targetHooks = moduleContent ? _hooks : undefined;
|
|
7
|
+
|
|
8
|
+
const hooks = targetHooks || { before: undefined, after: undefined, beforeEach: undefined, afterEach: undefined};
|
|
9
|
+
const { before: _before, after: _after, beforeEach: _beforeEach, afterEach: _afterEach } = hooks;
|
|
10
|
+
|
|
11
|
+
// NOTE: add { concurrency: true }
|
|
12
|
+
return describe(moduleName, async function() {
|
|
13
|
+
if (_before) {
|
|
14
|
+
before(_before);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (_after) {
|
|
18
|
+
after(_after);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (_beforeEach) {
|
|
22
|
+
beforeEach(_beforeEach);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (_afterEach) {
|
|
26
|
+
afterEach(_afterEach);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return await targetModuleContent(hooks);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const test = async function(testName, testContent) {
|
|
34
|
+
// return it(testName, { concurrency: true }, async function() {
|
|
35
|
+
// NOTE: also add timeout here!! then changable when QUnit implemented correctly
|
|
36
|
+
// NOTE: add { concurrency: true }
|
|
37
|
+
return it(testName, async function() {
|
|
38
|
+
return await testContent(assert);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// NOTE: later maybe expose these as well:
|
|
44
|
+
|
|
45
|
+
// import QUnit from './vendor/qunit.js';
|
|
46
|
+
|
|
47
|
+
// QUnit.config.autostart = false;
|
|
48
|
+
|
|
49
|
+
// export const isLocal = QUnit.isLocal;
|
|
50
|
+
// export const on = QUnit.on;
|
|
51
|
+
// export const test = QUnit.test;
|
|
52
|
+
// export const skip = QUnit.skip;
|
|
53
|
+
// export const start = QUnit.start;
|
|
54
|
+
// export const is = QUnit.is;
|
|
55
|
+
// export const extend = QUnit.extend;
|
|
56
|
+
// export const stack = QUnit.stack;
|
|
57
|
+
// export const onUnhandledRejection = QUnit.onUnhandledRejection;
|
|
58
|
+
// export const assert = QUnit.assert;
|
|
59
|
+
// export const dump = QUnit.dump;
|
|
60
|
+
// export const done = QUnit.done;
|
|
61
|
+
// export const testStart = QUnit.testStart;
|
|
62
|
+
// export const moduleStart = QUnit.moduleStart;
|
|
63
|
+
// export const version = QUnit.version;
|
|
64
|
+
// export const module = QUnit.module;
|
|
65
|
+
// export const todo = QUnit.todo;
|
|
66
|
+
// export const only = QUnit.only;
|
|
67
|
+
// export const config = QUnit.config;
|
|
68
|
+
// export const objectType = QUnit.objectType;
|
|
69
|
+
// export const load = QUnit.load;
|
|
70
|
+
// export const onError = QUnit.onError;
|
|
71
|
+
// export const pushFailure = QUnit.pushFailure;
|
|
72
|
+
// export const equiv = QUnit.equiv;
|
|
73
|
+
// export const begin = QUnit.begin;
|
|
74
|
+
// export const log = QUnit.log;
|
|
75
|
+
// export const testDone = QUnit.testDone;
|
|
76
|
+
// export const moduleDone = QUnit.moduleDone;
|
|
77
|
+
// export const diff = QUnit.diff;
|
|
78
|
+
|
|
79
|
+
// export default Object.assign(QUnit, {
|
|
80
|
+
// QUnitxVersion: '0.0.1'
|
|
81
|
+
// });
|