Skip to content
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

Broken typescript config when using extends. #4776

Open
george-kats opened this issue Mar 7, 2024 · 1 comment
Open

Broken typescript config when using extends. #4776

george-kats opened this issue Mar 7, 2024 · 1 comment
Labels
🐛 Bug Something isn't working

Comments

@george-kats
Copy link

Summary
Broken tsconfig when using extends. Tests are running perfectly when pointing to config without relative extends.

ERROR Stryker Unexpected error occurred while running Stryker StrykerError: Error: An error occurred during initialization of the "typescript" checker. Inner error: Error: Typescript error(s) found in dry run compilation: tsconfig.stryker.json(1,161): error TS5069: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or option 'composite'.

tsconfig.json

{
  "extends": "@libjs-utils/tsconfig",
  "compilerOptions": {
    "jsx": "react",
    "resolveJsonModule": true,
    "baseUrl": "./",
    "tsBuildInfoFile": "./buildcache/tsconfig.tsbuildinfo",
    "incremental": true,
    "typeRoots": ["@types", "node_modules/@types"],
    "paths": {
      "common/*": ["./src/common/*"],
      "@Checkout/*": ["./src/@Checkout/*"],
      "@PaymentDetails": ["./src/@PaymentDetails"],
      "@PaymentDetails/*": ["./src/@PaymentDetails/*"],
      "@PlanComparison/*": ["./src/@PlanComparison/*"],
      "@playwright/*": ["playwright/*"],
    }
  },
  "include": [
    "./src",
    "@types"
  ],
  "exclude": ["./src/__tests__/**/*"],
  "files": ["./config/jest/jest.setup.ts"]
}

tsconfig.stryker.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "skipLibCheck": true,
  },
}

Stryker config

module.exports = {
  $schema: './node_modules/@stryker-mutator/core/schema/stryker-schema.json',
  mutate: ['src/**/*.ts?(x)', '!src/**/*@(.test|.spec|Spec).ts?(x)'],
  testRunner: 'jest',
  jest: {
    projectType: 'custom',
    configFile: 'jest.config.json',
    enableFindRelatedTests: true,
  },
  checkers: ['typescript'],
  tsconfigFile: 'tsconfig.stryker.json',
  typescriptChecker: {
    prioritizePerformanceOverAccuracy: true,
  },
  reporters: ['progress', 'clear-text', 'html'],
  coverageAnalysis: 'perTest',
  ignoreStatic: true,
  incremental: true,
};

Stryker environment

├── @stryker-mutator/[email protected]
├── @stryker-mutator/[email protected]
├── @stryker-mutator/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── @testing-library/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]

Test runner environment

yarn jest
{
  "clearMocks": true,
  "testResultsProcessor": "jest-sonar-reporter",
  "collectCoverageFrom": ["src/**/*.{ts,tsx}"],
  "coverageDirectory": "coverage",
  "collectCoverage": true,
  "moduleNameMapper": {
    "\\.(jpg|jpeg|png|webp|eot|otf|ttf|woff|woff2|gif)$": "<rootDir>/config/jest/__mocks__/fileMock.ts",
    "\\.(svg)$": "<rootDir>/config/jest/__mocks__/svgMock.ts",
    "\\.(scss|css)$": "identity-obj-proxy",
  },
  "roots": ["<rootDir>/src"],
  "moduleDirectories": ["node_modules", "src"],
  "setupFilesAfterEnv": ["<rootDir>/config/jest/jest.setup.ts"],
  "testMatch": ["<rootDir>/src/**/__tests__/**/*.spec.{ts,tsx}"],
  "testEnvironment": "jsdom",
  "globals": {
    "__DEV__": true,
    "CI_BUILD_VERSION": "release-123"
  }
}

Your Environment

software version(s)
node v20.11.1
npm 10.2.4
Operating System Sonoma 14.2.1

Add stryker.log

stryker.log

@george-kats george-kats added the 🐛 Bug Something isn't working label Mar 7, 2024
@nicojs
Copy link
Member

nicojs commented Mar 9, 2024

Hi @george-kats-e thanks for opening this issue and sharing your configs. Should be a relatively easy fix.

@danny12321 if you feel up to it you might want to pick this up?

EDIT: @george-kats-e workaround for now is to remove the "tsBuildInfoFile": "./buildcache/tsconfig.tsbuildinfo" fro your config.

Or you could try changing your tsconfig.stryker.json:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "skipLibCheck": true,
+   "tsBuildInfoFile": null
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants