chore: Add code coverage for JS (#600)

This commit is contained in:
Jim Brännlund 2023-03-25 01:29:29 +01:00 committed by GitHub
parent 40a80d535d
commit 6013279574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2670 additions and 6 deletions

View File

@ -17,6 +17,19 @@ jobs:
run: npm ci
- name: Run tests
run: npm run unit
- name: Upload coverage to codecov
if: >-
${{
! github.event.schedule &&
github.repository_owner == 'pytest-dev'
}}
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: ./cobertura-coverage.xml
flags: js_tests
name: ubuntu-latest-node-16
verbose: true
test_unit:
name: ${{ matrix.os }} - ${{ matrix.python-version }}
@ -99,8 +112,8 @@ jobs:
with:
fail_ci_if_error: true
files: ./coverage.xml
flags: tests
name: ${{ matrix.os }}-${{ matrix.python-version }}
flags: py_unit_tests
name: ${{ matrix.os }}-python-${{ matrix.python-version }}
verbose: true
test_integration:
@ -161,7 +174,6 @@ jobs:
if: ${{ matrix.tox-env }}
run: tox -e ${{ matrix.tox-env }} -- testing/test_integration.py
# TODO: https://github.com/pytest-dev/pytest-html/issues/481
- name: Upload coverage to codecov
if: >-
${{
@ -173,6 +185,6 @@ jobs:
with:
fail_ci_if_error: true
files: ./coverage.xml
flags: tests
name: ${{ matrix.tox-env }}
flags: py_integration_tests
name: ubuntu-latest-${{ matrix.python-version }}
verbose: true

3
.gitignore vendored
View File

@ -9,6 +9,7 @@ dist
# Codecov
.coverage
coverage.xml
cobertura-coverage.xml
# IDE Specific files/folders
## Pycharm IDE - Jetbrains
@ -53,3 +54,5 @@ docs/_build/
*.html
assets/
.nyc_output

5
.nycrc Normal file
View File

@ -0,0 +1,5 @@
{
"report-dir": ".",
"reporter": ["cobertura"],
"exclude": ["testing/**"]
}

2643
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"scripts": {
"unit": "mocha testing/**/unittest.js",
"unit": "nyc mocha testing/**/unittest.js",
"build:ci": "npm run build:css && npm run build:jsapp",
"build:css": "sass --no-source-map --no-error-css src/layout/css/style.scss src/pytest_html/resources/style.css",
"build:jsapp": "browserify ./src/pytest_html/scripts/index.js > ./src/pytest_html/resources/app.js",
@ -12,6 +12,7 @@
"eslint": "^8.20.0",
"eslint-config-google": "^0.14.0",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"sass": "^1.52.3",
"sinon": "^14.0.0"
}