-
Notifications
You must be signed in to change notification settings - Fork 157
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
V4.0.0-beta.0: extends in tsconfig.json does not work as expected. #144
Comments
I can confirm this issue as well. I have been attempting to implement testing in Nuxt leveraging Jest. The default recommended config for nuxt-ts is:
Eventually I chased it down to a failure to load the extended attributes into the referenced object as previously mentioned by @yohodopo |
can confirm this is happening aswell :( i was trying to debug why my typescript decorator is having it's 3rd argument as
I assumed it was in I tried tweaking the |
From what I read, I found this bug while making Quasar framework work nicely with TS and Jest, in which a Anyway, seems like the new V4 will support Cya! |
I am using To test I:
{
"extends": "./tsconfig.base.json"
}
|
Same here! Please, provide some feedback |
Hi, I encoutered the same issue, and I wrote this workaround in my const path = require('path');
const tsc = require('typescript');
module.exports = {
globals: {
'vue-jest': {
tsConfig: extractTsConfig(),
},
},
};
function extractTsConfig() {
const tsConfigPath = tsc.findConfigFile(process.cwd(), (fileName) => tsc.sys.fileExists(fileName));
if (!tsConfigPath) {
return;
}
const loaded = tsc.readConfigFile(tsConfigPath, (file) => tsc.sys.readFile(file));
if (loaded.error) {
throw new Error(loaded.error);
}
const basePath = path.dirname(tsConfigPath);
const parsedConfig = tsc.parseJsonConfigFileContent(loaded.config, tsc.sys, basePath);
if (parsedConfig.errors.length > 0) {
throw new Error(`Errors occurred while reading ${tsConfigPath}: ${parsedConfig.errors}`);
}
return {
compilerOptions: parsedConfig.options,
};
} I would be happy to open a PR with a more general fix if it interests someone. |
@mjeanroy I am interested |
Hi @lmiller1990, |
Yes this would be welcome, I can do a release if we have a fix! |
Hi @lmiller1990, I just look at the code on the master branch and it looks like this issue is fixed with version 4.0.0 (not tested, but, as already said by @IlCallo, since it uses The main problem is that version Are you still interested in a fix for the |
3.x has not been updated in a long time. Even if you fix it, updating vue-cli would need to happen as well. I don't think it makes sense to update 3.x at this point. People should just upgrade to 4.x. If you like, you could open an issue in vue-cli to update the plugin to 4.x. I don't think this is a major breaking change so it shouldn't be too much trouble. Also I think we need to review/merge this up? #324 |
tsConfig.json
tsconfig-base.json
When I tried debugging this issue, it logs
{"extends":"./.temp/tsconfig-base.json","compilerOptions":{}}
at https://github.com/vuejs/vue-jest/blob/master/lib/compilers/typescript-compiler.js#L11related to #118
The text was updated successfully, but these errors were encountered: