Repository navigation
Conversation
TestContext exposes tags and workerId, but SuiteContext does not, so a describe() callback cannot read the suite's tags, including the ones inherited from ancestor suites. Expose both on SuiteContext as well. Signed-off-by: sangwook <rewq5991@gmail.com>
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67312 +/- ##
==========================================
- Coverage 93.00% 90.72% -2.29%
==========================================
Files 428 798 +370
Lines 195818 280026 +84208
Branches 30283 53858 +23575
==========================================
+ Hits 182117 254044 +71927
- Misses 13375 16282 +2907
- Partials 326 9700 +9374
🚀 New features to boost your workflow:
|
| test('suite context exposes inherited tags', () => { | ||
| describe('outer', { tags: ['a'] }, () => { | ||
| describe('mid', { tags: ['b'] }, (s) => { | ||
| assert.deepStrictEqual(s.tags, ['a', 'b']); |
There was a problem hiding this comment.
Maybe also worth:
| assert.deepStrictEqual(s.tags, ['a', 'b']); | |
| assert.deepStrictEqual(s.tags, ['a', 'b']); | |
| s.test('child tags does not override suite tags', { tags: ['c'] }, (t) => { | |
| assert.notStrictEqual(s.tags, t.tags); | |
| }); |
There was a problem hiding this comment.
@Han5991 I meant explicitly checking within a test that the suite's context doesn't get changed by the test.
So not just checking t.context, but also checking the s.context is not including c
There was a problem hiding this comment.
Updated — the suite's tags are now checked inside the child test, as a separate test case. I didn't apply the suggestion as-is because SuiteContext has no test(), and notStrictEqual always passes here since the two arrays are different objects.
Signed-off-by: sangwook <rewq5991@gmail.com>
Signed-off-by: sangwook <rewq5991@gmail.com>
TestContextexposestagsandworkerId, butSuiteContextdoesn't, so adescribe()callback can't read the suite's tags, including inherited ones.This adds both to
SuiteContext, like #62504 did forpassed,attemptanddiagnostic().Disclosure: I used a coding agent to help investigate and draft this change. I confirmed the missing properties on a main build, reviewed the change, and verified that the new tests fail without it.