diff --git a/.github/.codecov.yml b/.github/.codecov.yml new file mode 100644 index 0000000..d08101f --- /dev/null +++ b/.github/.codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + project: + default: + informational: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3f4f97..e1dec9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,4 +22,8 @@ jobs: npm run compile - name: Tests run: | - npm test + npm run coverage + - name: Publish to Codecov + uses: codecov/codecov-action@v2 + with: + files: coverage/lcov.info diff --git a/.gitignore b/.gitignore index e578349..da4d3fb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ node_modules lib/ .eslintcache docs + +# coverage +.nyc_output +coverage diff --git a/package.json b/package.json index f526f77..faff92c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "main": "lib/bigdecimal.js", "module": "lib/bigdecimal.mjs", "scripts": { - "test": "mocha -t 100000 test/**/**/*.js", + "test": "mocha --require ts-node/register --require source-map-support/register -t 100000 test/**/**/*.js", + "coverage": "nyc --reporter=lcov npm run test", "compile": " npm run compile:cjs && npm run compile:esm && npm run prepareESM", "compile:esm": "tsc --module es2020 --outDir lib/esm", "compile:cjs": "tsc --module commonjs --outDir lib", @@ -65,8 +66,23 @@ "chai": "~4.3", "eslint": "~7.28.0", "mocha": "~9.0.0", + "nyc": "^15.1.0", "rimraf": "~3.0.2", + "source-map-support": "^0.5.19", + "ts-node": "^10.2.1", "typedoc": "~0.20.36", "typescript": "~4.2.4" + }, + "nyc": { + "extension": [ + ".ts" + ], + "exclude": [ + "**/*.d.ts" + ], + "reporter": [ + "html" + ], + "all": true } } diff --git a/tsconfig.json b/tsconfig.json index f977246..97f578e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "stripInternal": true, "declaration": true, // "outDir": "lib", - "sourceMap": false, + "sourceMap": true, /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ "target": "es2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */