Skip to content

Instantly share code, notes, and snippets.

@samuelastech
Last active October 3, 2022 19:19
Show Gist options
  • Save samuelastech/4c6aefb9de0a5f9d014dab6af5b7f20a to your computer and use it in GitHub Desktop.
Save samuelastech/4c6aefb9de0a5f9d014dab6af5b7f20a to your computer and use it in GitHub Desktop.
Jest and supertest setup
{
"scripts": {
"test": "jest --watch --verbose",
"test-coverage": "jest --coverage"
},
"devDependencies": {
"@faker-js/faker": "...",
"factory-girl": "...",
"faker": "...",
"jest": "...",
"mongodb-memory-server": "...",
"supertest": "..."
}
}
import { compilerOptions } from './tsconfig.json'
import { pathsToModuleNameMapper } from 'ts-jest'
export default {
bail: true,
clearMocks: true,
collectCoverage: true,
coverageDirectory: 'coverage',
coverageProvider: 'v8',
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>' }),
preset: 'ts-jest'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment