我想知道为什么这条 ES6 行被标记为未覆盖:
包.json
....
"test:v1:coverage": "cross-env NODE_ENV=test ./node_modules/.bin/nyc _mocha
--timeout 15000 --ui bdd --colors --compilers js:babel-core/register
server/v1/tests --recursive",
...
"nyc": {
"require": [
"babel-register"
],
"exclude": [
"**/server/helpers/tests.utility.js"
],
"sourceMap": false,
"instrument": false
}
结果报告:
------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
---|----------|----------|----------|----------|----------------|
嗯.js | 100 | 40 | 100 | 100 | 113 |
user.model.js (um.js)
....
list({ skip = 0, limit = 50 } = {}) {. :: <= line 113
console.log('USER MODEL LIST');
return this.find()
.sort({ createdAt: -1 })
.skip(skip)
.limit(limit)
.exec();
}
....
运行此方法,因为 console.log 显示消息:
# GET /api/v1/users/
USER MODEL LIST
Mongoose: users.find({}, { sort: { createdAt: -1 }, skip: 0, limit: 50, fields: {} })
感谢您的反馈