Skip to main content

Module testing

Module testing 

Source
Expand description

Callee-text classification for test-suite structure and assertion patterns.

Detects test-framework globals and helpers:

  • TypeScript / JavaScript: BDD globals (describe, it, context), flat test, lifecycle hooks (beforeEach, afterEach, beforeAll, afterAll), expect(…), focused/excluded variants (xit, xdescribe, fit, fdescribe), and framework-namespaced helpers (jest.fn, jest.mock, jest.spyOn, vi.fn, vi.mock, vi.spyOn, etc.). Covers Jest, Vitest, Mocha, and Jasmine globals.
  • Go: testing.T method calls — t.Run, t.Error, t.Errorf, t.Fatal, t.Fatalf, t.Helper, t.Skip, t.Skipf, t.Log, t.Logf, t.Cleanup, t.Parallel.
  • Python: unittest.TestCase assertion methods — self.assertEqual, self.assertTrue, and the full self.assert[A-Z]… family. pytest bare assert statements are not call nodes and produce no hits in the v0 model.

§CALL_DISPATCH slot

Registered at P2 — just below async_patterns (P1) and above schema_validation (P4). Test globals are specific and resolve before any broader category.

§Known false positives

test(args), it(args), context(args), and expect(x) can appear as business-logic function names. The ^ anchor prevents mid-identifier matching but cannot distinguish intent. Accepted as entropy noise at codebase scale. Exclude test paths via patterns.scope_exclude to suppress them.

§scope_exclude interaction

patterns.scope_exclude removes files from the pattern catalog only (files remain in the graph). The testing bucket is non-empty only when test files are in the pattern scope. Repos that exclude test paths via scope_exclude will see a zero count — intended behaviour, not a miss. No auto-detection of test paths is performed.

§Seeds forward

Property-based (fc.assert, hypothesis.given) and E2E frameworks (cy., page.) are adjacent idioms. Deferred to post-M42.

Constants§

NODE_KINDS
Tree-sitter node kinds for testing patterns.

Functions§

matches_callee
Return true when text looks like a test-framework call.