eslint-plugin-traceability 1.16.0 → 1.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,9 @@
1
- # [1.16.0](https://github.com/voder-ai/eslint-plugin-traceability/compare/v1.15.0...v1.16.0) (2025-12-09)
1
+ ## [1.16.1](https://github.com/voder-ai/eslint-plugin-traceability/compare/v1.16.0...v1.16.1) (2025-12-09)
2
2
 
3
3
 
4
- ### Features
4
+ ### Bug Fixes
5
5
 
6
- * add excludeTestCallbacks option for test framework callbacks ([108510d](https://github.com/voder-ai/eslint-plugin-traceability/commit/108510d361f45c9ff75118ee266970dcbabd3fb8))
6
+ * broaden test callback exclusion coverage for function annotations ([8078745](https://github.com/voder-ai/eslint-plugin-traceability/commit/80787455dcba39724158f378fce54ae78a75b59b))
7
7
 
8
8
  # Changelog
9
9
 
@@ -29,15 +29,30 @@ Object.defineProperty(exports, "STORY_PATH", { enumerable: true, get: function (
29
29
  * @req REQ-TEST-CALLBACK-EXCLUSION
30
30
  */
31
31
  const TEST_FUNCTION_NAMES = new Set([
32
+ // Core test/describe-style functions (Jest, Mocha, Vitest share many of these)
32
33
  "it",
33
34
  "test",
34
35
  "describe",
36
+ "suite",
37
+ // Focused variants
35
38
  "fit",
36
- "xit",
37
39
  "ftest",
38
- "xtest",
39
40
  "fdescribe",
41
+ "fsuite",
42
+ // Skipped variants
43
+ "xit",
44
+ "xtest",
40
45
  "xdescribe",
46
+ "xsuite",
47
+ // Additional common aliases
48
+ "context",
49
+ "specify",
50
+ "before",
51
+ "after",
52
+ "beforeEach",
53
+ "afterEach",
54
+ "beforeAll",
55
+ "afterAll",
41
56
  ]);
42
57
  const TEST_FUNCTION_CONCURRENT_PROP = "concurrent";
43
58
  /** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */
@@ -113,7 +128,10 @@ function isEffectivelyAnonymousFunction(node) {
113
128
  * framework function (Jest, Mocha, Vitest, etc).
114
129
  *
115
130
  * Supports:
116
- * - it(), test(), describe(), fit(), xit(), ftest(), xtest(), fdescribe(), xdescribe()
131
+ * - it(), test(), describe(), suite(), context(), specify()
132
+ * - lifecycle hooks: before(), after(), beforeEach(), afterEach(), beforeAll(), afterAll()
133
+ * - focused variants: fit(), ftest(), fdescribe(), fsuite()
134
+ * - skipped variants and helpers: xit(), xtest(), xdescribe(), xsuite()
117
135
  * - their .concurrent variants (e.g., it.concurrent(), test.concurrent())
118
136
  *
119
137
  * @req REQ-TEST-CALLBACK-EXCLUSION
@@ -72,6 +72,32 @@ declare function tsDecl(): void;`,
72
72
  */
73
73
  describe('Feature X', () => {
74
74
  it('does something', () => {});
75
+ });
76
+
77
+ // Mocha-style suite/context/specify examples
78
+ suite('Mocha suite', () => {
79
+ beforeEach(() => {});
80
+ afterEach(() => {});
81
+ before(() => {});
82
+ after(() => {});
83
+
84
+ test('Mocha test', () => {});
85
+ specify('Mocha specify', () => {});
86
+ context('Mocha context', () => {
87
+ it('nested it', () => {});
88
+ });
89
+ });
90
+
91
+ // Vitest-style APIs including hooks and bench
92
+ describe('Vitest suite', () => {
93
+ beforeEach(() => {});
94
+ afterEach(() => {});
95
+ beforeAll(() => {});
96
+ afterAll(() => {});
97
+
98
+ it('Vitest it', () => {});
99
+ test('Vitest test', () => {});
100
+ bench('Vitest bench', () => {});
75
101
  });`,
76
102
  },
77
103
  ],
@@ -192,6 +192,94 @@ describe("Require Story Helpers (Story 003.0)", () => {
192
192
  const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
193
193
  expect(result).toBeFalsy();
194
194
  });
195
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as beforeEach callback is excluded by default", () => {
196
+ const node = {
197
+ type: "ArrowFunctionExpression",
198
+ parent: {
199
+ type: "CallExpression",
200
+ callee: { type: "Identifier", name: "beforeEach" },
201
+ },
202
+ };
203
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
204
+ expect(result).toBeFalsy();
205
+ });
206
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as afterEach callback is excluded by default", () => {
207
+ const node = {
208
+ type: "ArrowFunctionExpression",
209
+ parent: {
210
+ type: "CallExpression",
211
+ callee: { type: "Identifier", name: "afterEach" },
212
+ },
213
+ };
214
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
215
+ expect(result).toBeFalsy();
216
+ });
217
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as beforeAll callback is excluded by default", () => {
218
+ const node = {
219
+ type: "ArrowFunctionExpression",
220
+ parent: {
221
+ type: "CallExpression",
222
+ callee: { type: "Identifier", name: "beforeAll" },
223
+ },
224
+ };
225
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
226
+ expect(result).toBeFalsy();
227
+ });
228
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as afterAll callback is excluded by default", () => {
229
+ const node = {
230
+ type: "ArrowFunctionExpression",
231
+ parent: {
232
+ type: "CallExpression",
233
+ callee: { type: "Identifier", name: "afterAll" },
234
+ },
235
+ };
236
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
237
+ expect(result).toBeFalsy();
238
+ });
239
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as suite callback is excluded by default", () => {
240
+ const node = {
241
+ type: "ArrowFunctionExpression",
242
+ parent: {
243
+ type: "CallExpression",
244
+ callee: { type: "Identifier", name: "suite" },
245
+ },
246
+ };
247
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
248
+ expect(result).toBeFalsy();
249
+ });
250
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as context callback is excluded by default", () => {
251
+ const node = {
252
+ type: "ArrowFunctionExpression",
253
+ parent: {
254
+ type: "CallExpression",
255
+ callee: { type: "Identifier", name: "context" },
256
+ },
257
+ };
258
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
259
+ expect(result).toBeFalsy();
260
+ });
261
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as specify callback is excluded by default", () => {
262
+ const node = {
263
+ type: "ArrowFunctionExpression",
264
+ parent: {
265
+ type: "CallExpression",
266
+ callee: { type: "Identifier", name: "specify" },
267
+ },
268
+ };
269
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
270
+ expect(result).toBeFalsy();
271
+ });
272
+ test("[REQ-TEST-CALLBACK-EXCLUSION] Arrow function used as bench callback is checked by default", () => {
273
+ const node = {
274
+ type: "ArrowFunctionExpression",
275
+ parent: {
276
+ type: "CallExpression",
277
+ callee: { type: "Identifier", name: "bench" },
278
+ },
279
+ };
280
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE);
281
+ expect(result).toBeTruthy();
282
+ });
195
283
  /**
196
284
  * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
197
285
  * @req REQ-TEST-CALLBACK-EXCLUSION - Verify arrow function test callbacks are checked when exclusion is disabled
@@ -209,4 +297,108 @@ describe("Require Story Helpers (Story 003.0)", () => {
209
297
  });
210
298
  expect(result).toBeTruthy();
211
299
  });
300
+ test("[REQ-TEST-CALLBACK-EXCLUSION] beforeEach arrow function callback is checked when excludeTestCallbacks is false", () => {
301
+ const node = {
302
+ type: "ArrowFunctionExpression",
303
+ parent: {
304
+ type: "CallExpression",
305
+ callee: { type: "Identifier", name: "beforeEach" },
306
+ },
307
+ };
308
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
309
+ excludeTestCallbacks: false,
310
+ });
311
+ expect(result).toBeTruthy();
312
+ });
313
+ test("[REQ-TEST-CALLBACK-EXCLUSION] afterEach arrow function callback is checked when excludeTestCallbacks is false", () => {
314
+ const node = {
315
+ type: "ArrowFunctionExpression",
316
+ parent: {
317
+ type: "CallExpression",
318
+ callee: { type: "Identifier", name: "afterEach" },
319
+ },
320
+ };
321
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
322
+ excludeTestCallbacks: false,
323
+ });
324
+ expect(result).toBeTruthy();
325
+ });
326
+ test("[REQ-TEST-CALLBACK-EXCLUSION] beforeAll arrow function callback is checked when excludeTestCallbacks is false", () => {
327
+ const node = {
328
+ type: "ArrowFunctionExpression",
329
+ parent: {
330
+ type: "CallExpression",
331
+ callee: { type: "Identifier", name: "beforeAll" },
332
+ },
333
+ };
334
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
335
+ excludeTestCallbacks: false,
336
+ });
337
+ expect(result).toBeTruthy();
338
+ });
339
+ test("[REQ-TEST-CALLBACK-EXCLUSION] afterAll arrow function callback is checked when excludeTestCallbacks is false", () => {
340
+ const node = {
341
+ type: "ArrowFunctionExpression",
342
+ parent: {
343
+ type: "CallExpression",
344
+ callee: { type: "Identifier", name: "afterAll" },
345
+ },
346
+ };
347
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
348
+ excludeTestCallbacks: false,
349
+ });
350
+ expect(result).toBeTruthy();
351
+ });
352
+ test("[REQ-TEST-CALLBACK-EXCLUSION] suite arrow function callback is checked when excludeTestCallbacks is false", () => {
353
+ const node = {
354
+ type: "ArrowFunctionExpression",
355
+ parent: {
356
+ type: "CallExpression",
357
+ callee: { type: "Identifier", name: "suite" },
358
+ },
359
+ };
360
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
361
+ excludeTestCallbacks: false,
362
+ });
363
+ expect(result).toBeTruthy();
364
+ });
365
+ test("[REQ-TEST-CALLBACK-EXCLUSION] context arrow function callback is checked when excludeTestCallbacks is false", () => {
366
+ const node = {
367
+ type: "ArrowFunctionExpression",
368
+ parent: {
369
+ type: "CallExpression",
370
+ callee: { type: "Identifier", name: "context" },
371
+ },
372
+ };
373
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
374
+ excludeTestCallbacks: false,
375
+ });
376
+ expect(result).toBeTruthy();
377
+ });
378
+ test("[REQ-TEST-CALLBACK-EXCLUSION] specify arrow function callback is checked when excludeTestCallbacks is false", () => {
379
+ const node = {
380
+ type: "ArrowFunctionExpression",
381
+ parent: {
382
+ type: "CallExpression",
383
+ callee: { type: "Identifier", name: "specify" },
384
+ },
385
+ };
386
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
387
+ excludeTestCallbacks: false,
388
+ });
389
+ expect(result).toBeTruthy();
390
+ });
391
+ test("[REQ-TEST-CALLBACK-EXCLUSION] bench arrow function callback is always checked (also when excludeTestCallbacks is false)", () => {
392
+ const node = {
393
+ type: "ArrowFunctionExpression",
394
+ parent: {
395
+ type: "CallExpression",
396
+ callee: { type: "Identifier", name: "bench" },
397
+ },
398
+ };
399
+ const result = (0, require_story_helpers_1.shouldProcessNode)(node, require_story_helpers_1.DEFAULT_SCOPE, "all", {
400
+ excludeTestCallbacks: false,
401
+ });
402
+ expect(result).toBeTruthy();
403
+ });
212
404
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-traceability",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "A customizable ESLint plugin that enforces traceability annotations in your code, ensuring each implementation is linked to its requirement or test case.",
5
5
  "main": "lib/src/index.js",
6
6
  "types": "lib/src/index.d.ts",