Lerna运行测试在快照测试中失败

时间:2019-05-07 18:11:42

标签: javascript jestjs lerna

当我在根文件夹中运行jest时,所有测试都通过了。但是,当我运行lerna run test时,所有快照测试都将失败expect(received).toMatchSnapshot()。所有其他测试均通过。

我的jest.config.base看起来像

module.exports = {
  collectCoverage: true,
  setupFiles: ['<rootDir>/jest.setup.js'],
  preset: 'ts-jest',
  testEnvironment: 'jsdom',
  collectCoverageFrom: [
    '<rootDir>/packages/**/*.ts'
  ],
  testMatch: [
    '<rootDir>/packages/**/__tests__/**/*.test.ts'
  ],
  transform: {
    '^.+\\.js?$': '<rootDir>/node_modules/babel-jest'
  },
  testPathIgnorePatterns: [
    '/node_modules/',
  ],
  coveragePathIgnorePatterns: [
    '/node_modules/',
  ]
};

每个软件包的配置都像

const base = require('./../../jest.config.base');

module.exports = {
  ...base,
  rootDir: '../..',
  name: 'ThePackage',
  displayName: 'ThePackage',
};

为什么除了快照以外的所有测试都会失败?

0 个答案:

没有答案
相关问题