-
-
Save arroyostack/391a69780abea5c896414bc323d68024 to your computer and use it in GitHub Desktop.
Revisions
-
arroyostack revised this gist
Jul 13, 2023 . 1 changed file with 2 additions and 2 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,5 +1,5 @@ ## Installs and configuration for Jest + React Testing Library ## For React + Vite projects 1. Necessary installs: ``` -
arroyostack revised this gist
Jul 13, 2023 . 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 @@ -19,7 +19,7 @@ yarn add --dev whatwg-fetch "test": "jest --watchAll" ``` 4. Create babel configuration file __babel.config.js__. Warning!: if you get a module type error, rename file to extension __.cjs__ ``` module.exports = { presets: [ -
arroyostack revised this gist
Jul 13, 2023 . 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 @@ -19,7 +19,7 @@ yarn add --dev whatwg-fetch "test": "jest --watchAll" ``` 4. Create babel configuration file __babel.config.js__. Warning if you get module type error rename to extension __.cjs__ ``` module.exports = { presets: [ -
arroyostack revised this gist
Jul 13, 2023 . 1 changed file with 6 additions and 6 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,25 +1,25 @@ # Instalación y configuracion de Jest + React Testing Library ## En proyectos de React + Vite 1. Necessary installs: ``` yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react yarn add --dev @testing-library/react @types/jest jest-environment-jsdom ``` 2. Optional: If we use Fetch API in the project: ``` yarn add --dev whatwg-fetch ``` 3. Update __package.json__ scripts ``` "scripts: { ... "test": "jest --watchAll" ``` 4. Create babel configuration file __babel.config.js__. ``` module.exports = { presets: [ @@ -29,7 +29,7 @@ module.exports = { }; ``` 5. Optional, but eventually necessary, create Jest config and setup: __jest.config.js__ ``` @@ -41,7 +41,7 @@ module.exports = { __jest.setup.js__ ``` // In case you need to implement the FetchAPI import 'whatwg-fetch'; // <-- yarn add whatwg-fetch ``` -
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 ```