Skip to content

Commit

Permalink
Test: Enable more CLI tests on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed Apr 22, 2024
1 parent 2a7eea1 commit 75b53ff
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 182 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ jobs:
node: 16.x
script: npm run test-nolint

# use macos-12 instead of macos-latest
# as proxy for Intel instead of ARM
# because the older Puppeteer/Chromr for Node 10 compat
# didn't support ARM yet.
- name: "macOS: Node 16"
os: macos-latest
os: macos-12
node: 16.x
script: npm run test-nolint

Expand Down
171 changes: 3 additions & 168 deletions test/cli/cli-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,10 @@ QUnit.module('CLI Main', () => {
concurrentMapKeys(readFixtures(FIXTURES_DIR), 0, (runFixture) => runFixture()),
async (assert, fixture) => {
const result = await fixture;
assert.equal(result.snapshot, result.expected);
assert.equal(result.snapshot, result.expected, result.name);
}
);

// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[skipOnWinTest]('report assert.throws() failures properly', async assert => {
const command = ['qunit', 'assert-throws-failure.js'];
const execution = await execute(command);
assert.equal(execution.snapshot, `TAP version 13
not ok 1 Throws match > bad
---
message: match error
severity: failed
actual : Error: Match me with a pattern
expected: "/incorrect pattern/"
stack: |
at /qunit/test/cli/fixtures/assert-throws-failure.js:3:12
...
1..1
# pass 0
# skip 0
# todo 0
# fail 1
# exit code: 1`);
});

QUnit.test('callbacks', async assert => {
const expected = `CALLBACK: begin1
CALLBACK: begin2
Expand Down Expand Up @@ -237,8 +214,7 @@ ok 1 ESM test suite > sum()

// https://nodejs.org/dist/v12.12.0/docs/api/cli.html#cli_enable_source_maps
if (semver.gte(process.versions.node, '14.0.0')) {
// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[skipOnWinTest]('normal trace with native source map', async assert => {
QUnit.test('normal trace with native source map', async assert => {
const command = ['qunit', 'sourcemap/source.js'];
const execution = await execute(command);

Expand All @@ -264,9 +240,7 @@ not ok 2 Example > bad

// skip if running in code coverage mode,
// as that leads to conflicting maps-on-maps that invalidate this test
//
// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[process.env.NYC_PROCESS_ID ? 'skip' : skipOnWinTest](
QUnit[process.env.NYC_PROCESS_ID ? 'skip' : 'test'](
'mapped trace with native source map', async function (assert) {
const command = ['qunit', 'sourcemap/source.min.js'];
const execution = await execute(command, {
Expand Down Expand Up @@ -397,143 +371,4 @@ not ok 1 global failure
actual: execution.stdout + '\n' + execution.stderr
});
});

// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[skipOnWinTest]('assert.async() handled after fail in other test', async assert => {
const command = ['qunit', 'drooling-done.js'];
const execution = await execute(command);

assert.equal(execution.snapshot, `TAP version 13
not ok 1 Test A
---
message: |+
Died on test #2: this is an intentional error
at /qunit/test/cli/fixtures/drooling-done.js:5:7
at internal
severity: failed
actual : null
expected: undefined
stack: |
Error: this is an intentional error
at /qunit/test/cli/fixtures/drooling-done.js:8:9
...
ok 2 Test B
1..2
# pass 1
# skip 0
# todo 0
# fail 1
# exit code: 1`);
});

// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[skipOnWinTest]('assert.async() handled again in other test', async assert => {
const command = ['qunit', 'drooling-extra-done.js'];
const execution = await execute(command);

assert.equal(execution.snapshot, `TAP version 13
ok 1 Test A
not ok 2 Test B
---
message: |+
Died on test #2: Unexpected release of async pause during a different test.
> Test: Test A [async #1]
at /qunit/test/cli/fixtures/drooling-extra-done.js:13:7
at internal
severity: failed
actual : null
expected: undefined
stack: |
Error: Unexpected release of async pause during a different test.
> Test: Test A [async #1]
...
1..2
# pass 1
# skip 0
# todo 0
# fail 1
# exit code: 1`);
});

// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[skipOnWinTest]('assert.async() handled too often', async assert => {
const command = ['qunit', 'too-many-done-calls.js'];
const execution = await execute(command);

assert.equal(execution.snapshot, `TAP version 13
not ok 1 Test A
---
message: |+
Died on test #2: Tried to release async pause that was already released.
> Test: Test A [async #1]
at /qunit/test/cli/fixtures/too-many-done-calls.js:1:7
at internal
severity: failed
actual : null
expected: undefined
stack: |
Error: Tried to release async pause that was already released.
> Test: Test A [async #1]
...
1..1
# pass 0
# skip 0
# todo 0
# fail 1
# exit code: 1`);
});

// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[skipOnWinTest]('module.only() nested', async assert => {
const command = ['qunit', 'only-module.js'];
const execution = await execute(command);

