-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Corrige os erros causados pelo migração para o vite (#239)
* fix: add augmentation in vite.config.ts * fix: vitest wrong configuration * fix: change process to import.meta * fix: remove unused eslint directive --------- Co-authored-by: Andre Almeida <[email protected]>
- Loading branch information
1 parent
988bc9e
commit 7389c58
Showing
10 changed files
with
4,679 additions
and
11,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
/// <reference types="vite/client" /> | ||
|
||
interface ImportMetaEnv { | ||
readonly REACT_APP_SENTRY_KEY: string; | ||
// more env variables... | ||
} | ||
|
||
interface ImportMeta { | ||
readonly env: ImportMetaEnv; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
// add Vitest functions here globally | ||
import { expect, afterEach } from 'vitest'; | ||
import { cleanup } from '@testing-library/react'; | ||
import matchers from '@testing-library/jest-dom/matchers'; | ||
import { cleanup } from '@testing-library/react'; | ||
import { expect, afterEach } from 'vitest'; | ||
|
||
// Extend Vitest's expect method with methods from react-testing-library | ||
expect.extend(matchers); | ||
|
||
// Run cleanup after each test case (e.g., clearing jsdom) | ||
afterEach(() => { | ||
vi.clearAllMocks(); | ||
cleanup(); | ||
}); | ||
|
||
beforeEach(() => { | ||
// https://github.com/vitest-dev/vitest/issues/4223 | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
window.scrollTo = vi.fn<any>(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { defineConfig, mergeConfig } from 'vitest/config'; | ||
|
||
import viteConfig from './vite.config'; | ||
|
||
export default mergeConfig( | ||
viteConfig, | ||
defineConfig({ | ||
server: { open: false }, | ||
test: { | ||
globals: true, | ||
environment: 'jsdom', | ||
coverage: { | ||
provider: 'istanbul', | ||
}, | ||
setupFiles: ['src/setupTests.ts'], | ||
include: ['src/**/*.spec.ts', 'src/**/*.spec.tsx'], | ||
css: { | ||
modules: { classNameStrategy: 'non-scoped' }, | ||
}, | ||
}, | ||
}) | ||
); |
Oops, something went wrong.