|
| 1 | +// Flags: --no-warnings --test-name-pattern=enabled --test-name-pattern=/pattern/i |
| 2 | +'use strict'; |
| 3 | +const common = require('../common'); |
| 4 | +const { |
| 5 | + after, |
| 6 | + afterEach, |
| 7 | + before, |
| 8 | + beforeEach, |
| 9 | + describe, |
| 10 | + it, |
| 11 | + test, |
| 12 | +} = require('node:test'); |
| 13 | + |
| 14 | +test('top level test disabled', common.mustNotCall()); |
| 15 | +test('top level skipped test disabled', { skip: true }, common.mustNotCall()); |
| 16 | +test('top level skipped test enabled', { skip: true }, common.mustNotCall()); |
| 17 | +it('top level it enabled', common.mustCall()); |
| 18 | +it('top level it disabled', common.mustNotCall()); |
| 19 | +it.skip('top level skipped it disabled', common.mustNotCall()); |
| 20 | +it.skip('top level skipped it enabled', common.mustNotCall()); |
| 21 | +describe('top level describe disabled', common.mustNotCall()); |
| 22 | +describe.skip('top level skipped describe disabled', common.mustNotCall()); |
| 23 | +describe.skip('top level skipped describe enabled', common.mustNotCall()); |
| 24 | +test('top level runs because name includes PaTtErN', common.mustCall()); |
| 25 | + |
| 26 | +test('top level test enabled', common.mustCall(async (t) => { |
| 27 | + t.beforeEach(common.mustCall()); |
| 28 | + t.afterEach(common.mustCall()); |
| 29 | + await t.test( |
| 30 | + 'nested test runs because name includes PATTERN', |
| 31 | + common.mustCall() |
| 32 | + ); |
| 33 | +})); |
| 34 | + |
| 35 | +describe('top level describe enabled', () => { |
| 36 | + before(common.mustCall()); |
| 37 | + beforeEach(common.mustCall(4)); |
| 38 | + afterEach(common.mustCall(4)); |
| 39 | + after(common.mustCall()); |
| 40 | + |
| 41 | + it('nested it disabled', common.mustNotCall()); |
| 42 | + it('nested it enabled', common.mustCall()); |
| 43 | + describe('nested describe disabled', common.mustNotCall()); |
| 44 | + describe('nested describe enabled', common.mustCall(() => { |
| 45 | + it('is enabled', common.mustCall()); |
| 46 | + })); |
| 47 | +}); |
0 commit comments