Skip to content

Commit

Permalink
Merge pull request #1234 from fluent-ffmpeg/chore/coverage
Browse files Browse the repository at this point in the history
chore: coverage using nyc+coveralls
  • Loading branch information
njoyard authored Nov 12, 2023
2 parents 4bb6643 + 1ebc5eb commit 843e57f
Show file tree
Hide file tree
Showing 8 changed files with 1,288 additions and 384 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: CI Testing
on: pull_request
on:
pull_request:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -12,7 +16,7 @@ jobs:
- name: Install flvtool2
run: sudo gem install flvtool2
- name: Install ffmpeg
run: sudo apt update && sudo apt install -y ffmpeg
run: sudo apt install -y ffmpeg
- name: Setup node
uses: actions/setup-node@v3
with:
Expand All @@ -22,3 +26,21 @@ jobs:
run: yarn
- name: Run tests
run: yarn test
- name: Generate coverage report
run: yarn coverage
- name: Store coverage
uses: coverallsapp/github-action@v2
with:
flag-name: linux-node-${{ matrix.node }}
parallel: true

finish:
needs: test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "linux-node-18,linux-node-20,linux-node-21"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.project
node_modules
lib-cov
.nyc_output
*.swp
.idea
*.iml
coverage
11 changes: 1 addition & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ test:
test-colors:
@NODE_ENV=test $(MOCHA) --require should --reporter $(REPORTER) --colors

test-cov: test/coverage.html

test/coverage.html: lib-cov
@FLUENTFFMPEG_COV=1 NODE_ENV=test $(MOCHA) --require should --reporter html-cov > test/coverage.html

lib-cov:
@rm -fr ./$@
@jscoverage lib $@

publish:
@npm version patch -m "version bump"
@npm publish
Expand All @@ -26,4 +17,4 @@ JSDOC_CONF = tools/jsdoc-conf.json
doc:
$(JSDOC) --configure $(JSDOC_CONF)

.PHONY: test test-cov lib-cov test-colors publish doc
.PHONY: test test-colors publish doc
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1459,12 +1459,6 @@ To run unit tests, first make sure you installed npm dependencies (run `npm inst
$ make test
```

If you want to re-generate the test coverage report (filed under test/coverage.html), run

```sh
$ make test-cov
```

Make sure your ffmpeg installation is up-to-date to prevent strange assertion errors because of missing codecs/bugfixes.

## Main contributors
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require(`./lib${process.env.FLUENTFFMPEG_COV ? '-cov' : ''}/fluent-ffmpeg`);
module.exports = require('./lib/fluent-ffmpeg');
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
},
"repository": "git://github.com/fluent-ffmpeg/node-fluent-ffmpeg.git",
"devDependencies": {
"jsdoc": "^4.0.0",
"mocha": "^10.0.0",
"should": "^13.0.0",
"jsdoc": "^4.0.0"
"nyc": "^15.1.0",
"should": "^13.0.0"
},
"dependencies": {
"async": "^0.2.9",
Expand All @@ -32,6 +33,7 @@
},
"main": "index",
"scripts": {
"test": "make test"
"test": "NODE_ENV=test nyc mocha --require should --reporter spec",
"coverage": "nyc report --reporter=lcov"
}
}
355 changes: 0 additions & 355 deletions test/coverage.html

This file was deleted.

Loading

0 comments on commit 843e57f

Please sign in to comment.