Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more tests more better
  • Loading branch information
cjihrig committed Oct 2, 2022
commit 2ae9559efc66e949cb69ea9f5224bb3966f0d20e
13 changes: 13 additions & 0 deletions test/message/test_runner_test_name_pattern_with_only.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Flags: --no-warnings --test-only --test-name-pattern=enabled
'use strict';
const common = require('../common');
const { test } = require('node:test');

test('enabled and only', { only: true }, common.mustCall(async (t) => {
await t.test('enabled', common.mustCall());
await t.test('disabled', common.mustNotCall());
}));

test('enabled but not only', common.mustNotCall());
test('only does not match pattern', { only: true }, common.mustNotCall());
test('not only and does not match pattern', common.mustNotCall());
40 changes: 40 additions & 0 deletions test/message/test_runner_test_name_pattern_with_only.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
TAP version 13
# Subtest: enabled and only
# Subtest: enabled
ok 1 - enabled
---
duration_ms: *
...
# Subtest: disabled
ok 2 - disabled # SKIP test name does not match pattern
---
duration_ms: *
...
1..2
ok 1 - enabled and only
---
duration_ms: *
...
# Subtest: enabled but not only
ok 2 - enabled but not only # SKIP 'only' option not set
---
duration_ms: *
...
# Subtest: only does not match pattern
ok 3 - only does not match pattern # SKIP test name does not match pattern
---
duration_ms: *
...
# Subtest: not only and does not match pattern
ok 4 - not only and does not match pattern # SKIP 'only' option not set
---
duration_ms: *
...
1..4
# tests 4
# pass 1
# fail 0
# cancelled 0
# skipped 3
# todo 0
# duration_ms *