From f918398779f690b070b2846525ad9f8d7e66944f Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 14 Jul 2021 11:26:06 +0100 Subject: [PATCH] Added c8 test coverage to all packages refs https://github.com/TryGhost/Team/issues/870 - using `c8` allows us to see test coverage for all packages in the repo - this commit adds `c8` as a dev dependency and prepends the `mocha` command with `c8` so it runs on all tests --- ghost/adapter-manager/package.json | 3 ++- ghost/bootstrap-socket/package.json | 3 ++- ghost/constants/package.json | 3 ++- ghost/errors/package.json | 3 ++- ghost/image-transform/package.json | 3 ++- ghost/job-manager/package.json | 3 ++- ghost/limit-service/package.json | 3 ++- ghost/moleculer-service-from-class/package.json | 3 ++- ghost/mw-session-from-token/package.json | 3 ++- ghost/pretty-cli/package.json | 3 ++- ghost/promise/package.json | 3 ++- ghost/release-utils/package.json | 3 ++- ghost/security/package.json | 3 ++- ghost/session-service/package.json | 3 ++- ghost/vhost-middleware/package.json | 3 ++- ghost/zip/package.json | 3 ++- 16 files changed, 32 insertions(+), 16 deletions(-) diff --git a/ghost/adapter-manager/package.json b/ghost/adapter-manager/package.json index aa92d735cb..d1ec93d412 100644 --- a/ghost/adapter-manager/package.json +++ b/ghost/adapter-manager/package.json @@ -8,7 +8,7 @@ "types": "types/index.d.ts", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint", "pretest": "yarn types", @@ -24,6 +24,7 @@ "devDependencies": { "@types/mocha": "8.2.3", "@types/sinon": "10.0.2", + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0", diff --git a/ghost/bootstrap-socket/package.json b/ghost/bootstrap-socket/package.json index 829a571ca5..d36c4b9e5e 100644 --- a/ghost/bootstrap-socket/package.json +++ b/ghost/bootstrap-socket/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/constants/package.json b/ghost/constants/package.json index 374eea3e44..e5af417502 100644 --- a/ghost/constants/package.json +++ b/ghost/constants/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/errors/package.json b/ghost/errors/package.json index 375fa0e696..6b5a21cac1 100644 --- a/ghost/errors/package.json +++ b/ghost/errors/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/image-transform/package.json b/ghost/image-transform/package.json index bf59005a7a..8339f6c82c 100644 --- a/ghost/image-transform/package.json +++ b/ghost/image-transform/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/job-manager/package.json b/ghost/job-manager/package.json index aae39c5c20..79e4ec9a7f 100644 --- a/ghost/job-manager/package.json +++ b/ghost/job-manager/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -20,6 +20,7 @@ }, "devDependencies": { "@sinonjs/fake-timers": "7.1.2", + "c8": "7.7.3", "date-fns": "2.22.1", "delay": "5.0.0", "mocha": "9.0.0", diff --git a/ghost/limit-service/package.json b/ghost/limit-service/package.json index 6bbf0fc6a2..63b0ed6b81 100644 --- a/ghost/limit-service/package.json +++ b/ghost/limit-service/package.json @@ -8,7 +8,7 @@ "exports": "./lib/limit-service.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -20,6 +20,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/moleculer-service-from-class/package.json b/ghost/moleculer-service-from-class/package.json index 1b77099dfe..f352a93aae 100644 --- a/ghost/moleculer-service-from-class/package.json +++ b/ghost/moleculer-service-from-class/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "types": "rm -rf types && tsc", "pretest": "yarn types", @@ -21,6 +21,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0", diff --git a/ghost/mw-session-from-token/package.json b/ghost/mw-session-from-token/package.json index fa3acb09fa..bcf0cf81b3 100644 --- a/ghost/mw-session-from-token/package.json +++ b/ghost/mw-session-from-token/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "types": "rm -r types && tsc", "pretest": "yarn types", @@ -23,6 +23,7 @@ "devDependencies": { "@types/express": "4.17.13", "@types/mocha": "8.2.3", + "c8": "7.7.3", "express": "4.17.1", "mocha": "9.0.0", "should": "13.2.3", diff --git a/ghost/pretty-cli/package.json b/ghost/pretty-cli/package.json index 1e37372704..fdfebb6083 100644 --- a/ghost/pretty-cli/package.json +++ b/ghost/pretty-cli/package.json @@ -8,7 +8,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha ./test/**/*.test.js", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -20,6 +20,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/promise/package.json b/ghost/promise/package.json index 5b505e2ecd..dca635bb81 100644 --- a/ghost/promise/package.json +++ b/ghost/promise/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/release-utils/package.json b/ghost/release-utils/package.json index ec1217b941..f899273729 100644 --- a/ghost/release-utils/package.json +++ b/ghost/release-utils/package.json @@ -7,7 +7,7 @@ "main": "lib/index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -18,6 +18,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/security/package.json b/ghost/security/package.json index b42586b774..4086584ae5 100644 --- a/ghost/security/package.json +++ b/ghost/security/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "should": "13.2.3", "sinon": "11.0.0" diff --git a/ghost/session-service/package.json b/ghost/session-service/package.json index 9fcbe773d4..0de44bf38a 100644 --- a/ghost/session-service/package.json +++ b/ghost/session-service/package.json @@ -8,7 +8,7 @@ "types": "./types/index.d.ts", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint", "pretest": "yarn types", @@ -24,6 +24,7 @@ "devDependencies": { "@types/express": "4.17.13", "@types/mocha": "8.2.3", + "c8": "7.7.3", "express": "4.17.1", "mocha": "9.0.0", "should": "13.2.3", diff --git a/ghost/vhost-middleware/package.json b/ghost/vhost-middleware/package.json index a4d6d217d7..9c62bc21cd 100644 --- a/ghost/vhost-middleware/package.json +++ b/ghost/vhost-middleware/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "mocha": "9.0.0", "supertest": "6.1.3" } diff --git a/ghost/zip/package.json b/ghost/zip/package.json index af11b4ecb5..33b36c0a68 100644 --- a/ghost/zip/package.json +++ b/ghost/zip/package.json @@ -7,7 +7,7 @@ "main": "index.js", "scripts": { "dev": "echo \"Implement me!\"", - "test": "NODE_ENV=testing mocha './test/**/*.test.js'", + "test": "NODE_ENV=testing c8 mocha './test/**/*.test.js'", "lint": "eslint . --ext .js --cache", "posttest": "yarn lint" }, @@ -19,6 +19,7 @@ "access": "public" }, "devDependencies": { + "c8": "7.7.3", "folder-hash": "4.0.1", "mocha": "9.0.0", "should": "13.2.3",