Merge pull request #265 from joefitter/bugfix/conditional-coverage

dont run coverage if publishing
This commit is contained in:
Dolan
2019-02-09 17:43:43 +00:00
committed by GitHub
2 changed files with 12 additions and 9 deletions

View File

@ -8,7 +8,7 @@
"test": "mocha-webpack \"src/**/*.ts\"", "test": "mocha-webpack \"src/**/*.ts\"",
"test.coverage": "nyc npm test", "test.coverage": "nyc npm test",
"test.watch": "npm test -- --watch", "test.watch": "npm test -- --watch",
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build --production",
"lint": "tslint --project .", "lint": "tslint --project .",
"build": "npm run webpack && npm run fix-types", "build": "npm run webpack && npm run fix-types",
"tsc": "rimraf ./build && tsc -p .", "tsc": "rimraf ./build && tsc -p .",

View File

@ -22,14 +22,17 @@ module.exports = {
test: /\.ts$/, test: /\.ts$/,
loaders: ["awesome-typescript-loader"], loaders: ["awesome-typescript-loader"],
}, },
{
// For coverage testing // For coverage testing
...(process.env.NODE_ENV !== "production"
? [{
test: /\.(ts)/, test: /\.(ts)/,
include: path.resolve("src"), include: path.resolve("src"),
loader: "istanbul-instrumenter-loader", loader: "istanbul-instrumenter-loader",
enforce: "post", enforce: "post",
exclude: [/node_modules/], exclude: [/node_modules/],
}, }]
: []
)
], ],
}, },