All things unit, integration, TDD.
- ✘ Using tools like Postman
- ✓ Writing tests in code
Integration tests should exist within source code.
- Code can be debugged with a debugger
- Tests can be more intelligent, making use of full node environment
See ./Serverless.md#integration-tests
To use jest:
- ✓ Configure your
package.json
yarn test:integration
will execute files likefoo.int-test.ts
yarn test
will execute unit tests matching onlyfoo.test.ts
orfoo.spec.ts
{
"scripts": {
"build": "tsc",
"test": "jest", // Runs your tests as configured in jest.config.js
"test:build": "jest --config '{}'", // Tests your built files, with the default config
"test:integration": "jest --testMatch '**/*.int-test.*'" // Only hits file like `fancy.int-test.ts`
}
}
- ✓ Create a
jest.config.js
file. This file is automatically detected by jest.
{
"verbose": true,
"setupFiles": ["./test/setup.js"]
}