check-code-coverage icon indicating copy to clipboard operation
check-code-coverage copied to clipboard

--from flag not working

Open markgoho opened this issue 5 years ago • 5 comments

Marks-MacBook-Pro:enroll-ui markgoho$ DEBUG=check-code-coverage npx update-badge --from apps/admin-e2e/coverage/coverage-summary.json
  check-code-coverage args: { _: [], '--from': 'apps/admin-e2e/coverage/coverage-summary.json' } +0ms
  check-code-coverage reading coverage from { filename: 'apps/admin-e2e/coverage/coverage-summary.json' } +0ms
  check-code-coverage reading coverage summary from: apps/admin-e2e/coverage/coverage-summary.json +1ms
Cannot find module 'apps/admin-e2e/coverage/coverage-summary.json'
Require stack:
- /Users/markgoho/Projects/enroll-ui/node_modules/check-code-coverage/src/index.js
- /Users/markgoho/Projects/enroll-ui/node_modules/check-code-coverage/bin/update-badge.js

Project folders: image

Is npx doing something weird?

markgoho avatar Jul 01 '20 20:07 markgoho

Maybe, I would run this with relative path like --from ./apps/.. just to see what is going on.

bahmutov avatar Jul 01 '20 20:07 bahmutov

Also @markgoho thanks for trying it out, appreciate it. Please open any issues and contribute to this repo, I think code coverage and tooling around it could be greatly improved.

bahmutov avatar Jul 01 '20 20:07 bahmutov

@bahmutov update, this works /Users/markgoho/Projects/enroll-ui/apps/admin-e2e/coverage/coverage-summary.json as the --from path

./apps/admin... does not work

markgoho avatar Jul 01 '20 20:07 markgoho

I got the same error using npx -p check-code-coverage set-gh-status --from coverage/e2e/coverage-final.json

Stacktrace
Error: Cannot find module '/home/runner/work/mui-next-ts/mui-next-ts/coverage/coverage-summary.json'
Require stack:
- /home/runner/.npm/_npx/4453/lib/node_modules/check-code-coverage/src/index.js
- /home/runner/.npm/_npx/4453/lib/node_modules/check-code-coverage/bin/set-gh-status.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at readCoverage (/home/runner/.npm/_npx/4453/lib/node_modules/check-code-coverage/src/index.js:19:20)
    at setGitHubCommitStatus (/home/runner/.npm/_npx/4453/lib/node_modules/check-code-coverage/bin/set-gh-status.js:17:25)
    at Object. (/home/runner/.npm/_npx/4453/lib/node_modules/check-code-coverage/bin/set-gh-status.js:135:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/runner/.npm/_npx/4453/lib/node_modules/check-code-coverage/src/index.js',
    '/home/runner/.npm/_npx/4453/lib/node_modules/check-code-coverage/bin/set-gh-status.js'
  ]
}

leosuncin avatar Dec 21 '20 00:12 leosuncin

I guess the error is because from parameter is not passed inside options

https://github.com/bahmutov/check-code-coverage/blob/0f08bb24fad6bb0e429e6a28fca649843e80806e/bin/set-gh-status.js#L124-L127

leosuncin avatar Dec 21 '20 04:12 leosuncin