如何从 mocha/nyc 测试覆盖范围(Node.js)中过滤掉某些模式?

Pre*_*rem 4 javascript unit-testing mocha.js nyc

在 mocha.opts 中,我确定如何设置需要考虑的覆盖模式,但不确定如何包含必须过滤掉的模式?

例如,

我有包含覆盖模式的文件mocha.opts,该文件作为参数传递给以下命令:
nyc mocha --opts ./mocha.opts

其内容mocha.opts如下:
test/tests/routes/*.test.js

但是有很多custom js scripts导入到 *.test.js 文件中。但这些custom js scripts包含我不想包含在覆盖率报告中的函数,也不想为它们编写单元测试。
有没有办法通过将这些模式声明到mocha.opts文件中来从覆盖范围中过滤掉这些模式?

And*_*lan 5

在package.json中,您可以添加nyc配置。像这样的东西。 https://www.npmjs.com/package/nyc#exclusion-files

"nyc": {
  "include": [
    "./**/*.js"
  ],
  "exclude": [
    "./test/",
    "./db/migrations/"
  ]
}
Run Code Online (Sandbox Code Playgroud)

但我还没有看到在 mocha.opts 中指定的方法。