From 726db1c0ecdac2511322bbacd28fbb54e2def650 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Wed, 6 Oct 2021 13:39:23 +0100 Subject: [PATCH] Added integration test config & moved db-driven tests - some tests are necessarily driven from the db - these are like unit tests, except they only make sense if using the db - else you have to stub too much to make them worthwhile - for these rare but important cases, we have the clear concept of integration tests --- package.json | 7 +++++-- test/{regression => integration}/exporter/exporter.test.js | 0 .../migrations/migration.test.js | 0 test/{regression => integration}/settings/settings.test.js | 0 4 files changed, 5 insertions(+), 2 deletions(-) rename test/{regression => integration}/exporter/exporter.test.js (100%) rename test/{regression => integration}/migrations/migration.test.js (100%) rename test/{regression => integration}/settings/settings.test.js (100%) diff --git a/package.json b/package.json index b3e5524bb7..55b5898449 100644 --- a/package.json +++ b/package.json @@ -27,13 +27,16 @@ "main": "grunt shell:main && grunt subgrunt:init", "build": "grunt build", "test": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000", - "test:all": "yarn test:unit && yarn test:e2e && yarn lint", + "test:all": "yarn test:unit && yarn test:integration && yarn test:e2e && yarn lint", "test:debug": "DEBUG=ghost:test* yarn test", "test:unit": "c8 --all -n 'core/{*.js,frontend,server,shared}' --reporter text-summary mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/unit' --timeout=2000", + "test:integration": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/integration' --timeout=5000", "test:e2e": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/e2e-api' './test/e2e-frontend' './test/e2e-server' --timeout=10000", "test:regression": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000", + "test:unit:slow": "yarn test:unit --reporter=mocha-slow-test-reporter", + "test:int:slow": "yarn test:integration --reporter=mocha-slow-test-reporter", + "test:e2e:slow": "yarn test:e2e --reporter=mocha-slow-test-reporter", "test:reg:slow": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000 --reporter=mocha-slow-test-reporter", - "test:slow": "yarn test:unit --reporter=mocha-slow-test-reporter && yarn test:e2e --reporter=mocha-slow-test-reporter", "cov:unit": "c8 report --all -n 'core/{*.js,frontend,server,shared}' --reporter text --reporter html", "lint:server": "eslint --ignore-path .eslintignore 'core/server/**/*.js' 'core/*.js' '*.js'", "lint:shared": "eslint --ignore-path .eslintignore 'core/shared/**/*.js'", diff --git a/test/regression/exporter/exporter.test.js b/test/integration/exporter/exporter.test.js similarity index 100% rename from test/regression/exporter/exporter.test.js rename to test/integration/exporter/exporter.test.js diff --git a/test/regression/migrations/migration.test.js b/test/integration/migrations/migration.test.js similarity index 100% rename from test/regression/migrations/migration.test.js rename to test/integration/migrations/migration.test.js diff --git a/test/regression/settings/settings.test.js b/test/integration/settings/settings.test.js similarity index 100% rename from test/regression/settings/settings.test.js rename to test/integration/settings/settings.test.js