温斯顿从纱线2中的位置进行测井

问题描述

由于某些原因,我的日志消息只是style-loader,正在打印info: after all completedconsole.log以及每条日志消息的空白行。

at Console.log

这似乎仅在与...一起运行时发生

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

如果我使用以下方法进行单个测试,一切都很好

    "test:graph": "yarn ts/app/service/packages/graph workspaces foreach --parallel --topological-dev --verbose --recursive run test",":g:jest": "cd $INIT_CWD && jest --collectCoverage --colors --config ../../../../jest.config.js --rootDir .","test": "yarn :g:jest",

这基本上是我的winston配置的副本和粘贴,但是到一个新项目中,问题并没有浮现出来。我怀疑这与玩笑有什么关系,但是由于我只通过玩笑和循环查看运行的测试,因此我无法将其排除在外。

    "jest": "cd $INIT_CWD && jest --forceExit --colors --config jest-vscode.config.js",

这些是我在显示错误的最不复杂模块中获得的经验。

import { createLogger,format,transports } from "winston";

describe('something',() => {
  const log = createLogger({
    level: 'debug',format: format.combine(
      format.colorize({ level: true,message: false }),format.splat(),format.simple(),format.align(),format.padLevels(),),transports: [new transports.Console()]
  })

  it('hello',() => {
    log.info('hello world');
  })
})

我尝试使用winston 3.3.3和winston 3.2.x,结果相同。

很抱歉,这是一个很难复制的问题,我知道这是一个长期的尝试。如果您有任何想法,请分享

解决方法

看起来这是出于笑话,似乎并非总是如此,所以我并不完全了解。 https://github.com/facebook/jest/issues/9127