assert.equal(execution.snapshot, `TAP version 13
not ok 1 # TODO module B > Only this module should run > a todo test
---
message: not implemented yet
severity: todo
actual : false
expected: true
stack: |
at /qunit/test/cli/fixtures/only-module.js:17:18
...
ok 2 # SKIP module B > Only this module should run > implicitly skipped test
ok 3 module B > Only this module should run > normal test
ok 4 module D > test D
ok 5 module E > module F > test F
ok 6 module E > test E
1..8
# pass 6
# skip 1
# todo 1
# fail 0`);
});

// TODO: Figure out why trace isn't trimmed on Windows. https://github.com/qunitjs/qunit/issues/1359
QUnit[skipOnWinTest]('module.only() flat', async assert => {
const command = ['qunit', 'only-module-flat.js'];
const execution = await execute(command);

assert.equal(execution.snapshot, `TAP version 13
not ok 1 # TODO module B > test B
---
message: not implemented yet
severity: todo
actual : false
expected: true
stack: |
at /qunit/test/cli/fixtures/only-module-flat.js:8:14
...
ok 2 # SKIP module B > test C
ok 3 module B > test D
1..4
# pass 2
# skip 1
# todo 1
# fail 0`);
});
});
20 changes: 20 additions & 0 deletions test/cli/fixtures/assert-throws-failure.tap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# name: report assert.throws() failures properly
# command: ["qunit", "assert-throws-failure.js"]

TAP version 13
not ok 1 Throws match > bad
---
message: match error
severity: failed
actual : Error: Match me with a pattern
expected: "/incorrect pattern/"
stack: |
at /qunit/test/cli/fixtures/assert-throws-failure.js:3:12
...
1..1
# pass 0
# skip 0
# todo 0
# fail 1

# exit code: 1
26 changes: 26 additions & 0 deletions test/cli/fixtures/drooling-done.tap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# name: assert.async() handled after fail in other test
# command: ["qunit", "drooling-done.js"]

TAP version 13
not ok 1 Test A
---
message: |+
Died on test #2: this is an intentional error
at /qunit/test/cli/fixtures/drooling-done.js:5:7
at internal
severity: failed
actual : null
expected: undefined
stack: |
Error: this is an intentional error
at /qunit/test/cli/fixtures/drooling-done.js:8:9
...
ok 2 Test B
1..2
# pass 1
# skip 0
# todo 0
# fail 1

# exit code: 1

26 changes: 26 additions & 0 deletions test/cli/fixtures/drooling-extra-done.tap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# name: assert.async() handled again in other test
# command: ["qunit", "drooling-extra-done.js"]

TAP version 13
ok 1 Test A
not ok 2 Test B
---
message: |+
Died on test #2: Unexpected release of async pause during a different test.
> Test: Test A [async #1]
at /qunit/test/cli/fixtures/drooling-extra-done.js:13:7
at internal
severity: failed
actual : null
expected: undefined
stack: |
Error: Unexpected release of async pause during a different test.
> Test: Test A [async #1]
...
1..2
# pass 1
# skip 0
# todo 0
# fail 1

# exit code: 1
2 changes: 1 addition & 1 deletion test/cli/fixtures/filter-modulename-insensitive.tap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ ok 1 Second > 1
# pass 1
# skip 0
# todo 0
# fail 0
# fail 0
19 changes: 19 additions & 0 deletions test/cli/fixtures/only-module-flat.tap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# command: ["qunit", "only-module-flat.js"]

TAP version 13
not ok 1 # TODO module B > test B
---
message: not implemented yet
severity: todo
actual : false
expected: true
stack: |
at /qunit/test/cli/fixtures/only-module-flat.js:8:14
...
ok 2 # SKIP module B > test C
ok 3 module B > test D
1..4
# pass 2
# skip 1
# todo 1
# fail 0
23 changes: 23 additions & 0 deletions test/cli/fixtures/only-module.tap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# name: module.only() nested
# command: ["qunit", "only-module.js"]

TAP version 13
not ok 1 # TODO module B > Only this module should run > a todo test
---
message: not implemented yet
severity: todo
actual : false
expected: true
stack: |
at /qunit/test/cli/fixtures/only-module.js:17:18
...
ok 2 # SKIP module B > Only this module should run > implicitly skipped test
ok 3 module B > Only this module should run > normal test
ok 4 module D > test D
ok 5 module E > module F > test F
ok 6 module E > test E
1..8
# pass 6
# skip 1
# todo 1
# fail 0
25 changes: 25 additions & 0 deletions test/cli/fixtures/too-many-done-calls.tap.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# name: assert.async() handled too often
# command: ["qunit", "too-many-done-calls.js"]

TAP version 13
not ok 1 Test A
---
message: |+
Died on test #2: Tried to release async pause that was already released.
> Test: Test A [async #1]
at /qunit/test/cli/fixtures/too-many-done-calls.js:1:7
at internal
severity: failed
actual : null
expected: undefined
stack: |
Error: Tried to release async pause that was already released.
> Test: Test A [async #1]
...
1..1
# pass 0
# skip 0
# todo 0
# fail 1

# exit code: 1
Loading

0 comments on commit 75b53ff

Please sign in to comment.