-
-
Notifications
You must be signed in to change notification settings - Fork 0
Transform ESM rather than mock #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,9 +92,6 @@ const config: Config = { | |
| '^@papi/frontend/react$': '<rootDir>/__mocks__/papi-frontend-react.ts', | ||
| /** Mock so test-helpers get UnsubscriberAsyncList without loading ESM deps. */ | ||
| '^platform-bible-utils$': '<rootDir>/__mocks__/platform-bible-utils.ts', | ||
| /** Mock platform-bible-react and lucide-react — both ship ESM that Jest cannot parse. */ | ||
| '^platform-bible-react$': '<rootDir>/__mocks__/platform-bible-react.tsx', | ||
| '^lucide-react$': '<rootDir>/__mocks__/lucide-react.tsx', | ||
| /** Resolve webpack ?inline imports. */ | ||
| '^(.+)\\.web-view\\?inline$': '<rootDir>/__mocks__/web-view-inline.ts', | ||
| /** Resolve webpack ?inline imports: SCSS content. */ | ||
|
|
@@ -128,6 +125,9 @@ const config: Config = { | |
| transform: { | ||
| '\\.[jt]sx?$': 'ts-jest', | ||
| }, | ||
|
|
||
| /** Transform dependencies with ESM that Jest cannot parse. */ | ||
| transformIgnorePatterns: ['node_modules/(?!(platform-bible-react|lucide-react)/)'], | ||
|
Comment on lines
125
to
+130
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# 1) Which package manager is in use?
fd -HI -t f -d 2 '^(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb)$'
# 2) Does tsconfig enable allowJs (needed for ts-jest to transform .js in node_modules)?
fd -HI -t f '^tsconfig(\..*)?\.json$' --exec sh -c 'echo "=== $1 ==="; cat "$1"' _ {}
# 3) Look for ts-jest transform options in jest config(s) / package.json
rg -nP -C2 '\b(ts-jest|allowJs|useESM|isolatedModules)\b' --type=ts --type=json
# 4) Peek at the entry points / deps of the two packages being transformed
fd -HI -t f '^package\.json$' node_modules/platform-bible-react node_modules/lucide-react 2>/dev/null \
| xargs -I{} sh -c 'echo "=== {} ==="; jq "{name, type, main, module, exports, dependencies, peerDependencies}" {}'Repository: sillsdev/interlinearizer-extension Length of output: 50391 🏁 Script executed: # 1) Check the full jest.config.ts to see if there's a ts-jest allowJs override
cat jest.config.ts | head -150
# 2) Look for ts-jest preset or options
rg -A 10 -B 2 "ts-jest" jest.config.ts
# 3) Check if the two packages exist in node_modules
ls -la node_modules/platform-bible-react node_modules/lucide-react 2>&1 | head -20Repository: sillsdev/interlinearizer-extension Length of output: 6137 🏁 Script executed: # Check package.json for the two packages and jest/ts-jest versions
rg -A 20 '"dependencies"|"devDependencies"' package.json | head -40
# Check if there's any ts-jest preset or globals config in jest.config.ts
rg -i "preset|globals|jest" jest.config.ts
# Look at comment around the transform to see if there's rationale for the format
grep -B 5 -A 5 "Transform TS/TSX" jest.config.tsRepository: sillsdev/interlinearizer-extension Length of output: 2544 🏁 Script executed: # Check if platform-bible-react or lucide-react are referenced anywhere in the codebase
rg -i "platform-bible-react|lucide-react" src/ --type ts --type tsx --type json
# Check if there's a TODO or comment about adding these packages
rg -B 3 -A 3 "platform-bible-react|lucide-react" jest.config.ts
# Check git status or recent changes to understand context
git log --oneline -20 jest.config.ts 2>/dev/null | head -10Repository: sillsdev/interlinearizer-extension Length of output: 347 🏁 Script executed: # Check jest/ts-jest version to understand current capabilities
rg '"jest"|"ts-jest"' package.json --type json -A 1
# Search for any issues or comments in code about these packages or ESM
rg -i "esm|@module|import\.meta" src/ --type ts --type js 2>/dev/null | head -20Repository: sillsdev/interlinearizer-extension Length of output: 260 Verify ts-jest config handles ESM from The two packages are whitelisted to be transformed by ts-jest instead of mocked, but a few things need checking:
Worth running the full test suite (not just a single file) to surface any of these issues before merging. 🤖 Prompt for AI Agents |
||
| }; | ||
|
|
||
| export default config; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: sillsdev/interlinearizer-extension
Length of output: 2043
Fix terminology: "PT0" should be "PT9".
Line 98 states "parsing PT0 interlinear XML," but the directory
src/parsers/pt9/and all parser documentation (pt9-xml.md) consistently reference PT9. Update the description to "parsing PT9 interlinear XML" to match the actual schema and code.🤖 Prompt for AI Agents