Jest config file is not ignoring files correctly from testPathIgnorePatterns

Discussão em 'Angular' iniciado por Daniel Morales, Outubro 11, 2024.

  1. I have this jest.config.ts file:

    import coverageConfig from '../../jest.coverage.config';

    /* eslint-disable */
    export default {
    displayName: 'domain-handler',
    preset: '../../jest.preset.js',
    setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
    coverageDirectory: '../../coverage/libs/domain-handler',
    transform: {
    '^.+\\.(ts|mjs|js|html)$': [
    'jest-preset-angular',
    {
    tsconfig: '<rootDir>/tsconfig.spec.json',
    stringifyContentPathRegex: '\\.(html|svg)$',
    },
    ],
    },
    transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
    snapshotSerializers: [
    'jest-preset-angular/build/serializers/no-ng-attributes',
    'jest-preset-angular/build/serializers/ng-snapshot',
    'jest-preset-angular/build/serializers/html-comment',
    ],
    testPathIgnorePatterns: [
    '<rootDir>/src/lib/pages',
    '<rootDir>/src/lib/test_data',
    '<rootDir>/src/lib/util',
    '<rootDir>/src/lib/configs/grid',
    ],
    coveragePathIgnorePatterns: [
    'node_modules',
    '<rootDir>/src/lib/pages',
    '<rootDir>/src/lib/test_data',
    '<rootDir>/src/lib/util',
    '<rootDir>/src/lib/configs/grid',
    ],
    ...coverageConfig,
    };



    but neither testPathIgnorePatterns or coveragePathIgnorePatterns are working properly, both of them aren't ignoring test_data directory, util and configs/grid but its ignoring correctly pages. The 4 directories have the same path:

    workspace\ABC\PROJECT.UI\libs\domain-handler\src\lib\test_data

    workspace\ABC\PROJECT.UI\libs\domain-handler\src\lib\pages

    workspace\ABC\PROJECT.UI\libs\domain-handler\src\lib\configs

    workspace\ABC\PROJECT.UI\libs\domain-handler\src\lib\util

    I've tried doing jest --cleanCache and a few more things but nothing seems to work, any idea why?

    Jest version is 18.0.8

    Continue reading...

Compartilhe esta Página