- Instalaciones
yarn add -D vitest jsdom @vitest/ui @testing-library/react @testing-library/jest-dom @vitest/coverage-c8
- Configuraciones
2.1 Crear el archivo setupTests.ts en el root con lo siguiente:
import "@testing-library/jest-dom";
import matchers from "@testing-library/jest-dom/matchers";
import { expect } from "vitest";
expect.extend(matchers);
2.2 En el tsconfig.json, insertar lo siguiente dentro de compilerOptions:"types": ["vitest/globals"]
\
- Instalaciones
yarn add -D vitest jsdom @vitest/ui @testing-library/react @vitest/coverage-c8
- Configuraciones
2.1 En vite.config.js, a帽adir lo siguiente al defineConfig:
test: { environment: 'jsdom', globals: true }
2.2 En package.json, a帽adir lo siguiente dentro de scripts:
"test": "vitest",
"test:ui": "vitest --ui",\
This file contains hidden or 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
function parseJwt (token) { | |
var base64Url = token.split('.')[1]; | |
var base64 = base64Url.replace('-', '+').replace('_', '/'); | |
return JSON.parse(window.atob(base64)); | |
}; |
NewerOlder