Fix Jest CI failures: TS1343 import.meta, TS2322 Badge variants, TS2367/TS2739 type errors#128
Draft
Fix Jest CI failures: TS1343 import.meta, TS2322 Badge variants, TS2367/TS2739 type errors#128
Conversation
…y comparison, TS2739 Game properties Agent-Logs-Url: https://github.com/lorettarehm/AgileGamifAI/sessions/5db0e61b-6a25-4c72-bc64-5bf37197e6fa
Copilot
AI
changed the title
[WIP] Fix CI failures in GitHub Actions job 59898111296
Fix Jest CI failures: TS1343 import.meta, TS2322 Badge variants, TS2367/TS2739 type errors
Mar 30, 2026
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.
Jest coverage collection was failing with TypeScript compilation errors on four source files due to ts-jest using CommonJS module defaults incompatible with Vite's ESNext/import.meta patterns.
Changes
tsconfig.test.json(new)Dedicated Jest tsconfig extending
tsconfig.app.jsonwith overrides needed for ts-jest compatibility:module: "ESNext"— allowsimport.metasyntax (fixes TS1343 inApp.tsx,AIGameSuggestion.tsx)moduleResolution: "node"— restores Node-style resolution (required for Jest;tsconfig.app.jsonuses"bundler")noEmit: false,allowImportingTsExtensions: false— incompatible with ts-jest emitjest.config.jsMigrated from deprecated
globals['ts-jest']totransformformat, pointing totsconfig.test.json:src/components/GameDetail.tsxIntroduced
BadgeVarianttype alias and used it to typeframeworkColorMapandknowledgeLevelColordirectly — eliminating repeated inline union casts (TS2322):src/components/GameCreate.tsxRemoved always-false
key === 'id'check —gameisOmit<Game, 'id'>, soidis never a key (TS2367).src/data/games.tsAdded missing required
Gamefields (learningOutcomes,isAccessible,requiredKnowledgeLevel) to all 5 sample game objects (TS2739).Original prompt
Create a PR to fix CI failures shown in GitHub Actions job 59898111296 (run 20848630333) for PR #120 in lorettarehm/AgileGamifAI.
Context:
Repo state at commit ref d0eef38.
Tasks:
Fix PostCSS/Tailwind build issue:
Fix Jest coverage TS1343 import.meta issue:
Fix src/components/GameDetail.tsx typing:
Fix src/data/games.ts type mismatch:
Acceptance criteria:
npm ci && npm run lint && npx tsc --noEmit && npm run test:ci && npm run buildsucceeds on Node 18 and 20 in GitHub Actions.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The job is failing for three concrete reasons shown in the logs (plus one noisy but non-failing console.error). Fix the items below and the CI run should go green.
1) Build fails: Tailwind used directly as a PostCSS plugin
Error (from logs):
Where:
postcss.config.jsatd0eef380f43552e79965fc93975b3f3893df76e3currently has:Fix
postcss.config.jsto use@tailwindcss/postcss:That resolves the Vite/PostCSS build failure.
2) Jest coverage collection fails:
import.metanot allowed under current TS module settingsError (from logs):
This happens while collecting coverage from:
src/components/AIGameSuggestion.tsxsrc/App.tsxThis is a TypeScript/Jest instrumentation issue: your test run is type-checking/transpiling files for coverage with a TS module target that doesn’t allow
import.meta.Fix (recommended): make the TS config used by tests allow
import.metaIn a Vite app, your app TS config usually already uses an ES module target; the failure often comes from Jest/ts-jest using the “wrong” tsconfig defaults.
Create a dedicated
tsconfig.jest.json(or update your existing Jest/ts-jest config to point at the app tsconfig) with a compatible module option:tsconfig.jest.json{ "extends": "./tsconfig.app.json", "compilerOptions": { "module": "es2022", "moduleResolution": "bundler" } }Then in your Jest config (wherever it is in this repo), ensure ts-jest uses it, e.g.: