1// Flags: --test-name-pattern=enabled --test-name-pattern=yes --test-name-pattern=/pattern/i 2'use strict'; 3const common = require('../../../common'); 4const { 5 after, 6 afterEach, 7 before, 8 beforeEach, 9 describe, 10 it, 11 test, 12} = require('node:test'); 13 14test('top level test disabled', common.mustNotCall()); 15test('top level skipped test disabled', { skip: true }, common.mustNotCall()); 16test('top level skipped test enabled', { skip: true }, common.mustNotCall()); 17it('top level it enabled', common.mustCall()); 18it('top level it disabled', common.mustNotCall()); 19it.skip('top level skipped it disabled', common.mustNotCall()); 20it.skip('top level skipped it enabled', common.mustNotCall()); 21describe('top level describe never disabled', common.mustCall()); 22describe.skip('top level skipped describe disabled', common.mustNotCall()); 23describe.skip('top level skipped describe enabled', common.mustNotCall()); 24test('top level runs because name includes PaTtErN', common.mustCall()); 25 26test('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 35describe('top level describe enabled', () => { 36 before(common.mustCall()); 37 beforeEach(common.mustCall(3)); 38 afterEach(common.mustCall(3)); 39 after(common.mustCall()); 40 41 it('nested it not disabled', common.mustCall()); 42 it('nested it enabled', common.mustCall()); 43 describe('nested describe not disabled', common.mustCall()); 44 describe('nested describe enabled', common.mustCall(() => { 45 it('is enabled', common.mustCall()); 46 })); 47}); 48 49describe('yes', function() { 50 it('no', () => {}); 51 it('yes', () => {}); 52 53 describe('maybe', function() { 54 it('no', () => {}); 55 it('yes', () => {}); 56 }); 57}); 58 59describe('no', function() { 60 it('no', () => {}); 61 it('yes', () => {}); 62 63 describe('maybe', function() { 64 it('no', () => {}); 65 it('yes', () => {}); 66 }); 67}); 68