-
Notifications
You must be signed in to change notification settings - Fork 157
Add support for specific tsconfig file path inside of vue-jest jest.config.js options #309
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
Comments
My project is a electron app, I put
I found vue-jest |
@lmiller1990 I'll try to make a PR, but I'm not sure if I can do it well。 |
Give it a try :) if you get stuck ask - I can help out. |
@lmiller1990 Throw errors when I run
Use |
…jest.config.js options (vuejs#309)
@lmiller1990 I make a PR. Another question about typescript. I try to change {
"name": "typescript",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"test": "jest --no-cache ./sub-project/test.js"
},
"dependencies": {
"vue": "3.0.0-alpha.10"
},
"devDependencies": {
"@types/jest": "^26.0.20",
"ts-jest": "^26.5.3",
"typescript": "^4.2.3",
"jest": "^24.0.0"
},
"jest": {
"globals": {
"vue-jest": {
"tsConfig": "./sub-project/tsconfig.json"
}
},
"moduleFileExtensions": [
"js",
"ts",
"json",
"vue"
],
"transform": {
"^.+\\.ts$": "ts-jest",
"^.+\\.vue$": "../../../lib/index.js"
}
}
} then report errors. Did I miss something? FAIL sub-project/test.js
● Test suite failed to run
D:\sources\xiaohulu\vue-jest\e2e\__projects__\typescript\sub-project\test.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { createApp, h } from 'vue'
^^^^^^
SyntaxError: Cannot use import statement outside a module
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25) |
Hi! Regarding Line 60 in 71e87c1
You could rewrite that part of the code using Regarding the second error - you might need to install If not, please push your branch and write instructions so I can try running it. This project is pretty tricky and annoying to work on at times, but I'm sure we can get this to work 👍 EDIT: I see your branch here: https://github.com/vuejs/vue-jest/pull/324/files I can look tonight! :) Thanks for waiting. |
PR contains linguish error, so I fixed & merged. |
Thanks. You are now added a collab. Feel free to make fixes/close issues if you want, let me know if you need any help with anything. |
We refactored vue-jest to have better tsconfig support by recursively walking up the directory structure, but sometimes users use sibling directories to store their build + config settings.
Can we specify a tsconfig path inside of jest.config.js? Perhaps relative to
<rootDir>
?The text was updated successfully, but these errors were encountered: