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

feat: Added test coverage reporting and requirements #3204

Merged
merged 1 commit into from
Feb 6, 2025
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.oclif.manifest.json
/packages/**/oclif.manifest.json
/cli
/.nyc_output
/coverage
/dist
/lib
Expand All @@ -15,7 +16,7 @@ node_modules
.idea
.vscode
**/.nyc_output

**/coverage/
.pnp.*
.yarn/*
!.yarn/patches
Expand Down
9 changes: 9 additions & 0 deletions packages/cli/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"require": [
"ts-node/register",
"source-map-support/register"
],
"recursive": true,
"extension": ["ts"],
"timeout": 360000
}
33 changes: 33 additions & 0 deletions packages/cli/nyc-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
cache: false,
extension: ['.ts'],
exclude: [
'**/*.d.ts',
'**/*.test.ts',
'**/*.spec.ts',
'test/**/*',
'lib/**/*',
'coverage/**',
'.nyc_output/**',
],
include: [
'src/**/*.ts',
],
reporter: [
'text-summary',
'html',
'lcov',
],
all: true,
'check-coverage': true,
statements: 80,
branches: 80,
functions: 80,
lines: 80,
require: [
'ts-node/register',
'source-map-support/register',
],
sourceMap: true,
instrument: true,
}
9 changes: 7 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
},
"devDependencies": {
"@heroku-cli/schema": "^1.0.25",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@oclif/test": "^2.3.28",
"@types/ansi-styles": "^3.2.1",
"@types/bytes": "^3.1.4",
Expand Down Expand Up @@ -127,10 +128,11 @@
"read-pkg": "^4.0.1",
"rimraf": "5.0.5",
"sinon": "^19.0.2",
"source-map-support": "^0.5.21",
"std-mocks": "^2.0.0",
"strip-ansi": "6.0.1",
"tmp": "^0.2.3",
"ts-node": "^10.9.1",
"ts-node": "^10.9.2",
"typescript": "4.8.4"
},
"engines": {
Expand Down Expand Up @@ -378,14 +380,17 @@
"build": "rm -rf lib && tsc",
"build:dev": "rm -rf lib && tsc --sourcemap",
"lint": "eslint . --ext .ts --config ../../.eslintrc --ignore-path ../../.eslintignore-lib",
"coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
"coverage:html": "nyc --reporter=html --reporter=text-summary npm run test",
"coverage:check": "nyc --check-coverage --branches 80 --statements 80 --functions 80 --lines 80 npm run test",
"postpublish": "rm -f oclif.manifest.json",
"prepack": "yarn run build && oclif manifest",
"pretest": "tsc -p test --noEmit && cd ../.. && yarn build",
"test:acceptance": "yarn pretest && mocha --forbid-only \"test/**/*.acceptance.test.ts\" && node ./bin/bats-test-runner",
"test:integration": "yarn pretest && mocha --forbid-only \"test/**/*.integration.test.ts\"",
"test:smoke": "yarn pretest && mocha --forbid-only \"test/**/smoke.acceptance.test.ts\"",
"test:unit:justTest:local": "nyc mocha \"test/**/*.unit.test.ts\"",
"test:unit:justTest:ci": "nyc mocha --forbid-only \"test/**/*.unit.test.ts\"",
"test:unit:justTest:ci": "nyc --reporter=lcov --reporter=text-summary mocha --forbid-only \"test/**/*.unit.test.ts\"",
"test": "yarn pretest && yarn test:unit:justTest:ci",
"test:local": "yarn pretest && yarn test:unit:justTest:local",
"version": "oclif readme --multi && git add README.md ../../docs"
Expand Down
65 changes: 63 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,17 @@ __metadata:
languageName: node
linkType: hard

"@istanbuljs/nyc-config-typescript@npm:^1.0.2":
version: 1.0.2
resolution: "@istanbuljs/nyc-config-typescript@npm:1.0.2"
dependencies:
"@istanbuljs/schema": ^0.1.2
peerDependencies:
nyc: ">=15"
checksum: df6f9c9b17df8f1d8813f768c11ca31ec125d60bcd82d8273a467022e414d2d686ee80abb7b0f0e3c512b7ed686771fadb7fb5be8881619b9f6cb1f31b86e9f3
languageName: node
linkType: hard

"@istanbuljs/schema@npm:^0.1.2":
version: 0.1.3
resolution: "@istanbuljs/schema@npm:0.1.3"
Expand Down Expand Up @@ -10326,6 +10337,7 @@ __metadata:
"@heroku/heroku-cli-util": ^8.0.13
"@heroku/http-call": ^5.4.0
"@inquirer/prompts": ^5.0.5
"@istanbuljs/nyc-config-typescript": ^1.0.2
"@oclif/core": ^2.16.0
"@oclif/plugin-commands": 2.2.28
"@oclif/plugin-help": ^5
Expand Down Expand Up @@ -10419,6 +10431,7 @@ __metadata:
shell-quote: ^1.8.1
sinon: ^19.0.2
smooth-progress: ^1.1.0
source-map-support: ^0.5.21
sparkline: ^0.2.0
ssh2: ^1.15.0
std-mocks: ^2.0.0
Expand All @@ -10428,7 +10441,7 @@ __metadata:
term-img: ^4.1.0
tmp: ^0.2.3
true-myth: 2.2.3
ts-node: ^10.9.1
ts-node: ^10.9.2
tsheredoc: ^1.0.1
tslib: 1.14.1
tunnel-ssh: 4.1.6
Expand Down Expand Up @@ -15383,14 +15396,24 @@ __metadata:
languageName: node
linkType: hard

"source-map-support@npm:^0.5.21":
version: 0.5.21
resolution: "source-map-support@npm:0.5.21"
dependencies:
buffer-from: ^1.0.0
source-map: ^0.6.0
checksum: 43e98d700d79af1d36f859bdb7318e601dfc918c7ba2e98456118ebc4c4872b327773e5a1df09b0524e9e5063bb18f0934538eace60cca2710d1fa687645d137
languageName: node
linkType: hard

"source-map@npm:^0.5.7":
version: 0.5.7
resolution: "source-map@npm:0.5.7"
checksum: 5dc2043b93d2f194142c7f38f74a24670cd7a0063acdaf4bf01d2964b402257ae843c2a8fa822ad5b71013b5fcafa55af7421383da919752f22ff488bc553f4d
languageName: node
linkType: hard

"source-map@npm:^0.6.1":
"source-map@npm:^0.6.0, source-map@npm:^0.6.1":
version: 0.6.1
resolution: "source-map@npm:0.6.1"
checksum: 59ce8640cf3f3124f64ac289012c2b8bd377c238e316fb323ea22fbfe83da07d81e000071d7242cad7a23cd91c7de98e4df8830ec3f133cb6133a5f6e9f67bc2
Expand Down Expand Up @@ -16228,6 +16251,44 @@ __metadata:
languageName: node
linkType: hard

"ts-node@npm:^10.9.2":
version: 10.9.2
resolution: "ts-node@npm:10.9.2"
dependencies:
"@cspotcode/source-map-support": ^0.8.0
"@tsconfig/node10": ^1.0.7
"@tsconfig/node12": ^1.0.7
"@tsconfig/node14": ^1.0.0
"@tsconfig/node16": ^1.0.2
acorn: ^8.4.1
acorn-walk: ^8.1.1
arg: ^4.1.0
create-require: ^1.1.0
diff: ^4.0.1
make-error: ^1.1.1
v8-compile-cache-lib: ^3.0.1
yn: 3.1.1
peerDependencies:
"@swc/core": ">=1.2.50"
"@swc/wasm": ">=1.2.50"
"@types/node": "*"
typescript: ">=2.7"
peerDependenciesMeta:
"@swc/core":
optional: true
"@swc/wasm":
optional: true
bin:
ts-node: dist/bin.js
ts-node-cwd: dist/bin-cwd.js
ts-node-esm: dist/bin-esm.js
ts-node-script: dist/bin-script.js
ts-node-transpile-only: dist/bin-transpile.js
ts-script: dist/bin-script-deprecated.js
checksum: fde256c9073969e234526e2cfead42591b9a2aec5222bac154b0de2fa9e4ceb30efcd717ee8bc785a56f3a119bdd5aa27b333d9dbec94ed254bd26f8944c67ac
languageName: node
linkType: hard

"tsconfig-paths@npm:^3.14.1":
version: 3.14.2
resolution: "tsconfig-paths@npm:3.14.2"
Expand Down
Loading