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.
Files changed (44) hide show
  1. package/flake.lock +64 -0
  2. package/flake.nix +26 -0
  3. package/lib/commands/help.js +1 -2
  4. package/package.json +10 -7
  5. package/CHANGELOG.md +0 -16
  6. package/Dockerfile +0 -24
  7. package/build.js +0 -54
  8. package/test/commands/help-test.js +0 -73
  9. package/test/commands/index.js +0 -2
  10. package/test/commands/init-test.js +0 -44
  11. package/test/flags/after-test.js +0 -23
  12. package/test/flags/before-test.js +0 -23
  13. package/test/flags/coverage-test.js +0 -6
  14. package/test/flags/failfast-test.js +0 -5
  15. package/test/flags/index.js +0 -2
  16. package/test/flags/output-test.js +0 -6
  17. package/test/flags/reporter-test.js +0 -6
  18. package/test/flags/timeout-test.js +0 -6
  19. package/test/flags/watch-test.js +0 -6
  20. package/test/helpers/after-script-async.js +0 -13
  21. package/test/helpers/after-script-basic.js +0 -1
  22. package/test/helpers/assert-stdout.js +0 -112
  23. package/test/helpers/before-script-async.js +0 -35
  24. package/test/helpers/before-script-basic.js +0 -1
  25. package/test/helpers/before-script-web-server-tests.js +0 -28
  26. package/test/helpers/failing-tests.js +0 -49
  27. package/test/helpers/failing-tests.ts +0 -49
  28. package/test/helpers/fs-writers.js +0 -36
  29. package/test/helpers/index-with-content.html +0 -20
  30. package/test/helpers/index-without-content.html +0 -22
  31. package/test/helpers/passing-tests-dist.js +0 -4883
  32. package/test/helpers/passing-tests.js +0 -44
  33. package/test/helpers/passing-tests.ts +0 -44
  34. package/test/helpers/shell.js +0 -37
  35. package/test/index.js +0 -22
  36. package/test/inputs/advanced-htmls-test.js +0 -21
  37. package/test/inputs/error-edge-cases-test.js +0 -11
  38. package/test/inputs/file-and-folder-test.js +0 -11
  39. package/test/inputs/file-test.js +0 -169
  40. package/test/inputs/folder-test.js +0 -193
  41. package/test/inputs/index.js +0 -5
  42. package/test/setup/index.js +0 -1
  43. package/test/setup/test-file-paths-test.js +0 -33
  44. package/test/setup.js +0 -17
