fix(test): align test:match and test:cli script globs with .test.ts files#16648
Open
aru-dev-ac wants to merge 2 commits into
Open
fix(test): align test:match and test:cli script globs with .test.ts files#16648aru-dev-ac wants to merge 2 commits into
aru-dev-ac wants to merge 2 commits into
Conversation
…iles After withastro#16402 migrated every test under packages/astro/test to TypeScript, two scripts in packages/astro/package.json were left pointing at non-existent .test.js globs: "test:match": "astro-scripts test \"test/**/*.test.js\" --match", "test:cli": "astro-scripts test \"test/**/cli.test.js\"", Because astro-scripts wraps the matched files in a temp module before invoking node:test, an empty match still produces a passing run (one phantom "1 test" from the empty wrapper), so the breakage was silent. This commit: - updates the globs to .test.ts so they match real files (test/cli.test.ts, test/units/**/*.test.ts, test/*.test.ts); - adds --strip-types so node:test can load the TypeScript files, matching the existing test:unit and test:integration scripts; - restores test:match as the documented "run a subset of tests by name pattern" command referenced in CONTRIBUTING.md. Verified locally: "pnpm test:cli --match 'astro --version'" now runs the real "astro cli > astro --version" test from test/cli.test.ts, where previously it reported a phantom "1 test passed" without executing any cli.test code.
|
…pts-after-typescript-migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
After #16402 migrated every test under
packages/astro/testto TypeScript, two scripts inpackages/astro/package.jsonwere left pointing at non-existent.test.jsglobs:Because
astro-scripts testwraps the matched files in a temp module before invokingnode:test(seescripts/cmd/test.js:90-102), an empty match still produces a passing run —node:testcounts the empty wrapper as a single passing "test" — so the breakage was silent.pnpm test:clireportstests 1,pass 1,suites 0and exits in ~100ms without ever executing the real CLI tests intest/cli.test.ts.This PR:
.test.tsso they match real files (test/cli.test.ts,test/units/**/*.test.ts,test/*.test.ts).--strip-typessonode:testcan load the TypeScript files, matching the existingtest:unitandtest:integrationscripts on the surrounding lines.test:matchas the documented "run a subset of tests by name pattern" command referenced inCONTRIBUTING.mdlines 130-132.Testing
Verified locally before/after the change:
Before —
pnpm test:cli(phantom pass, no real tests run):After —
pnpm test:cli --match "astro --version"(realcli.test.tstest):Note the suite count flips from 0 → 1, confirming
cli.test.tsis actually loaded and thedescribe('astro cli')suite runs.Docs
No docs changes needed —
CONTRIBUTING.md:130-132already documentspnpm test:match "<pattern>"; this PR makes that documented behaviour work again.No changeset added — internal-only
package.jsonscript change, no published-package surface affected.