Repository navigation
test: group the syntax unit tests by language, merge the JavaScript ones - #22824
Conversation
The syntax unit tests move into one folder per language — javascript/, css/, html/, xml/, json/ — and the tests of the tooling/ scripts into tooling/. The fourteen JavaScript files become six, one per component: - parser: WebpackParser, RegExpValidator, Parser, JavascriptSyntaxTree - webpack-parser: JavascriptParser - scope: ScopeAnalyzer, ScopeAnalyzerParity - printer: syntax-printer and its -tree, -estree and -name-cache files - minify: jsMinify - no-acorn: ParserWithoutAcorn, alone for its jest.mock of acorn No test changes: the merged files keep every describe and assertion, and reuse one binding where two files required the same value. Claude-Session: https://claude.ai/code/session_017TkBWTk3wcyUcJYDp5ZhaP
|
|
This PR is packaged and the instant preview of its latest commit is available. Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@22824
yarn add -D webpack@https://pkg.pr.new/webpack@22824
pnpm add -D webpack@https://pkg.pr.new/webpack@22824 |
Types CoverageCoverage after merging refactor/unit-tests-by-language into main will be
Coverage Report |
Generated code sizeComparing base (
Read No asset changed size. No runtime gained or lost a runtime module. Built |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Change: Other Merge Risk: ⚪ Minimal · up to
|
Merging this PR will regress 3 benchmarks
|
Summary
The syntax unit tests were spread across the top level of
test/unitCases/. The JavaScript ones were also split into 14 files as features landed, and four of those test the same parser. This change moves them into one folder per language and merges the JavaScript files into one file per component.javascript/parser←WebpackParser,RegExpValidator,Parser,JavascriptSyntaxTreewebpack-parser←JavascriptParserscope←ScopeAnalyzer,ScopeAnalyzerParityprinter←syntax-printer,-tree,-estree,-name-cacheminify←jsMinifyno-acorn←ParserWithoutAcorncss/syntax←CssSyntaxhtml/syntax←HtmlSyntaxentry-wrapper←HtmlEntryWrapperxml/minify←xmlMinifyjson/minify←jsonMinifyweb-manifest←WebManifestParsertooling/css-data←CssValueSyntaxcompare-js,compare-css,compare-html,compare-xml←Compare*Tools*compare-harness,compare-path-span-walk,compare-purity,compare-slices,compare-spans←CompareTools*Some files keep their own file:
no-acornreplacesacornwith a throwing mock for the whole file, so it can't share a file with tests that use acorn.entry-wrappermust be the first build in its process.How the merges were done:
describe, test and assertion is kept as written.parseProgram, the name the analyzer tests import it under.PortOptionsandTREE_OPTION_SETS. The Parser tests keep their typed view of acorn asacornPort.Also updated:
test:unit,cover:unit,test:denoandtest:bunmatch patterns,jest.config.jsandtsconfig.types.test.json, nowunitCases/**/*.unittest.jsWhat kind of change does this PR introduce?
test (a refactor of the test layout)
Did you add tests for your changes?
No new tests. I compared the full name of every test on both sides: the 29 old files on
mainagainst the new folders on this branch.cssIdentifiertests, which ran only on the branch side because thetest/unitCases/csspath filter also matched the rootcssIdentifier.unittest.js.main(builtinEmbeddedRenderer, in the unchanged HTML file) didn't occur on the branch.ProfilingPlugin, which needs a Chrome the local machine doesn't have.yarn lintandlint:types-testare clean.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
TESTING_DOCS.mddescribes the new layout.Use of AI
Claude Code proposed the layout. It merged the files with a scope-aware script and checked the test names against
main. I reviewed it.Generated by Claude Code
Summary by CodeRabbit
Tests
Documentation
Chores