我目前正在最后的报道中获取我的测试文件.这可能是因为它们与我的组件并排放置,而不是拥有自己的测试文件夹.如何从保险范围中排除这些?
我安装了伊斯坦布尔和纽约,我正在使用摩卡咖啡.
我的脚本看起来像:
"test": "nyc --reporter=html mocha tools/testSetup.js app/**/*.spec.js || true"
我正在努力为我的打字稿/ mocha/gulp项目获得适当的nyc/istanbul报道.我尝试了很多方法,其中一些似乎无法使用源映射,而其他方法由于ts-node/ tsc错误而失败.我目前的设置是:
nyc 相关配置 package.json
"scripts": {
"test:coverage": "nyc npm run test:unit",
"test:unit": "gulp mocha"
}
"nyc": {
"check-coverage": true,
"all": true,
"extension": [
".js",
".jsx",
".ts",
".tsx"
],
"include": [
"src/**/!(*.test.*).[tj]s?(x)"
],
"reporter": [
"html",
"lcov",
"text",
"text-summary"
],
"report-dir": "docs/reports/coverage"
}
Run Code Online (Sandbox Code Playgroud)
gulpfile.js mocha 相关部分
const SRC_DIR = path.join(__dirname, 'src');
const SRC_FILES = path.join(SRC_DIR, '**', '*.[jt]s?(x)');
const TEST_FILES = path.join(SRC_DIR, '**', '*.test.[jt]s?(x)');
const MOCHA_CONFIG = {
src: [
TEST_FILES
],
watchSrc: [
SRC_FILES,
TEST_FILES
], …Run Code Online (Sandbox Code Playgroud)