Skip to content

fix: do not require ts-jest and typescript #307

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

Merged
merged 5 commits into from
Dec 7, 2020
Merged

Conversation

lmiller1990
Copy link
Member

We can use the tsconfig module to see if a tsconfig.json exists. If it doesn't, we can assume they are not using TypeScript. This removes the need to install TS for non TS projects.

@lmiller1990 lmiller1990 merged commit 3823eb2 into next Dec 7, 2020
@lmiller1990 lmiller1990 deleted the remove-ts-dep branch December 7, 2020 16:34
@boboldehampsink
Copy link

@lmiller1990 Time for a release? ;-)

@lmiller1990
Copy link
Member Author

I can do one, was hoping to look at #309 first, since we currently assume tsconfig.json is at the root dir, which is not always the case.

At the moment you just need to install ts-jest to work-around, is this blocking you?

Either way we can probably do a release in the next day or two.

@williamweckl
Copy link

@lmiller1990 I see that the other issue you pointed to is already solved. Could you release a new version with the both fixes?

Thank you! :)

@lmiller1990
Copy link
Member Author

Ok I will do it this week

@lmiller1990
Copy link
Member Author

It's out https://github.com/vuejs/vue-jest/releases/tag/v5.0.0-alpha.8

Very tiny release. I hope I can dedicate some time soon to fixing the many TS problems we have. I think it should not be too difficult.

@@ -64,6 +65,11 @@ const getBabelOptions = function loadBabelOptions(filename, options = {}) {
}

const getTsJestConfig = function getTsJestConfig(config) {
const isUsingTs = resolveTsConfigSync(process.cwd())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should support tsconfig not place at root dir.
If run npm run jest, process.cwd() always be root dir. I put tsconfig file at <rootDir>/sub.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a problem. We should support something like

// jest.config.js
module.exports = {  
  globals: {
    'vue-jest': {
      tsconfig: './some/path/tsconfig.json'
    }
  }
}

Would you like to make a PR? I can review + release when it's done. If I need to do it, it might take a while, I have a few other projects I need to work on like Test Utils 2.0.0 release etc. I'd really appreciate the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants