玩笑测试中的日志记录过于冗长

时间:2020-10-12 17:17:58

标签: node.js jestjs yarnpkg winston yarnpkg-v2

➤ YN0000: [@bb/graph]:     console.log
➤ YN0000: [@bb/graph]:       info:     after all completed
➤ YN0000: [@bb/graph]: 
➤ YN0000: [@bb/graph]:       at Console.log (../.yarn/cache/winston-npm-3.3.3-3fa4527b42-8a9d69c642.zip/node_modules/winston/lib/winston/transports/console.js:79:23)

我得到的输出过于冗长(大多数情况下,我不想看到console.log的内容,而只是在测试输出中看到info: after all completed

我正在使用yarn2,jest和winston,我不认为它是winston,因为它不支持记录行号,并且在测试以外启动服务器时不会发生这种情况。我也不认为它是yarn2,因为它在我运行yarn workspace @bb/graph test时发生,它不包含前缀。这让我猜测这是在开玩笑。这是我的配置。

module.exports = {
  preset: 'ts-jest',
  coverageDirectory: 'coverage',
  coverageReporters: [
    'text-summary',
  ],
  coverageThreshold: {
    global: {
      branches: 50,
      functions: 65,
      lines: 80,
      statements: 80,
    },
  },
  setupFiles: ['./jest.setup.js'],
  testEnvironment: 'node',
  testMatch: ['**/__tests__/**/*.ts', '**/*.test.ts'],
  testPathIgnorePatterns: ['/node_modules/', '/build/'],
};

其他均为默认设置。

0 个答案:

没有答案