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

@stryker-mutator/typescript-checker is incompatible with TypeScript 3.7 #2550

Closed
nicojs opened this issue Oct 13, 2020 · 3 comments
Closed
Labels
🐛 Bug Something isn't working

Comments

@nicojs
Copy link
Member

nicojs commented Oct 13, 2020

Summary

As reported by @LayZeeDK here: #2548 (comment)

After I added back the TypeScript Checker, this error is reported:

    19:38:51 (3931) ERROR Stryker Error: Error: An error occurred during initialization of the "typescript" checker. Inner error: Error: TypeScript error(s) found in dry run compilation: ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,36): error TS1005: ',' expected.\n
    ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,57): error TS1005: ',' expected.

    Error: TypeScript error(s) found in dry run compilation: ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,36): error TS1005: ',' expected.
    ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,57): error TS1005: ',' expected.

        at TypescriptChecker.init (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/typescript-checker/src/typescript-checker.ts:118:13)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
        at CheckerWorker.init (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/core/src/checker/checker-worker.js:21:21
        at ChildProcessProxyWorker.handleCall (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/core/src/child-proxy/child-process-proxy-worker.js:62:28)
    Error: An error occurred during initialization of the "typescript" checker. Inner error: Error: TypeScript error(s) found in dry run compilation: ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,36): error TS1005: ',' expected.
    ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,57): error TS1005: ',' expected.

    Error: TypeScript error(s) found in dry run compilation: ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,36): error TS1005: ',' expected.
    ../../node_modules/@stryker-mutator/api/src/core/range.d.ts(4,57): error TS1005: ',' expected.

        at TypescriptChecker.init (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/typescript-checker/src/typescript-checker.ts:118:13)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
        at CheckerWorker.init (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/core/src/checker/checker-worker.js:21:21)
        at ChildProcessProxyWorker.handleCall (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/core/src/child-proxy/child-process-proxy-worker.js:62:28)
        at CheckerWorker.init (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/core/src/checker/checker-worker.js:24:27)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
        at ChildProcess.<anonymous> (/home/runner/work/stryker/stryker/e2e/test/angular-project/node_modules/@stryker-mutator/core/src/child-proxy/child-process-proxy.js:132:68)
        at ChildProcess.emit (events.js:315:20)
        at emit (internal/child_process.js:876:12)
        at processTicksAndRejections (internal/process/task_queues.js:85:21)

Remember that this project uses TypeScript version 3.7.5.

As seen in this TypeScript playground, range.ts is incompatible with TypeScript 3.7.

Labeled tuple elements were added in TypeScript 4.0, so range.ts is currently incompatible with e2e project using TypeScript <4.0.

// range.ts
/**
 * Represents a location in a file by range.
 */
type Range = [fromInclusive: number, toExclusive: number];

export default Range;

This is the declarations output in range.d.ts in @stryker-mutator/core v4.0.0:

// range.d.ts
/**
 * Represents a location in a file by range.
 */
declare type Range = [fromInclusive: number, toExclusive: number];
export default Range;
//# sourceMappingURL=Range.d.ts.map

Meaning TypeScript <4.0 is not supported for a bunch of the APIs.

TypeScript 4.0 is supported by Angular 10.1.

@nicojs
Copy link
Member Author

nicojs commented Oct 13, 2020

I can't reproduce it with this simple example. Will try the e2e tests now.
Uploading ts3.7-example.zip…

@LayZeeDK
Copy link
Contributor

LayZeeDK commented Oct 13, 2020

I just tested in an Angular 9.0 + TypeScript 3.7 project with the following dependencies and configuration and it doesn't seem to be an issue outside of the stryker monorepo.

package.json

{
  "name": "ngx-stryker-cli900",
  "version": "0.0.0",
  "scripts": {
    "postinstall": "ngcc",
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.0.0",
    "@angular/common": "~9.0.0",
    "@angular/compiler": "~9.0.0",
    "@angular/core": "~9.0.0",
    "@angular/forms": "~9.0.0",
    "@angular/platform-browser": "~9.0.0",
    "@angular/platform-browser-dynamic": "~9.0.0",
    "@angular/router": "~9.0.0",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.0",
    "@angular/cli": "~9.0.0",
    "@angular/compiler-cli": "~9.0.0",
    "@angular/language-service": "~9.0.0",
    "@stryker-mutator/core": "^4.0.0",
    "@stryker-mutator/karma-runner": "^4.0.0",
    "@stryker-mutator/typescript-checker": "^4.0.0",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~5.18.0",
    "typescript": "~3.7.5"
  }
}

stryker.conf.json

{
  "$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
  "_comment": "This config was generated using a preset. Please see the handbook for more information: https://github.com/stryker-mutator/stryker-handbook/blob/master/stryker/guides/angular.md#angular",
  "mutate": [
    "src/**/*.ts",
    "!src/**/*.spec.ts",
    "!src/test.ts",
    "!src/environments/*.ts"
  ],
  "testRunner": "karma",
  "checkers": ["typescript"],
  "karma": {
    "configFile": "karma.conf.js",
    "projectType": "angular-cli",
    "config": {
      "browsers": ["ChromeHeadless"]
    }
  },
  "reporters": ["progress", "clear-text", "html"],
  "concurrency": 4,
  "concurrency_comment": "Recommended to use about half of your available cores when running stryker with angular",
  "coverageAnalysis": "perTest"
}

@nicojs
Copy link
Member Author

nicojs commented Oct 14, 2020

Thanks. It is indeed the mono repo setup. We have the verify, which was used in the typescript compilation. See #2548 (comment) for more info.

@nicojs nicojs closed this as completed Oct 14, 2020
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