qunitx-cli 0.0.3 → 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/lib/commands/help.js +1 -2
- package/package.json +10 -7
- package/CHANGELOG.md +0 -16
- package/Dockerfile +0 -24
- package/build.js +0 -54
- package/test/commands/help-test.js +0 -73
- 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
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { module, test } from '../../index.js';
|
|
2
|
-
|
|
3
|
-
module('{{moduleName}} Before script web server tests', function(hooks) {
|
|
4
|
-
test('assert true works', async function (assert) {
|
|
5
|
-
let json;
|
|
6
|
-
try {
|
|
7
|
-
let port = window.QUnit.config.port || location.port;
|
|
8
|
-
|
|
9
|
-
await wait(250);
|
|
10
|
-
|
|
11
|
-
let res = await fetch(`http://127.0.0.1:${port}/films`);
|
|
12
|
-
json = await res.json();
|
|
13
|
-
} catch (err) {
|
|
14
|
-
console.log('FETCH ERR', err);
|
|
15
|
-
console.log(err.cause);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
assert.deepEqual(json, { film: 'responsed correctly' });
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// test('async test finishes', async function (assert) {
|
|
22
|
-
|
|
23
|
-
// });
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
function wait(duration) {
|
|
27
|
-
return new Promise((resolve) => setTimeout(() => { resolve() }, duration));
|
|
28
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { module, test } from 'qunitx';
|
|
2
|
-
|
|
3
|
-
module('{{moduleName}} Failing Tests', function(hooks) {
|
|
4
|
-
test('assert true works', function (assert) {
|
|
5
|
-
assert.expect(3);
|
|
6
|
-
assert.ok(true);
|
|
7
|
-
console.log('calling assert true test case');
|
|
8
|
-
assert.equal(true, true);
|
|
9
|
-
assert.equal(null, null);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('async test finishes', async function (assert) {
|
|
13
|
-
assert.expect(4);
|
|
14
|
-
|
|
15
|
-
const wait = () => new Promise((resolve, reject) => {
|
|
16
|
-
window.setTimeout(() => {
|
|
17
|
-
console.log('resolving async test');
|
|
18
|
-
console.log({
|
|
19
|
-
moduleName: 'called resolved async test with object',
|
|
20
|
-
placeholder: 1000,
|
|
21
|
-
anotherObject: {
|
|
22
|
-
firstName: 'Izel',
|
|
23
|
-
createdAt: new Date('2021-03-06')
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
resolve(true);
|
|
27
|
-
}, 50);
|
|
28
|
-
});
|
|
29
|
-
const result = await wait();
|
|
30
|
-
|
|
31
|
-
assert.ok(true);
|
|
32
|
-
assert.equal(false, result);
|
|
33
|
-
assert.equal(null, null);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('runtime error output', function (assert) {
|
|
37
|
-
let smt = {};
|
|
38
|
-
|
|
39
|
-
assert.equal(undefined, true);
|
|
40
|
-
assert.deepEqual(smt.first.second, {});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('deepEqual true works', function (assert) {
|
|
44
|
-
const me = { firstName: 'Izel', lastName: 'Nakri' };
|
|
45
|
-
|
|
46
|
-
console.log('calling deepEqual test case');
|
|
47
|
-
assert.deepEqual(me, { firstName: 'Isaac', lastName: 'Nakri' });
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { module, test } from 'qunitx';
|
|
2
|
-
|
|
3
|
-
module('{{moduleName}} Failing Tests', function(hooks) {
|
|
4
|
-
test('assert true works', function (assert) {
|
|
5
|
-
assert.expect(3);
|
|
6
|
-
assert.ok(true);
|
|
7
|
-
console.log('calling assert true test case');
|
|
8
|
-
assert.equal(true, true);
|
|
9
|
-
assert.equal(null, null);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('async test finishes', async function (assert) {
|
|
13
|
-
assert.expect(4);
|
|
14
|
-
|
|
15
|
-
const wait = () => new Promise((resolve, reject) => {
|
|
16
|
-
window.setTimeout(() => {
|
|
17
|
-
console.log('resolving async test');
|
|
18
|
-
console.log({
|
|
19
|
-
moduleName: 'called resolved async test with object',
|
|
20
|
-
placeholder: 1000,
|
|
21
|
-
anotherObject: {
|
|
22
|
-
firstName: 'Izel',
|
|
23
|
-
createdAt: new Date('2021-03-06')
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
resolve(true);
|
|
27
|
-
}, 50);
|
|
28
|
-
});
|
|
29
|
-
const result = await wait();
|
|
30
|
-
|
|
31
|
-
assert.ok(true);
|
|
32
|
-
assert.equal(false, result);
|
|
33
|
-
assert.equal(null, null);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('runtime error output', function (assert) {
|
|
37
|
-
let smt = {};
|
|
38
|
-
|
|
39
|
-
assert.equal(undefined, true);
|
|
40
|
-
assert.deepEqual(smt.first.second, {});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('deepEqual true works', function (assert) {
|
|
44
|
-
const me = { firstName: 'Izel', lastName: 'Nakri' };
|
|
45
|
-
|
|
46
|
-
console.log('calling deepEqual test case');
|
|
47
|
-
assert.deepEqual(me, { firstName: 'Isaac', lastName: 'Nakri' });
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import crypto from 'node:crypto';
|
|
3
|
-
|
|
4
|
-
export async function writeTestFolder(options={ addFailingTests: false, mixedExtensions: false }) {
|
|
5
|
-
let { addFailingTests, mixedExtensions } = options;
|
|
6
|
-
let folderName = crypto.randomUUID();
|
|
7
|
-
let extension = mixedExtensions ? 'ts' : 'js';
|
|
8
|
-
let [passingsTestTemplate, failingTestTemplate] = await Promise.all([
|
|
9
|
-
fs.readFile(`${process.cwd()}/test/helpers/passing-tests.js`),
|
|
10
|
-
options.addFailingTests ? fs.readFile(`${process.cwd()}/test/helpers/failing-tests.js`) : null,
|
|
11
|
-
fs.mkdir(`${process.cwd()}/tmp/${folderName}`, { recursive: true })
|
|
12
|
-
]);
|
|
13
|
-
|
|
14
|
-
await Promise.all([
|
|
15
|
-
writeTestFile(folderName, 'first-module-pass', 'js', passingsTestTemplate),
|
|
16
|
-
writeTestFile(folderName, 'second-module-pass', extension, passingsTestTemplate),
|
|
17
|
-
addFailingTests ? writeTestFile(folderName, 'first-module-fail', 'js', failingTestTemplate) : null,
|
|
18
|
-
addFailingTests ? writeTestFile(folderName, 'second-module-fail', extension, failingTestTemplate) : null,
|
|
19
|
-
addFailingTests ? writeTestFile(folderName, 'third-module-fail', extension, failingTestTemplate) : null,
|
|
20
|
-
]);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return folderName;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function writeTestFile(folderName, testFileName, extension, templateBuffer) {
|
|
27
|
-
return fs.writeFile(
|
|
28
|
-
`${process.cwd()}/tmp/${folderName}/${testFileName}.${extension}`,
|
|
29
|
-
templateBuffer.toString().replace('{{moduleName}}', `${folderName} | ${testFileName}`)
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
writeTestFolder,
|
|
35
|
-
writeTestFile
|
|
36
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width">
|
|
6
|
-
<title>HTML with content tests</title>
|
|
7
|
-
<link href="../../node_modules/qunit/qunit/qunit.css" rel="stylesheet">
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="qunit"></div>
|
|
11
|
-
<div id="qunit-fixture"></div>
|
|
12
|
-
|
|
13
|
-
{{content}}
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
console.log('Hello from index-with-content.html');
|
|
17
|
-
</script>
|
|
18
|
-
<script src="./passing-tests-dist.js"></script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>`
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width">
|
|
6
|
-
<title>HTML without content tests</title>
|
|
7
|
-
<link href="../../node_modules/qunit/qunit/qunit.css" rel="stylesheet">
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="qunit"></div>
|
|
11
|
-
<div id="qunit-fixture"></div>
|
|
12
|
-
|
|
13
|
-
<!-- this has no {content} so should be just viewed in the browser with no console interaction(?) -->
|
|
14
|
-
<script>
|
|
15
|
-
console.log('Hello from index-without-content.html');
|
|
16
|
-
</script>
|
|
17
|
-
<script src="./passing-tests-dist.js"></script>
|
|
18
|
-
<script>
|
|
19
|
-
window.QUnit.start();
|
|
20
|
-
</script>
|
|
21
|
-
</body>
|
|
22
|
-
</html>`
|