Skip to content

Commit

Permalink
more tests more better
Browse files Browse the repository at this point in the history
  • Loading branch information
cjihrig committed Oct 2, 2022
1 parent 20e8cf5 commit 2ae9559
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
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 *

0 comments on commit 2ae9559

Please sign in to comment.