diff --git a/.github/workflows/js-unittest.yml b/.github/workflows/js-unittest.yml index daaab10..0d746b9 100644 --- a/.github/workflows/js-unittest.yml +++ b/.github/workflows/js-unittest.yml @@ -22,8 +22,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Install dependencies - run: sudo npm install + run: npm install - name: Start local http server - run: sudo npm run http-server & - - name: Run tests - run: sudo npm test + run: npm run http-server & + - name: Run tests with coverage + run: npm run coverage diff --git a/.gitignore b/.gitignore index ea296b8..7dd6a0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ **/.devcontainer/* **/node_modules/* **/package-lock.json -**/*.vscode/* \ No newline at end of file +**/.vscode/* +**/.nyc_output/* +**/coverage/* \ No newline at end of file diff --git a/package.json b/package.json index 719337f..44dc522 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "type": "module", "scripts": { "test": "mocha --recursive --require mock-local-storage './{,!(node_modules)/**}/*.test.js'", + "coverage": "c8 --check-coverage --lines 90 --functions 90 --branches 90 npm run test", "lint-js": "eslint **/*.js", "fix-js": "eslint --fix **/*.js", "lint-html": "htmlhint **/*.html", @@ -15,6 +16,7 @@ "js-doc": "jsdoc -d source/docs/ -r source/" }, "devDependencies": { + "c8": "^7.12.0", "eslint": "^8.27.0", "htmlhint": "1.1.4", "http-server": "",