Skip to content
Merged
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
additional tests
  • Loading branch information
cjihrig committed Mar 16, 2024
commit 14e3f9f5637d3f9444bd5eaad1abb127043b0094
76 changes: 76 additions & 0 deletions test/fixtures/test-runner/output/suite-skip-hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Flags: --test-reporter=spec
'use strict';
const {
after,
afterEach,
before,
beforeEach,
describe,
it,
} = require('node:test');

// before(() => {
// console.log('BEFORE');
// });

// beforeEach(() => {
// console.log('BEFORE EACH');
// });

// after(() => {
// console.log('AFTER');
// });

// afterEach(() => {
// console.log('AFTER EACH');
// });

Comment thread
cjihrig marked this conversation as resolved.
Resolved
describe('skip all hooks in this suite', { skip: true }, () => {
before(() => {
console.log('BEFORE 1');
});

beforeEach(() => {
console.log('BEFORE EACH 1');
});

after(() => {
console.log('AFTER 1');
});

afterEach(() => {
console.log('AFTER EACH 1');
});

it('should not run');
});

describe('suite runs with mixture of skipped tests', () => {
before(() => {
console.log('BEFORE 2');
});

beforeEach(() => {
console.log('BEFORE EACH 2');
});

after(() => {
console.log('AFTER 2');
});

afterEach(() => {
console.log('AFTER EACH 2');
});

it('should not run', { skip: true });

it('should run 1', () => {
console.log('should run 1');
});

it('should not run', { skip: true });

it('should run 2', () => {
console.log('should run 2');
});
});
24 changes: 24 additions & 0 deletions test/fixtures/test-runner/output/suite-skip-hooks.snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BEFORE 2
BEFORE EACH 2
should run 1
AFTER EACH 2
BEFORE EACH 2
should run 2
AFTER EACH 2
AFTER 2
﹣ skip all hooks in this suite (*ms) # SKIP
▶ suite runs with mixture of skipped tests
﹣ should not run (*ms) # SKIP
✔ should run 1 (*ms)
﹣ should not run (*ms) # SKIP
✔ should run 2 (*ms)
▶ suite runs with mixture of skipped tests (*ms)

ℹ tests 4
ℹ suites 2
ℹ pass 2
ℹ fail 0
ℹ cancelled 0
ℹ skipped 2
ℹ todo 0
ℹ duration_ms *
1 change: 1 addition & 0 deletions test/parallel/test-runner-output.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const tests = [
{ name: 'test-runner/output/hooks.js' },
{ name: 'test-runner/output/hooks_spec_reporter.js', transform: specTransform },
{ name: 'test-runner/output/skip-each-hooks.js', transform: specTransform },
{ name: 'test-runner/output/suite-skip-hooks.js', transform: specTransform },
{ name: 'test-runner/output/timeout_in_before_each_should_not_affect_further_tests.js' },
{ name: 'test-runner/output/hooks-with-no-global-test.js' },
{ name: 'test-runner/output/global-hooks-with-no-tests.js' },
Expand Down