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

[🐛 Bug]: ts-node performs type check regardless of configuration #13017

Open
3 tasks done
GYuriy opened this issue Jun 12, 2024 · 1 comment
Open
3 tasks done

[🐛 Bug]: ts-node performs type check regardless of configuration #13017

GYuriy opened this issue Jun 12, 2024 · 1 comment
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested Needs Investigation Issues that require more information on the problem.

Comments

@GYuriy
Copy link

GYuriy commented Jun 12, 2024

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

18.19.1

Mode

Standalone Mode

Which capabilities are you using?

capabilities: [{
        browserName: 'chrome'
    }],

What happened?

ts-node performs type checking regardless of the options (autoCompile: true, or typeCheck: false,) specified in the wdio config. Alternatively, I tried specifying the ts-node options in the tsconfig, but the result is the same, which makes me think it's either a ts-node issue or wdio overrides any options passed to ts-node with default values.

Unfortunately, I can't test on node.js v20+ right now.

ATTENTION: The attached reproducible example relates to the abovementioned issue.

However, it looks like the issue is older than I might initially think. So, I went back to some of my older codebases and found this setup:

    "@types/node": "18.16.14",
    "@wdio/allure-reporter": "8.28.6",
    "@wdio/cli": "8.28.8",
    "@wdio/local-runner": "8.28.8",
    "@wdio/mocha-framework": "8.28.8",
    "@wdio/spec-reporter": "8.28.8",
    "allure-commandline": "2.26.0",,
    "ts-node": "10.9.2",
    "typescript": "5.3.3"

In the version above, it works (or actually doesn't work) in the reverse manner. The ts-node never throws when there are type-related errors in your code. However, unlike the fresh issue aboe, you can achieve a TS error by specifying the ts-node options in the tsconfig.

The will look like this:

[0-0] Error: undefined
[0-0]     at MochaAdapter._loadFiles (file:///C:/********/node_modules/@wdio/mocha-framework/build/index.js:91:35)

I assume someone was fixing this Error: undefined and broke the last ts-node options part that was "working"

What is your expected behavior?

Tests should run regardless of any type-related errors in the code when autoCompile: true, or typeCheck: false,

How to reproduce the bug.

  • Init a new TS boilerplate project using npm init wdio@latest .
    • Make sure type checking is turned off in ts-node
  • Add the code that will trigger type errors e.g. let foo: string; foo = 42
  • Run tests with npm run wdio
    bug-tsnode-opts.zip

Relevant log output

[0-0] Error: TSError:  Unable to compile TypeScript:
[0-0] test/specs/test.e2e.ts(5,5): error TS6133: 'foo' is declared but its value is never read.
[0-0] test/specs/test.e2e.ts(9,9): error TS2322: Type 'number' is not assignable to type 'string'.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues
@GYuriy GYuriy added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels Jun 12, 2024
@GYuriy GYuriy changed the title [🐛 Bug]: s-node performs type check regardless of configuration [🐛 Bug]: ts-node performs type check regardless of configuration Jun 12, 2024
@christian-bromann christian-bromann added Needs Investigation Issues that require more information on the problem. help wanted Issues that are free to take by anyone interested and removed Needs Triaging ⏳ No one has looked into the issue yet labels Jun 13, 2024
@wdio-bot
Copy link
Contributor

Thanks for reporting!

We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested Needs Investigation Issues that require more information on the problem.
Projects
None yet
Development

No branches or pull requests

3 participants