From 0f76b9fbab459c71ec23eef4a6b9d510f91b9b40 Mon Sep 17 00:00:00 2001 From: Dmitry Zhigulin <104712148+faciledictu@users.noreply.github.com> Date: Thu, 3 Aug 2023 14:47:44 +0400 Subject: [PATCH] Fix node_env when tests run --- Makefile | 2 +- backend/package.json | 1 + package.json | 8 +++++--- playwright.config.ts | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5398e775..651f13da 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ db-generate: make -C backend db-generate start: - yarn run npm-run-all start + yarn run start:dev start-prod: make -C backend start-prod diff --git a/backend/package.json b/backend/package.json index d9bacb24..57bfa25f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -10,6 +10,7 @@ "start": "PORT=5001 nest start", "typeorm": "typeorm-ts-node-commonjs", "start:debug": "NODE_ENV=development PORT=5001 nest start --debug --watch", + "start:test": "NODE_ENV=test PORT=5001 nest start --debug --watch", "start:prod": "node dist/main", "lint": "eslint \"{src,apps,libs,test}/**/*.ts\"", "lint-fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", diff --git a/package.json b/package.json index 2ae7c4f4..cc66b9e8 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,12 @@ "build:frontend": "DISABLE_ESLINT_PLUGIN=true yarn workspace frontend run build", "build": "npm-run-all --parallel build:*", "production": "yarn workspace backend run start:prod", - "start:backend": "yarn workspace backend run start:debug", + "start:backend:dev": "yarn workspace backend run start:debug", + "start:backend:test": "yarn workspace backend run start:test", "start:frontend": "yarn workspace frontend run start", - "start": "npm-run-all --parallel start:*", - "test": "playwright test --trace on" + "start:dev": "npm-run-all --parallel start:backend:dev start:frontend", + "start:test": "npm-run-all --parallel start:backend:test start:frontend", + "test": "playwright test --trace on" }, "repository": { "type": "git", diff --git a/playwright.config.ts b/playwright.config.ts index d6ea2a41..e18e0ecf 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -18,7 +18,7 @@ export default defineConfig({ * Maximum time expect() should wait for the condition to be met. * For example in `await expect(locator).toHaveText();` */ - timeout: 5000 + timeout: 5000, }, /* Run tests in files in parallel */ fullyParallel: true, @@ -88,7 +88,7 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: 'npm run start', + command: 'yarn run start:test', port: 3000, reuseExistingServer: !process.env.CI, env: {