test: port internal-helpers tests to TypeScript#16344
Closed
yosofbadr wants to merge 6 commits into
Closed
Conversation
Port all three test files in packages/internal-helpers/test/ from JavaScript to TypeScript: - create-filter.test.js -> create-filter.test.ts - path.test.js -> path.test.ts - request.test.js -> request.test.ts Add tsconfig.test.json and update package.json to run TypeScript tests with --strip-types, following the same pattern as packages/astro. Ref withastro#16241
|
The test entry glob only matched .test.js files. Since tests are being ported to TypeScript (withastro#16241), update the pattern to also match .test.ts files.
Replace `as string` with `!` assertion to satisfy @typescript-eslint/non-nullable-type-assertion-style.
The SCSS HMR and actions blog E2E tests are known flaky failures unrelated to the TypeScript test port changes in this PR.
ocavue
reviewed
Apr 16, 2026
Comment on lines
+256
to
+257
| 'http://\u4F8B\u3048.jp/test', | ||
| '\\\\\u4F8B\u3048.jp/test', |
Contributor
There was a problem hiding this comment.
May I ask why you changed these Japanese characters to \u unicode code?
ematipico
requested changes
Apr 16, 2026
| @@ -1,4 +1,4 @@ | |||
| import assert from 'node:assert/strict'; | |||
| import * as assert from 'node:assert/strict'; | |||
| @@ -1,9 +1,9 @@ | |||
| import assert from 'node:assert/strict'; | |||
| import * as assert from 'node:assert/strict'; | |||
Comment on lines
+159
to
+161
| 'http://\u00FCser:p\u0101ss@example.com', // Unicode username/password | ||
| 'http://\u7528\u6237:\u5BC6\u7801@example.com', // Chinese characters | ||
| 'http://\u0430\u0434\u043C\u0438\u043D:\u043F\u0430\u0440\u043E\u043B\u044C@example.com', // Cyrillic |
Member
There was a problem hiding this comment.
Revert the internal changes of this array
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.
Summary
Ports all test files in
packages/internal-helpers/test/from JavaScript to TypeScript, as part of the ongoing test migration effort.create-filter.test.jstocreate-filter.test.tswith type annotationspath.test.jstopath.test.tswith type annotations for test data arraysrequest.test.jstorequest.test.tswith type annotations (e.g.,makeRequesthelper)tsconfig.test.jsonfor test typechecking (following the pattern frompackages/astro)package.jsontest script to use--strip-typeswith.test.tsglob, and addedtypecheck:testsscriptAll 60 tests pass and
tsc --project tsconfig.test.jsonreports no errors.Closes #16241 (partial)
Test plan
pnpm --filter @astrojs/internal-helpers test-- all 60 tests passpnpm --filter @astrojs/internal-helpers typecheck:tests-- no type errors