@@ -1,44 +0,0 @@
1
- import { module, test } from 'qunitx';
2
-
3
- module('{{moduleName}} Passing 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(3);
14
-
15
- const wait = new Promise((resolve, reject) => {
16
- 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(true, result);
33
- assert.equal(null, null);
34
-
35
- result;
36
- });
37
-
38
- test('deepEqual true works', function (assert) {
39
- const me = { firstName: 'Izel', lastName: 'Nakri' };
40
-
41
- console.log('calling deepEqual test case');
42
- assert.deepEqual(me, { firstName: 'Izel', lastName: 'Nakri' });
43
- });
44
- });
@@ -1,44 +0,0 @@
1
- import { module, test } from 'qunitx';
2
-
3
- module('{{moduleName}} Passing 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(3);
14
-
15
- const wait = new Promise((resolve, reject) => {
16
- 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(true, result);
33
- assert.equal(null, null);
34
-
35
- result;
36
- });
37
-
38
- test('deepEqual true works', function (assert) {
39
- const me = { firstName: 'Izel', lastName: 'Nakri' };
40
-
41
- console.log('calling deepEqual test case');
42
- assert.deepEqual(me, { firstName: 'Izel', lastName: 'Nakri' });
43
- });
44
- });
@@ -1,37 +0,0 @@
1
- import { promisify } from 'node:util';
2
- import { exec } from 'node:child_process';
3
-
4
- const shell = promisify(exec);
5
-
6
- export default async function execute(commandString, { moduleName = '', testName = '' } = {}) {
7
- try {
8
- let result = await shell(commandString);
9
- let { stdout, stderr } = result;
10
-
11
- console.trace(`
12
- TEST NAME: ${moduleName} | ${testName}
13
- TEST COMMAND: ${commandString}
14
- ${stdout.split('\n').map((line, index) => `${index}: ${line}`).join('\n')}
15
- `);
16
-
17
- if (stderr && stderr !== '') {
18
- console.trace(`
19
- TEST NAME: ${moduleName} | ${testName}
20
- TEST COMMAND: ${commandString}
21
- ${stderr.split('\n').map((line, index) => `${index}: ${line}`).join('\n')}
22
- `);
23
- }
24
-
25
- return result;
26
- } catch (error) {
27
- console.trace(`
28
- ERROR TEST Name: ${moduleName} | ${testName}
29
- ERROR TEST COMMAND: ${commandString}
30
- ${error}
31
- `);
32
-
33
- throw error;;
34
- }
35
-
36
-
37
- }
package/test/index.js DELETED
@@ -1,22 +0,0 @@
1
- import "./setup.js";
2
- // import { tap } from 'node:test/reporters';
3
- // import { run } from 'node:test';
4
-
5
- // run({
6
- // concurrency: true,
7
- // files: [
8
- // "./test/commands/index.js",
9
- // "./test/flags/index.js",
10
- // "./test/inputs/index.js",
11
- // "./test/setup/index.js",
12
- // ],
13
- // // timeout: 20000
14
- // })
15
- // .compose(tap)
16
- // .pipe(process.stdout);
17
-
18
- import "./commands/index.js";
19
- import "./flags/index.js";
20
- import "./inputs/index.js";
21
- import "./setup/index.js";
22
-
@@ -1,21 +0,0 @@
1
- import { module, test } from 'qunitx';
2
-
3
- // runTestInsideHTMLFile
4
-
5
- module('Advanced HTML Input Tests', function() {
6
- test('testing with specific html without content works', async function(assert) {
7
- assert.equal(true, true);
8
- // const { stdout } = await shell('node cli.js test/helpers/index-without-content.html');
9
-
10
- // console.log(stdout);
11
-
12
- // assert.match(stdout, /Hello from index-without-content.html/);
13
- });
14
- });
15
-
16
- // html without content
17
- // html without content --browser --debug
18
- // html with content
19
- // html with content --browser --debug
20
- // multiple htmls
21
- // multiple htmls --browser --debug --output
@@ -1,11 +0,0 @@
1
- import { module, test } from 'qunitx';
2
-
3
- // TODO: invalid extension, use --debug without browser
4
- // folder/file doesnt exist to watch
5
- // unknown command
6
-
7
- module('Advanced Error Edge Cases Tests', function() {
8
- test('todo', async function(assert) {
9
- assert.ok(true);
10
- });
11
- });
@@ -1,11 +0,0 @@
1
- import { module, test } from 'qunitx';
2
-
3
- module('File and Folder Combination Tests', function() {
4
- test('todo', async function(assert) {
5
- assert.ok(true);
6
- });
7
- });
8
-
9
-
10
-
11
- // TODO: add file folder and multiple html
@@ -1,169 +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('File Input Tests', { concurrency: false }, (_hooks, moduleMetadata) => {
6
- // test('testing a single passing js file works', async (assert, testMetadata) => {
7
- // const { stdout } = await shell('node tmp/test/passing-tests.js', { ...moduleMetadata, ...testMetadata });
8
-
9
- // assertPassingTestCase(assert, stdout, { debug: true, testNo: 1, moduleName: '{{moduleName}}' });
10
- // assertTAPResult(assert, stdout, { testCount: 3 });
11
- // });
12
-
13
- // test('testing a single failing js file works', async (assert, testMetadata) => {
14
- // try {
15
- // await shell('node tmp/test/failing-tests.js', { ...moduleMetadata, ...testMetadata });
16
- // } catch(cmd) {
17
- // assert.ok(cmd.stdout.includes('TAP version 13'));
18
- // assert.ok(cmd.stdout.includes('calling assert true test case'));
19
- // assert.ok(new RegExp(`ok 1 {{moduleName}} | assert.ok works # (\d+ ms)`).test(cmd.stdout));
20
- // assert.ok(cmd.stdout.includes('resolving async test'));
21
- // assert.ok(cmd.stdout.includes(`{
22
- // moduleName: 'called resolved async test with object',
23
- // placeholder: 1000,
24
- // anotherObject: { firstName: 'Izel', createdAt: 2021-03-06T00:00:00.000Z }
25
- // }`));
26
- // assert.ok(new RegExp(`not ok 2 {{moduleName}} | async test finishes # (\d+ ms)␊
27
- // ---␊
28
- // name: 'Assertion #1'␊
29
- // actual: null␊
30
- // expected: null␊
31
- // message: 'Promise rejected during "async test finishes": wait is not a function'␊
32
- // stack: |-␊
33
- // TypeError: wait is not a function␊
34
- // at Object.<anonymous> (file://\w+/tmp/test/failing-tests.js:\d+:\d+)␊
35
- // at: '\w+/tmp/test/failing-tests.js:\d+:\d+'␊
36
- // ...␊
37
- // ---␊
38
- // name: 'Assertion #2'␊
39
- // actual: null␊
40
- // expected: null␊
41
- // message: 'Expected 4 assertions, but 1 were run'␊
42
- // stack: ' at Object.<anonymous> (file://\w+/tmp/test/failing-tests.js:\d+:\d+)'␊
43
- // at: '\w+/tmp/test/failing-tests.js:\d+:\d+'␊
44
- // ...`).test(cmd.stdout));
45
- // assert.ok(cmd.stdout.includes('calling deepEqual test case'));
46
- // assert.ok(new RegExp(`not ok 3 {{moduleName}} | runtime error output # (\d+ ms)
47
- // ---
48
- // name: 'Assertion #1'
49
- // actual: null
50
- // expected: true
51
- // message: null
52
- // stack: ' at Object.<anonymous> (file://\w+/tmp/test/failing-tests.js:\d+:\d+)'
53
- // at: '\w+/tmp/test/failing-tests.js:\d+:\d+'
54
- // ...
55
- // ---
56
- // name: 'Assertion #2'
57
- // actual: null
58
- // expected: null
59
- // message: >-
60
- // Died on test #2 at Object.<anonymous>
61
- // (file://\w+/tmp/test/failing-tests.js:\d+:\d+): Cannot
62
- // read property 'second' of undefined
63
- // stack: |-
64
- // TypeError: Cannot read property 'second' of undefined
65
- // at Object.<anonymous> (file://\w+/tmp/test/failing-tests.js:\d+:\d+)
66
- // at: '\w+/tmp/test/failing-tests.js:\d+:\d+'
67
- // ...
68
- // `).test(cmd.stdout));
69
- // assert.ok(new RegExp(`not ok 4 {{moduleName}} | deepEqual true works # (\d+ ms)␊
70
- // ---␊
71
- // name: 'Assertion #1'␊
72
- // actual:␊
73
- // firstName: Izel␊
74
- // lastName: Nakri␊
75
- // expected:␊
76
- // firstName: Isaac␊
77
- // lastName: Nakri␊
78
- // message: null␊
79
- // stack: ' at Object.<anonymous> (file://\w+/tmp/test/failing-tests.js:\d+:\d+)'␊
80
- // at: '\w+/tmp/test/failing-tests.js:\d+:\d+'␊
81
- // ...␊`).test(cmd.stdout));
82
- // assert.ok(cmd.stdout.includes('1..4'));
83
- // assert.ok(cmd.stdout.includes('# tests 4'));
84
- // assert.ok(cmd.stdout.includes('# pass 1'));
85
- // assert.ok(cmd.stdout.includes('# skip 0'));
86
- // assert.ok(cmd.stdout.includes('# fail 3'));
87
- // }
88
- // });
89
-
90
- // // test.skip('testing a single passing ts file works', async function() {
91
- // // });
92
-
93
- // // test.skip('testing a single failing ts file works', async function() {
94
- // // });
95
-
96
- test('testing a single passing js file with works, console output supressed', async (assert, testMetadata) => {
97
- const { stdout } = await shell('node cli.js tmp/test/passing-tests.js', { ...moduleMetadata, ...testMetadata });
98
-
99
- assertPassingTestCase(assert, stdout, { testNo: 1, moduleName: '{{moduleName}}' });
100
- assertTAPResult(assert, stdout, { testCount: 3 });
101
- });
102
-
103
- test('testing a single passing js file with --debug works', async (assert, testMetadata) => {
104
- const { stdout } = await shell('node cli.js tmp/test/passing-tests.js --debug', { ...moduleMetadata, ...testMetadata });
105
-
106
- assert.ok(new RegExp(/# QUnitX running: http\:\/\/localhost:\d+/).test(stdout));
107
- assert.ok(stdout.includes('TAP version 13'));
108
- assertPassingTestCase(assert, stdout, { debug: true, testNo: 1, moduleName: '{{moduleName}}' });
109
- assertTAPResult(assert, stdout, { testCount: 3 });
110
- });
111
-
112
- test('testing a single failing js file works', async (assert, testMetadata) => {
113
- try {
114
- let { stdout } = await shell('node cli.js tmp/test/failing-tests.js', { ...moduleMetadata, ...testMetadata });
115
- } catch(cmd) {
116
- assert.ok(cmd.stdout.includes('TAP version 13'));
117
- assertFailingTestCase(assert, cmd.stdout, { testNo: 1, moduleName: '{{moduleName}}' });
118
- assertTAPResult(assert, cmd.stdout, { testCount: 4, failCount: 3 });
119
- }
120
- });
121
-
122
- test('testing a single failing js file with --debug works', async (assert, testMetadata) => {
123
- try {
124
- await shell('node cli.js tmp/test/failing-tests.js --debug', { ...moduleMetadata, ...testMetadata });
125
- } catch(cmd) {
126
- assert.ok(cmd.stdout.includes('TAP version 13'));
127
- assertFailingTestCase(assert, cmd.stdout, { debug: true, testNo: 1, moduleName: '{{moduleName}}' });
128
- assertTAPResult(assert, cmd.stdout, { testCount: 4, failCount: 3 });
129
- }
130
- });
131
-
132
- test('testing a single passing ts file works, console output supressed', async (assert, testMetadata) => {
133
- const { stdout } = await shell('node cli.js tmp/test/passing-tests.ts', { ...moduleMetadata, ...testMetadata });
134
-
135
- assert.ok(stdout.includes('TAP version 13'));
136
- assertPassingTestCase(assert, stdout, { testNo: 1, moduleName: '{{moduleName}}' });
137
- assertTAPResult(assert, stdout, { testCount: 3 });
138
- });
139
-
140
- test('testing a single passing ts file with --debug works', async (assert, testMetadata) => {
141
- const { stdout } = await shell('node cli.js tmp/test/passing-tests.ts --debug', { ...moduleMetadata, ...testMetadata });
142
-
143
- assert.ok(new RegExp(/# QUnitX running: http\:\/\/localhost:\d+/).test(stdout));
144
- assert.ok(stdout.includes('TAP version 13'));
145
-
146
- assertPassingTestCase(assert, stdout, { debug: true, testNo: 1, moduleName: '{{moduleName}}' });
147
- assertTAPResult(assert, stdout, { testCount: 3 });
148
- });
149
-
150
- test('testing a single failing ts file works', async (assert, testMetadata) => {
151
- try {
152
- await shell('node cli.js tmp/test/failing-tests.ts', { ...moduleMetadata, ...testMetadata });
153
- } catch(cmd) {
154
- assert.ok(cmd.stdout.includes('TAP version 13'));
155
- assertPassingTestCase(assert, cmd.stdout, { testNo: 1, moduleName: '{{moduleName}}' });
156
- assertTAPResult(assert, cmd.stdout, { testCount: 4, failCount: 3 });
157
- }
158
- });
159
-
160
- test('testing a single failing ts file with --debug works', async (assert, testMetadata) => {
161
- try {
162
- await shell('node cli.js tmp/test/failing-tests.ts --debug', { ...moduleMetadata, ...testMetadata });
163
- } catch(cmd) {
164
- assert.ok(cmd.stdout.includes('TAP version 13'));
165
- assertPassingTestCase(assert, cmd.stdout, { debug: true, testNo: 1, moduleName: '{{moduleName}}' });
166
- assertTAPResult(assert, cmd.stdout, { testCount: 4, failCount: 3 });
167
- }
168
- });
169
- });
@@ -1,193 +0,0 @@
1
- import { module, test } from 'qunitx';
2
- import { writeTestFolder } from '../helpers/fs-writers.js';
3
- import { assertPassingTestCase, assertFailingTestCase, assertTAPResult } from '../helpers/assert-stdout.js';
4
- import shell from '../helpers/shell.js';
5
-
6
-
7
- module('Folder Input Tests', { concurrency: false }, (_hooks, moduleMetadata) => {
8
- // test('works for a single folder input with all passing tests', async (assert, testMetadata) => {
9
- // let folderName = await writeTestFolder({ addFailingTests: false, });
10
-
11
- // const { stdout } = await shell(`node cli.js tmp/${folderName}`, { ...moduleMetadata, ...testMetadata });
12
-
13
- // assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${folderName} | first-module-pass` });
14
- // assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${folderName} | second-module-pass` });
15
- // assertTAPResult(assert, stdout, { testCount: 6 });
16
- // });
17
-
18
- // test('works for a single folder input with few failing tests', async (assert, testMetadata) => {
19
- // let folderName = await writeTestFolder({ addFailingTests: true });
20
-
21
- // try {
22
- // await shell(`node cli.js tmp/${folderName}`, { ...moduleMetadata, ...testMetadata });
23
- // } catch (cmd) {
24
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | first-module-pass` });
25
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | second-module-pass` });
26
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | first-module-fail` });
27
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | second-module-fail` });
28
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | third-module-fail` });
29
- // assertTAPResult(assert, cmd.stdout, { testCount: 18, failCount: 9 });
30
- // }
31
- // });
32
-
33
- // test('works for a multiple folders input with all passing tests', async (assert, ...testMetadata) => {
34
- // let firstFolderName = await writeTestFolder({ addFailingTests: false, });
35
- // let secondFolderName = await writeTestFolder({ addFailingTests: false });
36
-
37
- // const { stdout } = await shell(`node cli.js tmp/${firstFolderName} tmp/${secondFolderName}`, { ...moduleMetadata, ...testMetadata });
38
-
39
- // assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${firstFolderName} | first-module-pass` });
40
- // assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${firstFolderName} | second-module-pass` });
41
- // assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${secondFolderName} | first-module-pass` });
42
- // assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${secondFolderName} | second-module-pass` });
43
- // assertTAPResult(assert, stdout, { testCount: 12 });
44
- // });
45
-
46
- // test('works for a multiple folders input with few failing tests', async (assert, ...testMetadata) => {
47
- // let firstFolderName = await writeTestFolder({ addFailingTests: true });
48
- // let secondFolderName = await writeTestFolder({ addFailingTests: false });
49
- // let thirdFolderName = await writeTestFolder({ addFailingTests: true });
50
-
51
- // try {
52
- // await shell(`node cli.js tmp/${firstFolderName} tmp/${secondFolderName}`, { ...moduleMetadata, ...testMetadata });
53
- // } catch (cmd) {
54
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | first-module-pass` });
55
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | second-module-pass` });
56
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | first-module-fail` });
57
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | second-module-fail` });
58
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | third-module-fail` });
59
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${secondFolderName} | first-module-pass` });
60
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${secondFolderName} | second-module-pass` });
61
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | first-module-pass` });
62
- // assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | second-module-pass` });
63
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | first-module-fail` });
64
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | second-module-fail` });
65
- // assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | third-module-fail` });
66
- // assertTAPResult(assert, cmd.stdout, { testCount: 24, failCount: 9 });
67
- // }
68
- // });
69
-
70
- test('works for a single folder input in browser mode with all passing tests', async (assert, testMetadata) => {
71
- let folderName = await writeTestFolder({ addFailingTests: false, });
72
-
73
- const { stdout } = await shell(`node cli.js tmp/${folderName}`, { ...moduleMetadata, ...testMetadata });
74
-
75
- assertPassingTestCase(assert, stdout, { debug: false, moduleName: `${folderName} | first-module-pass` });
76
- assertPassingTestCase(assert, stdout, { debug: false, moduleName: `${folderName} | second-module-pass` });
77
- assertTAPResult(assert, stdout, { testCount: 6 });
78
- });
79
-
80
- test('works for a single folder input in browser mode with few failing tests', async (assert, testMetadata) => {
81
- let folderName = await writeTestFolder({ addFailingTests: true });
82
-
83
- try {
84
- await shell(`node cli.js tmp/${folderName}`, { ...moduleMetadata, ...testMetadata });
85
- } catch (cmd) {
86
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${folderName} | first-module-pass` });
87
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${folderName} | second-module-pass` });
88
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${folderName} | first-module-fail` });
89
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${folderName} | second-module-fail` });
90
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${folderName} | third-module-fail` });
91
- assertTAPResult(assert, cmd.stdout, { testCount: 18, failCount: 9 });
92
- }
93
- });
94
-
95
- test('works for a multiple folders input in browser mode with all passing tests', async (assert, testMetadata) => {
96
- let firstFolderName = await writeTestFolder({ addFailingTests: false, });
97
- let secondFolderName = await writeTestFolder({ addFailingTests: false });
98
-
99
- const { stdout } = await shell(`node cli.js tmp/${firstFolderName} tmp/${secondFolderName}`, { ...moduleMetadata, ...testMetadata });
100
-
101
- assertPassingTestCase(assert, stdout, { debug: false, moduleName: `${firstFolderName} | first-module-pass` });
102
- assertPassingTestCase(assert, stdout, { debug: false, moduleName: `${firstFolderName} | second-module-pass` });
103
- assertPassingTestCase(assert, stdout, { debug: false, moduleName: `${secondFolderName} | first-module-pass` });
104
- assertPassingTestCase(assert, stdout, { debug: false, moduleName: `${secondFolderName} | second-module-pass` });
105
- assertTAPResult(assert, stdout, { testCount: 12 });
106
- });
107
-
108
- test('works for a multiple folders input in browser mode with few failing tests', async (assert, testMetadata) => {
109
- let firstFolderName = await writeTestFolder({ addFailingTests: true });
110
- let secondFolderName = await writeTestFolder({ addFailingTests: false });
111
- let thirdFolderName = await writeTestFolder({ addFailingTests: true });
112
-
113
- try {
114
- await shell(`node cli.js tmp/${firstFolderName} tmp/${secondFolderName}`, { ...moduleMetadata, ...testMetadata });
115
- } catch (cmd) {
116
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${firstFolderName} | first-module-pass` });
117
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${firstFolderName} | second-module-pass` });
118
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${firstFolderName} | first-module-fail` });
119
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${firstFolderName} | second-module-fail` });
120
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${firstFolderName} | third-module-fail` });
121
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${secondFolderName} | first-module-pass` });
122
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${secondFolderName} | second-module-pass` });
123
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${thirdFolderName} | first-module-pass` });
124
- assertPassingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${thirdFolderName} | second-module-pass` });
125
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${thirdFolderName} | first-module-fail` });
126
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${thirdFolderName} | second-module-fail` });
127
- assertFailingTestCase(assert, cmd.stdout, { debug: false, moduleName: `${thirdFolderName} | third-module-fail` });
128
- assertTAPResult(assert, cmd.stdout, { testCount: 24, failCount: 9 });
129
- }
130
- });
131
-
132
- test('works for a single folder input in browser mode with debug and all passing tests', async (assert, testMetadata) => {
133
- let folderName = await writeTestFolder({ addFailingTests: false, });
134
-
135
- const { stdout } = await shell(`node cli.js tmp/${folderName} --debug`, { ...moduleMetadata, ...testMetadata });
136
-
137
- assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${folderName} | first-module-pass` });
138
- assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${folderName} | second-module-pass` });
139
- assertTAPResult(assert, stdout, { testCount: 6 });
140
- });
141
-
142
- test('works for a single folder input in browser mode with debug and few failing tests', async (assert, testMetadata) => {
143
- let folderName = await writeTestFolder({ addFailingTests: true });
144
-
145
- try {
146
- await shell(`node cli.js tmp/${folderName} --debug`, { ...moduleMetadata, ...testMetadata });
147
- } catch (cmd) {
148
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | first-module-pass` });
149
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | second-module-pass` });
150
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | first-module-fail` });
151
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | second-module-fail` });
152
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${folderName} | third-module-fail` });
153
- assertTAPResult(assert, cmd.stdout, { testCount: 18, failCount: 9 });
154
- }
155
- });
156
-
157
- test('works for a multiple folders input in browser mode with debug and all passing tests', async (assert, testMetadata) => {
158
- let firstFolderName = await writeTestFolder({ addFailingTests: false, });
159
- let secondFolderName = await writeTestFolder({ addFailingTests: false });
160
-
161
- const { stdout } = await shell(`node cli.js tmp/${firstFolderName} tmp/${secondFolderName} --debug`, { ...moduleMetadata, ...testMetadata });
162
-
163
- assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${firstFolderName} | first-module-pass` });
164
- assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${firstFolderName} | second-module-pass` });
165
- assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${secondFolderName} | first-module-pass` });
166
- assertPassingTestCase(assert, stdout, { debug: true, moduleName: `${secondFolderName} | second-module-pass` });
167
- assertTAPResult(assert, stdout, { testCount: 12 });
168
- });
169
-
170
- test('works for a multiple folders input in browser mode with debug and few failing tests', async (assert, testMetadata) => {
171
- let firstFolderName = await writeTestFolder({ addFailingTests: true });
172
- let secondFolderName = await writeTestFolder({ addFailingTests: false });
173
- let thirdFolderName = await writeTestFolder({ addFailingTests: true });
174
-
175
- try {
176
- await shell(`node cli.js tmp/${firstFolderName} tmp/${secondFolderName} --debug`, { ...moduleMetadata, ...testMetadata });
177
- } catch (cmd) {
178
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | first-module-pass` });
179
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | second-module-pass` });
180
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | first-module-fail` });
181
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | second-module-fail` });
182
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${firstFolderName} | third-module-fail` });
183
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${secondFolderName} | first-module-pass` });
184
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${secondFolderName} | second-module-pass` });
185
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | first-module-pass` });
186
- assertPassingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | second-module-pass` });
187
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | first-module-fail` });
188
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | second-module-fail` });
189
- assertFailingTestCase(assert, cmd.stdout, { debug: true, moduleName: `${thirdFolderName} | third-module-fail` });
190
- assertTAPResult(assert, cmd.stdout, { testCount: 24, failCount: 9 });
191
- }
192
- });
193
- });
@@ -1,5 +0,0 @@
1
- import "./advanced-htmls-test.js";
2
- import "./error-edge-cases-test.js";
3
- import "./file-and-folder-test.js";
4
- import "./file-test.js";
5
- import "./folder-test.js";
@@ -1 +0,0 @@
1
- import "./test-file-paths-test.js";
@@ -1,33 +0,0 @@
1
- import { module, test } from 'qunitx';
2
- import setupTestFilePaths from '../../lib/setup/test-file-paths.js';
3
-
4
- module('Setup | glob(*) input tests | test-file-paths tests', () => {
5
- test('setupTestFilePaths() works correctly on different inputs', (assert) => {
6
- let projectRoot = '/home/izelnakri/Github/qunitx';
7
-
8
- assert.deepEqual(setupTestFilePaths(projectRoot, [
9
- `${projectRoot}/tmp`,
10
- `${projectRoot}/tmp/vendor`,
11
- `${projectRoot}/another/first/*`,
12
- `${projectRoot}/another/first/something/helpers`,
13
- `${projectRoot}/tmp/build-*`,
14
- `${projectRoot}/vendor`,
15
- `${projectRoot}/vendor-*`,
16
- `${projectRoot}/vendor-*/files`,
17
- `${projectRoot}/tests/**/something/*-test.ts`,
18
- `${projectRoot}/tests/**/*.ts`,
19
- `${projectRoot}/assets/something-test.ts`,
20
- `${projectRoot}/assets/*-test.js`,
21
- `${projectRoot}/tmp/build-*/*-test.ts`,
22
- `${projectRoot}/vendor/*-test.js`,
23
- ]), [
24
- `${projectRoot}/tmp`,
25
- `${projectRoot}/another/first/*`,
26
- `${projectRoot}/vendor`,
27
- `${projectRoot}/vendor-*`,
28
- `${projectRoot}/tests/**/*.ts`,
29
- `${projectRoot}/assets/*-test.js`,
30
- `${projectRoot}/assets/something-test.ts`,
31
- ]);
32
- });
33
- });
package/test/setup.js DELETED
@@ -1,17 +0,0 @@
1
- import fs from 'node:fs/promises';
2
-
3
- process.env['FORCE_COLOR'] = 0;
4
-
5
- await fs.rm('./tmp', { recursive: true, force: true });
6
- await fs.mkdir('./tmp/test', { recursive: true });
7
- let [failingTestContent, passingTestContent] = await Promise.all([
8
- fs.readFile('./test/helpers/failing-tests.js'),
9
- fs.readFile('./test/helpers/passing-tests.js'),
10
- ]);
11
-
12
- await Promise.all([
13
- fs.writeFile('./tmp/test/failing-tests.js', failingTestContent.toString()),
14
- fs.writeFile('./tmp/test/failing-tests.ts', failingTestContent.toString()),
15
- fs.writeFile('./tmp/test/passing-tests.js', passingTestContent.toString()),
16
- fs.writeFile('./tmp/test/passing-tests.ts', passingTestContent.toString())
17
- ]);