Travis CI | Circle CI |
---|---|
En este proyecto de React instalaremos las siguientes librerías:
npm install @testing-library/react --save-dev
npm install --save-dev @testing-library/react-hooks react-test-renderer
npm install --save-dev @testing-library/jest-dom
npm install cypress -D
La integración continua se ha hecho en Travis
para Jest
(unit tests) y en Circle CI
para Cypress
(e2e) y Jest
.
Tanto Jest como Cypress tienen su archivo README con la documentación y código utilizado.
Creamos el archivo de configuración para hacer debug en VSCode. En nuestro caso crearemos un sigle test, otro con --wathAll y otro para ejecutar un archivo específico de test:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest single run",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"-c",
"./config/test/jest.json",
"--verbose",
"-i",
"--no-cache"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest watch run",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"-c",
"./config/test/jest.json",
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Jest selected file",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"${fileBasenameNoExtension}",
"-c",
"./config/test/jest.json",
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}