refactor: types for tests#21145
Conversation
Include test/helpers/**/*.js in tsconfig.types.test.json and annotate the helpers with JSDoc so they pass under strict checkJs.
… strict explicitly Type the test helpers with concrete types (config, jest, CSS-rule, worker and event shapes) instead of the EXPECTED_ANY escape hatch, and set strict: true explicitly in tsconfig.types.test.json.
Checkpoint while typing the *.unittest/*.test/*.basictest/*.longtest suites. Not yet green; remaining files still being annotated.
|
|
This PR is packaged and the instant preview is available (155a60a). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@155a60a
yarn add -D webpack@https://pkg.pr.new/webpack@155a60a
pnpm add -D webpack@https://pkg.pr.new/webpack@155a60a |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21145 +/- ##
=======================================
Coverage 92.33% 92.33%
=======================================
Files 581 581
Lines 63266 63288 +22
Branches 17498 17507 +9
=======================================
+ Hits 58418 58439 +21
- Misses 4848 4849 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 30.06%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
322.6 KB | 1,292.5 KB | -75.04% |
| ⚡ | Memory | benchmark "lodash", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
858.9 KB | 126 KB | ×6.8 |
| ⚡ | Memory | benchmark "asset-modules-bytes", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
319.3 KB | 246.9 KB | +29.36% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/test-strict-types-scn1sy (155a60a) with main (87394de)
- Resolve remaining tsc errors in strict test type-check (unused @ts-expect-error directives, SuiteConfig minimize/snapshot, cleverMerge CasesMap, webpack-cli optional peer). - Run ESLint and Prettier across the newly type-checked test files. - Address GitHub code-quality review: drop misleading multi-line cast in TestCases.template, remove dead errored locals in Validation.test, and drop superfluous CustomError argument.
Summary
types
What kind of change does this PR introduce?
refactor
Did you add tests for your changes?
Does this PR introduce a breaking change?
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Use of AI