Skip to content

Commit 32147be

Browse files
authored
Fixes npm scripts and code coverage setup (#21)
Adds npm-run-all and removing platform specific command line operators Moves Jest config file and coverage directory.
1 parent 81579b3 commit 32147be

File tree

7 files changed

+181
-10
lines changed

7 files changed

+181
-10
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules/
22
dist/
3+
coverage/
34

45
package-lock.json
56

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# project
22
/dist/
3-
/test/coverage/
3+
/coverage/
44
.eslintrc.json
55

66
# IDE and OS
@@ -47,4 +47,3 @@ typings/
4747

4848
# dotenv environment variables file
4949
.env
50-

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ before_install:
88
install:
99
- npm ci
1010
before_script:
11+
# Needs to build before linting because a test file imports the built file.
1112
- npm run build:dev
1213
script:
1314
- npm run lint
14-
- npm run test:codecov
15+
- npm run test:coverage
1516
cache:
1617
directories:
1718
- "$HOME/.npm"

test/jest.conf.js renamed to jest.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path');
22

33
module.exports = {
4-
rootDir: path.resolve(__dirname, '../'),
4+
rootDir: path.resolve(__dirname),
55
moduleFileExtensions: [
66
'js',
77
'json',
@@ -15,7 +15,7 @@ module.exports = {
1515
// },
1616
// setupFiles: ['<rootDir>/test/setup'],
1717
// mapCoverage: true,
18-
coverageDirectory: '<rootDir>/test/coverage',
18+
coverageDirectory: '<rootDir>/coverage',
1919
collectCoverageFrom: [
2020
'src/**/*.js',
2121
'!**/node_modules/**',

package-lock.json

Lines changed: 169 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
"build:dev": "rollup -c build/rollup.dev.config.js",
2121
"build:lint-config": "eslint -c .eslintrc.js --print-config .eslintrc.js > .eslintrc.json",
2222
"release": "bash build/release.sh",
23-
"test": "npm run lint && npm run test:unit",
24-
"test:unit": "npm run build:dev && jest --config test/jest.conf.js",
25-
"test:coverage": "npm run test:unit -- --coverage",
26-
"test:codecov": "npm run test:coverage && codecov",
23+
"test": "run-p lint test:unit",
24+
"pretest:unit": "npm run build:dev",
25+
"test:unit": "jest",
26+
"pretest:coverage": "npm run test:unit -- --coverage",
27+
"test:coverage": "codecov",
2728
"lint": "eslint ./",
2829
"docs": "npx docsify-cli serve ./docs"
2930
},
@@ -58,6 +59,7 @@
5859
"eslint-plugin-import": "^2.16.0",
5960
"husky": "^0.14.3",
6061
"jest": "^24.3.1",
62+
"npm-run-all": "^4.1.5",
6163
"rimraf": "^2.6.3",
6264
"rollup": "^1.6.0",
6365
"rollup-plugin-buble": "^0.19.6",

0 commit comments

Comments
 (0)