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

Disable "global" in vitest #9

Closed
kentcdodds opened this issue May 11, 2023 · 4 comments · Fixed by #73
Closed

Disable "global" in vitest #9

kentcdodds opened this issue May 11, 2023 · 4 comments · Fixed by #73
Labels
help wanted Extra attention is needed

Comments

@kentcdodds
Copy link
Member

I tried and ran into TS issues. Would love to ditch it though.

@kentcdodds kentcdodds added the help wanted Extra attention is needed label May 11, 2023
@onemen
Copy link
Contributor

onemen commented May 19, 2023

@kentcdodds

Can you provide the draft you are working on?

I will try to work on in

@kentcdodds
Copy link
Member Author

I didn't save it. There wasn't much to it. Just remove some stuff from the vitest config and the tsconfig and things stopped working 😅 I didn't spend much time on it I'm afraid.

@onemen
Copy link
Contributor

onemen commented May 19, 2023

do you want to remove:

globals from vitest.config.ts:

  plugins: [react(), tsconfigPaths()],
  test: {
    include: ['./app/**/*.test.{ts,tsx}'],
-    globals: true,
    environment: 'jsdom',
    setupFiles: ['./other/test-setup/setup-test-env.ts'],
    globalSetup: ['./other/test-setup/global-setup.ts'],

or
global from setup-test-env.ts

declare global {
  namespace Vi {
    interface JestAssertion<T = any>
      extends jest.Matchers<void, T>,
        TestingLibraryMatchers<T, void> {}
  }
}

or ...

@kentcdodds
Copy link
Member Author

I guess I would like to remove the global test and expect but still have the testing library matchers if that's possible. It may require that we import test and expect from the vitest utils which is similar to what we do with playwright

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants