Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: db teardown for data mutation tests #159

Merged
merged 7 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
with:
port: 8001
- run: pnpm --filter api install
- run: pnpm run --filter api db:init
- run: pnpm run --filter api db:test:init
- run: pnpm --filter api run test:mutate:data

build-api:
Expand Down
3 changes: 2 additions & 1 deletion services/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"start:debug": "NODE_ENV=development nest start --debug --watch",
"db:init": "NODE_ENV=development ts-node ./scripts/db/init.ts",
"db:drop": "NODE_ENV=development ts-node ./scripts/db/drop.ts",
"db:test:init": "NODE_ENV=test ts-node ./scripts/db/init.ts",
"db:test:drop": "NODE_ENV=test ts-node ./scripts/db/drop.ts",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix --max-warnings 0",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:mutate": "stryker run",
"test:mutate:data": "stryker run stryker.data.conf.mjs",
"test:mutate:data": "NODE_ENV=test SKIP_DB_SETUP=true stryker run stryker.data.conf.mjs",
"test:int": "jest --config ./test/jest-e2e.config.cjs",
"docs:generate": "typedoc",
"docs:serve": "http-server docs"
Expand Down
5 changes: 5 additions & 0 deletions services/api/src/fixtures/setup-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { Test, TestingModule } from '@nestjs/testing';
import { LoggerModule } from '@app/app.logger';

const setup = async () => {
// Setup and teardown should be done manually for mutation tests
if (process.env.SKIP_DB_SETUP === 'true') {
return;
}

const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [DataModule, LoggerModule],
}).compile();
Expand Down
5 changes: 5 additions & 0 deletions services/api/src/fixtures/teardown-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { Test, TestingModule } from '@nestjs/testing';
import { LoggerModule } from '@app/app.logger';

const setup = async () => {
// Setup and teardown should be done manually for mutation tests
if (process.env.SKIP_DB_SETUP === 'true') {
return;
}

const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [DataModule, LoggerModule],
}).compile();
Expand Down
Loading