-
-
Save MAGOLEINAD/a843e5e9326eb7637d2df5767f1e70aa to your computer and use it in GitHub Desktop.
Revisions
-
Klerith revised this gist
Apr 28, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,6 +30,7 @@ module.exports = { ``` 5. Opcional, pero eventualmente necesario, crear Jest config y setup: __jest.config.js__ ``` module.exports = { -
Klerith revised this gist
Apr 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ yarn add --dev @testing-library/react @types/jest jest-environment-jsdom yarn add --dev whatwg-fetch ``` 3. Actualizar los scripts del __package.json__ ``` "scripts: { ... -
Klerith revised this gist
Apr 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ module.exports = { ``` 5. Opcional, pero eventualmente necesario, crear Jest config y setup: __jest.config.js__ ``` module.exports = { testEnvironment: 'jest-environment-jsdom', -
Klerith revised this gist
Apr 28, 2022 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ # Instalación y configuracion de Jest + React Testing Library ## En proyectos de React + Vite 1. Instalaciones: ``` yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react -
Klerith created this gist
Apr 28, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ 1. Instalaciones: ``` yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react yarn add --dev @testing-library/react @types/jest jest-environment-jsdom ``` 2. Opcional: Si usamos Fetch API en el proyecto: ``` yarn add --dev whatwg-fetch ``` 3. Actualizar los scripts del __package.json___ ``` "scripts: { ... "test": "jest --watchAll" ``` 4. Crear la configuración de babel __babel.config.js__ ``` module.exports = { presets: [ [ '@babel/preset-env', { targets: { esmodules: true } } ], [ '@babel/preset-react', { runtime: 'automatic' } ], ], }; ``` 5. Opcional, pero eventualmente necesario, crear Jest config y setup: __jest.config.js___ ``` module.exports = { testEnvironment: 'jest-environment-jsdom', setupFiles: ['./jest.setup.js'] } ``` __jest.setup.js__ ``` // En caso de necesitar la implementación del FetchAPI import 'whatwg-fetch'; // <-- yarn add whatwg-fetch ```