epic-stack
epic-stack copied to clipboard
Disable "global" in vitest
I tried and ran into TS issues. Would love to ditch it though.
@kentcdodds
Can you provide the draft you are working on?
I will try to work on in
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.
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 ...
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