Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lerna + typescript + coverage #1882

Closed
axelnormand opened this issue Oct 23, 2018 · 1 comment
Closed

lerna + typescript + coverage #1882

axelnormand opened this issue Oct 23, 2018 · 1 comment

Comments

@axelnormand
Copy link

axelnormand commented Oct 23, 2018

Issue description or question

I've setup an example monorepo for lerna + typescript 3 with project references + jest etc here:
https://github.com/axelnormand/react-typescript-monorepo

The issue is the code coverage only seems to be working for the common module, not app1 or app2. See screenshot. This has me quite confused! Any ideas much appreciated.
image

Wallaby.js configuration file

//
// Wallaby config reads tsconfig.json and jest.config.js out of the box
//

module.exports = function(wallaby) {
  return {
    files: [
      '**/src/**/*.{ts,tsx}',
      { pattern: '**/*.json', instrument: false },
      { pattern: '**/*.js', instrument: false },
      '!**/src/**/*.test.{ts,tsx}',
      '!**/src/**/*.story.tsx',
      '!**/node_modules/**/*',
      '!**/dist/**/*',
    ],
    tests: ['**/src/**/*.test.{ts,tsx}', '!**/node_modules/**/*'],
    env: { type: 'node', runner: 'node' },
    testFramework: 'jest',

    // make wallaby following lerna packages
    setup: () => {
      const jestConfig = require('./jest.config');
      jestConfig.moduleNameMapper = {
        ...jestConfig.moduleNameMapper,
        '^@monorepo/common/(.*)$': '<rootDir>/common/src/$1',        
      };
      wallaby.testFramework.configure(jestConfig);
    },

    reportConsoleErrorAsError: true,
    lowCoverageThreshold: 80,
    debug: true,
  };
};

Code editor or IDE name and version

Visual Studio Code v1.28.2

OS name and version

Windows 10

@axelnormand
Copy link
Author

Actually think its a jest issue :)
something to do with multi-project setting
jestjs/jest#5457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant