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

@golevelup/ts-vitest #613

Closed
sschneider-ihre-pvs opened this issue Jul 3, 2023 · 4 comments · Fixed by #702
Closed

@golevelup/ts-vitest #613

sschneider-ihre-pvs opened this issue Jul 3, 2023 · 4 comments · Fixed by #702
Labels
enhancement New feature or request testing

Comments

@sschneider-ihre-pvs
Copy link

would it be possible to make a similar createMock for vitest like in @golevelup/ts-jest? I guess it would be something like %s/jest/vi/g or something.

@underfisk
Copy link
Contributor

@sschneider-ihre-pvs It is possible but createMock does only work with jest as you can see in the source.
I've played with https://github.com/eratio08/vitest-mock-extended in the past and worked just fine, you might give it a shot but unfortunately Vitest came way after this library even exist 😅

@underfisk underfisk added enhancement New feature or request testing labels Jul 3, 2023
@ikar1234
Copy link

Sorry, but I don't understand what the issue is. I copied the contents of the mocks.ts file, replaced all occurrences of jest with vi, and all tests are passing.

It's a single file, so it's not an issue for us to simply copy it to our codebases, but it would definitely be an improvement to have a separate package for this.

@jderochervlk
Copy link
Contributor

Hi, we just did the same thing. It should be easy enough to add in a vitest file.

jderochervlk added a commit to jderochervlk/nestjs that referenced this issue Feb 26, 2024
Copied over the ts-jest files and adapted them to work with Vitest, so now you can use these testing
utils with Vitest.

fix golevelup#613
jderochervlk added a commit to jderochervlk/nestjs that referenced this issue Feb 26, 2024
Copied over the ts-jest files and adapted them to work with Vitest, so now you can use these testing
utils with Vitest.

fix golevelup#613
jderochervlk added a commit to jderochervlk/nestjs that referenced this issue Feb 26, 2024
Copied over the ts-jest files and adapted them to work with Vitest, so now you can use these testing
utils with Vitest.

fix golevelup#613
@jderochervlk
Copy link
Contributor

Opened up a PR that adds support for Vitest: #702

underfisk pushed a commit that referenced this issue Feb 27, 2024
…ils (#702)

* feat(ts-vitest): added a new package to support vitest for testing utils

Copied over the ts-jest files and adapted them to work with Vitest, so now you can use these testing
utils with Vitest.

fix #613

* fix(ts-vitest): set type to module

* ci(ts-vitest): exclude from jest and add vite config

* ci(ts-vitest): add coverage

* ci(ts-vitest): add missing deps

* ci(ts-vitest): only run vitest on Node 18

* ci(ts-vitest): move vitest to optional dependencies

* ci(ts-vitest): only build on Node 18

* ci(ts-vitest): fix build commands
Cellule added a commit to Cellule/nestjs that referenced this issue Mar 4, 2024
ts-vitest is meant to be imported by vitest as such it needs to be a proper ESM module. The
package.json already defined it as "type": "module", but the typescript build was still generating a
CommonJS build. This fix updates the typescript configuration to output an ESM module.

re golevelup#613
underfisk pushed a commit that referenced this issue Mar 6, 2024
ts-vitest is meant to be imported by vitest as such it needs to be a proper ESM module. The
package.json already defined it as "type": "module", but the typescript build was still generating a
CommonJS build. This fix updates the typescript configuration to output an ESM module.

re #613
WonderPanda pushed a commit that referenced this issue Apr 10, 2024
ts-vitest is meant to be imported by vitest as such it needs to be a proper ESM module. The
package.json already defined it as "type": "module", but the typescript build was still generating a
CommonJS build. This fix updates the typescript configuration to output an ESM module.

re #613
WonderPanda pushed a commit that referenced this issue Apr 10, 2024
ts-vitest is meant to be imported by vitest as such it needs to be a proper ESM module. The
package.json already defined it as "type": "module", but the typescript build was still generating a
CommonJS build. This fix updates the typescript configuration to output an ESM module.

re #613
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants