-
Notifications
You must be signed in to change notification settings - Fork 673
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
Using testcafe with typescript and yarn pnp #6845
Comments
Hello @aultac, Thanks for sharing this method. We will research it and let you know our results. |
@aultac, may I ask how you are starting your tests? I'm trying to get Yarn PnP + TypeScript + TestCafe working, and am running into this issue after making the changes you suggested.
For reference, here is my .testcaferc.js file, based on yours: const { execSync } = require('child_process');
const tscbin = execSync('yarn bin tsc').toString().trim();
const tscmodule = tscbin.replace('/bin/tsc','');
module.exports = {
screenshots: {
takeOnFails: true
},
compilerOptions: {
typescript: {
configPath: 'tc/tsconfig.json',
customCompilerModulePath: tscmodule,
}
}
}; I have no idea why my |
Do you need to run testcafe from yarn when you're on the command line (as opposed to in package.json)? i.e. I used this for my testcafe config: const { execSync } = require('child_process');
// You have to `yarn unplug typescript` to get access to this module for testcafe
const tscloc = execSync('yarn bin tsc').toString().trim().replace('/bin/tsc','');
module.exports = {
src: "test/**/*.test.ts",
browsers: "chrome",
appCommand: "yarn run http-server .",
appInitDelay: 200,
debugOnFail: true,
compilerOptions: {
typescript: {
configPath: "tsconfig.test.json",
customCompilerModulePath: tscloc,
}
}
} |
Duplicate of #7710 |
What is your Scenario?
I'd like to use the latest typescript compiler for testcafe tests with yarn pnp which doesn't provide direct access to the typescript module (it's in a zip file instead).
What are you suggesting?
I don't think testcafe needs to do anything different other than add some documentation to help fellow travelers. You can get this to work with the following 2 steps:
1: unplug typescript from pnp to get it out of the zip file and into your local project:
2: Get the typescript file location in your .testcafe.js configuration file (it has to be a .js file, not a .json file):
What alternatives have you considered?
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: