|
1 | 1 | // Flags: --no-warnings --test-only |
2 | 2 | 'use strict'; |
3 | 3 | require('../common'); |
4 | | -consttest=require('node:test'); |
| 4 | +const{test, describe, it }=require('node:test'); |
5 | 5 |
|
6 | 6 | // These tests should be skipped based on the 'only' option. |
7 | 7 | test('only = undefined'); |
@@ -46,3 +46,37 @@ test('only = true, with subtests', { only: true }, async (t) => { |
46 | 46 | awaitt.test('skipped subtest 3',{only: false}); |
47 | 47 | awaitt.test('skipped subtest 4',{skip: true}); |
48 | 48 | }); |
| 49 | + |
| 50 | +describe.only('describe only = true, with subtests',()=>{ |
| 51 | +it('`it` subtest 1 should run',()=>{}); |
| 52 | + |
| 53 | +it('`it` subtest 2 should run',async()=>{}); |
| 54 | +}); |
| 55 | + |
| 56 | +describe.only('describe only = true, with a mixture of subtests',()=>{ |
| 57 | +it.only('`it` subtest 1',()=>{}); |
| 58 | + |
| 59 | +it.only('`it` async subtest 1',async()=>{}); |
| 60 | + |
| 61 | +it('`it` subtest 2 only=true',{only: true}); |
| 62 | + |
| 63 | +it('`it` subtest 2 only=false',{only: false},()=>{ |
| 64 | +thrownewError('This should not run'); |
| 65 | +}); |
| 66 | + |
| 67 | +it.skip('`it` subtest 3 skip',()=>{ |
| 68 | +thrownewError('This should not run'); |
| 69 | +}); |
| 70 | + |
| 71 | +it.todo('`it` subtest 4 todo',{only: false},()=>{ |
| 72 | +thrownewError('This should not run'); |
| 73 | +}); |
| 74 | +}); |
| 75 | + |
| 76 | +describe.only('describe only = true, with subtests',()=>{ |
| 77 | +test('subtest should run',()=>{}); |
| 78 | + |
| 79 | +test('async subtest should run',async()=>{}); |
| 80 | + |
| 81 | +test('subtest should be skipped',{only: false},()=>{}); |
| 82 | +}); |
0 commit comments