From ed568443345088afe47c0e04004fa7cee29514fa Mon Sep 17 00:00:00 2001 From: ali ebrahimi Date: Wed, 31 Jul 2024 05:06:40 +0330 Subject: [PATCH] Run pretest scripts before test migrations --- package.json | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index bcde34b..db7864b 100644 --- a/package.json +++ b/package.json @@ -9,17 +9,18 @@ "swagger": "tsoa spec", "prebuild": "npm run swagger", "start": "NODE_ENV=development ts-node-dev --project ./tsconfig.json --respawn ./src/index.ts", - "test": "NODE_ENV=test mocha -t 30000 --exit -r ts-node/register ./test/pre-test-scripts.ts ./src/**/*.test.ts ./src/**/**/*.test.ts", - "test:notificationRepository": "NODE_ENV=test mocha -t 30000 --exit -r ts-node/register ./test/pre-test-scripts.ts ./src/repositories/notificationRepository.test.ts ", - "test:notificationSettingRepository": "NODE_ENV=test mocha -t 30000 --exit -r ts-node/register ./test/pre-test-scripts.ts ./src/repositories/notificationSettingRepository.test.ts ", + "test": "NODE_ENV=test mocha -t 30000 --exit -r ts-node/register ./test/pre-test-scripts.ts ./src/**/*.test.ts ./src/**/**/*.test.ts", + "test:notificationRepository": "NODE_ENV=test mocha -t 30000 --exit -r ts-node/register ./test/pre-test-scripts.ts ./src/repositories/notificationRepository.test.ts", + "test:notificationSettingRepository": "NODE_ENV=test mocha -t 30000 --exit -r ts-node/register ./test/pre-test-scripts.ts ./src/repositories/notificationSettingRepository.test.ts", "lint": "eslint", "lint:fix": "eslint --fix", - "prettify": "prettier --write '**/*.ts*'", + "prettify": "prettier --write '**/*.ts*'", + "db:setup:test": "ts-node -r tsconfig-paths/register ./test/pre-test-scripts.ts", "db:migrate:run:local": "NODE_ENV=development ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:run -d ./src/dataSource.ts", "db:migrate:run:staging": "NODE_ENV=staging ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:run -d ./src/dataSource.ts", "db:migrate:revert:local": "NODE_ENV=development ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:revert -d ./src/dataSource.ts", - "db:migrate:run:test": "NODE_ENV=test ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:run -d ./src/dataSource.ts", - "db:migrate:revert:test": "NODE_ENV=test ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:revert -d ./src/dataSource.ts", + "db:migrate:run:test": "npm run db:setup:test && NODE_ENV=test ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:run -d ./src/dataSource.ts", + "db:migrate:revert:test": "npm run db:setup:test && NODE_ENV=test ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:revert -d ./src/dataSource.ts", "start:server:staging": "npm run db:migrate:run:staging && cd dist && pm2-runtime src/index.js", "db:migrate:run:production": "NODE_ENV=production ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js migration:run -d ./src/dataSource.ts", "start:server:production": "npm run db:migrate:run:production && cd dist && pm2-runtime src/index.js"