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.jsonyarn test:integrationwill execute files likefoo.int-test.tsyarn testwill execute unit tests matching onlyfoo.test.tsorfoo.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.jsfile. This file is automatically detected by jest.
{
"verbose": true,
"setupFiles": ["./test/setup.js"]
}