-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c2897c
commit e687fab
Showing
12 changed files
with
7,038 additions
and
1,566 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* eslint-disable */ | ||
import 'jest-extended'; |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint no-process-env: "off" */ | ||
/* eslint import/no-extraneous-dependencies: "off" */ | ||
/* eslint @typescript-eslint/no-var-requires: "off" */ | ||
|
||
// Why this file is .js and not .ts | ||
// https://github.com/kulshekhar/ts-jest/issues/411 | ||
|
||
const dotenv = require('dotenv'); | ||
const path = require('path'); | ||
|
||
dotenv.config({ path: path.resolve(__dirname, '.env.test') }); | ||
|
||
module.exports = async () => { | ||
const db = process.env.PGDATABASE; | ||
|
||
if (db && db !== 'test') { | ||
// eslint-disable-next-line | ||
console.error(` | ||
> jest-global-setup.js | ||
Running test on a non 'test' db will wipe out your entire db! | ||
PGDATABASE is specified as '${db}' and not 'test'. Aborting... | ||
`); | ||
throw new Error(); | ||
} | ||
}; |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const { resolve } = require('path'); // eslint-disable-line @typescript-eslint/no-var-requires | ||
|
||
module.exports = { | ||
transform: { | ||
'^.+\\.ts$': 'ts-jest' | ||
}, | ||
testMatch: ['**/tests/**/*.test.ts'], | ||
moduleNameMapper: { | ||
'^src/(.*)$': resolve(__dirname, './src/$1') | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'json'], | ||
moduleDirectories: ['node_modules'], | ||
modulePathIgnorePatterns: ['directoryNameToIgnore'], | ||
collectCoverage: false, // only collect coverage on full test suite run (see package.json script) | ||
collectCoverageFrom: ['!src/**/index.ts', '!src/routes.ts', 'src/**/*.ts'], | ||
coveragePathIgnorePatterns: ['/node_modules/', 'build/'], | ||
coverageReporters: ['json', 'json-summary', 'lcov', 'text', 'text-summary', 'html'], | ||
testEnvironment: 'node', | ||
verbose: true, | ||
setupFiles: ['./jest.setup.ts'], | ||
setupFilesAfterEnv: ['jest-extended'], | ||
globalSetup: './jest-global-setup.js' | ||
}; |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import 'reflect-metadata'; | ||
|
||
jest.setTimeout(3000); |
Oops, something went wrong.