I can't get Travis CI and local builds to send coverage information to coveralls.io. Travis CI and my local machine builds was successfully capture in coveralls.io, but coverage still show nothing (0% coverage).
Here is my GitHub repo, Travis CI and coveralls.io page.
Here is how my "script" value look like in package.json
"scripts": {
"pretest": "eslint .",
"test": "jest --coverage",
"test:coveralls": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"test:coverallsLocal": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
},
And here is my travis.yml file
language: node_js
node_js:
- node
install:
- npm ci --no-optional
script:
- npm run test:coveralls
after_success:
- echo -e "Test Success"
Including verbose option for coveralls. Here is the result:
> generator-vscode-typescript-jest@0.2.19 test:coverallsVerbose
> jest --coverage && cat ./coverage/lcov.info | coveralls -v
PASS __tests__/app.js
generator-vscode-typescript-jest:app
✓ creates files (1 ms)
console.warn
yeoman-test: question website was asked but answer was not provided
at CustomDummyPrompt.Object.<anonymous>.DummyPrompt.run (node_modules/yeoman-test/lib/adapter.js:43:15)
----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
index.js | 100 | 100 | 100 | 100 |
----------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 2.4 s
Ran all test suites.
[debug] "2021-03-06T07:10:40.095Z" 'TN:\n' +
'SF:../../home/travis/build/koonfoon/generator-vscode-typescript-jest/generators/app/index.js\n' +
'FN:8,(anonymous_0)\n' +
'FN:51,(anonymous_1)\n' +
'FN:60,(anonymous_2)\n' +
'FN:102,(anonymous_3)\n' +
'FNF:4\n' +
'FNH:4\n' +
'FNDA:1,(anonymous_0)\n' +
'FNDA:1,(anonymous_1)\n' +
'FNDA:1,(anonymous_2)\n' +
'FNDA:1,(anonymous_3)\n' +
'DA:2,1\n' +
'DA:3,1\n' +
'DA:4,1\n' +
'DA:5,1\n' +
'DA:7,1\n' +
'DA:10,1\n' +
'DA:18,1\n' +
'DA:51,1\n' +
'DA:53,1\n' +
'DA:54,1\n' +
'DA:62,1\n' +
'DA:66,1\n' +
'DA:70,1\n' +
'DA:74,1\n' +
'DA:82,1\n' +
'DA:92,1\n' +
'DA:97,1\n' +
'DA:98,1\n' +
'DA:99,1\n' +
'DA:103,1\n' +
'LF:20\n' +
'LH:20\n' +
'BRF:0\n' +
'BRH:0\n' +
'end_of_record\n'
[debug] "2021-03-06T07:10:40.096Z" 'user options undefined'
[debug] "2021-03-06T07:10:40.103Z" 'No valid .coveralls.yml file found'
[debug] "2021-03-06T07:10:40.127Z" {
service_name: 'travis-ci',
service_number: '33',
service_job_id: '488741007',
service_pull_request: 'false',
run_at: '2021-03-06T07:10:40.101Z',
git: {
head: {
id: 'HEAD',
committer_name: 'koonfoon',
committer_email: 'koonfoon@gmail.com',
message: 'trigger travis ci build 3.09pm +semver: skip',
author_name: 'koonfoon',
author_email: 'koonfoon@gmail.com'
},
branch: 'master',
remotes: [ [Object] ]
}
}
[debug] "2021-03-06T07:10:40.129Z" 'in: ' ''
[info] "2021-03-06T07:10:40.133Z" 'sending this to coveralls.io: ' '{"source_files":[],"git":{"head":{"id":"HEAD","committer_name":"koonfoon","committer_email":"koonfoon@gmail.com","message":"trigger travis ci build 3.09pm +semver: skip","author_name":"koonfoon","author_email":"koonfoon@gmail.com"},"branch":"master","remotes":[{"name":"origin","url":"https://github.com/koonfoon/generator-vscode-typescript-jest.git"}]},"run_at":"2021-03-06T07:10:40.101Z","service_name":"travis-ci","service_number":"33","service_job_id":"488741007","service_pull_request":"false"}'
[debug] "2021-03-06T07:10:41.263Z" 200
[debug] "2021-03-06T07:10:41.264Z" '{"message":"Job #33.1","url":"https://coveralls.io/jobs/76252693"}'
The command "npm run test:coverallsVerbose" exited with 0.
cache.2
store build cache
after_success
0.00s$ echo -e "Test Success"
Done. Your build exited with 0.
This section at the start of lcov.info file:
'SF:../../home/travis/build/koonfoon/generator-vscode-typescript-jest/generators/app/index.js\n'
is always a absolute path, I think it should be relative path, like:
'SF:generators/app/index.js'
But how to make a relative path?
Here is the link to the build