Jest configuration error while running test case in teamcity

20 Views Asked by At

I am getting the following error while running this test case in teamcity.

Configuration error:

Could not locate module n/ui/widgets/toolkit/RichTextEditor mapped as: /data/TeamCity/psgdevops-tcagentpool-prod-dusa1-016-psgci-tc-agent01/work/f7c28bd4d45f9aa6/BUNDLE_SOURCE/node_modules/ts-uif-types/n/ui/$1.

Please check your configuration for these entries: { "moduleNameMapper": { "/n/ui/(.*)/": "/data/TeamCity/psgdevops-tcagentpool-prod-dusa1-016-psgci-tc-agent01/work/f7c28bd4d45f9aa6/BUNDLE_SOURCE/node_modules/ts-uif-types/n/ui/$1" }, "resolver": undefined }

The following is my jest.config.js

const {defaults} = require('jest-config');

module.exports = {

roots: ['./src/','test/jest'],
testPathIgnorePatterns: ['/node_modules/', '/build/', '/test-main.karma.js/'],
transformIgnorePatterns: ['node_modules/(?!(@hitc|ts-uif-types)/)'],
testMatch: [
    '**/__tests__/**/*.+(ts|tsx)',
    '**/?(*.)+(spec|test).+(ts|tsx|js)',
    '!**/vendor/**',
    '!**/mock/**',
],
transform: {
    '^.*ts$': ['ts-jest', {
        babel: true,
        tsconfig: './tsconfig.test.json',
      }],
},
testEnvironment: 'jsdom',
moduleDirectories: ['.','src','src/util','node_modules'], 
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'd.ts', 'tsx'],
modulePaths: ['node_modules'],
moduleNameMapper: {
    'N/(.*)': '<rootDir>/node_modules/@hitc/netsuite-types/N/$1',
    'n/ui/(.*)': '<rootDir>/node_modules/ts-uif-types/n/ui/$1',
},
preset: 'ts-jest',
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{ts,js,jsx}'],
verbose: false,

};

I have tried many combinations for n/ui path, but nothing's working yet. Any ideas please?

0

There are 0 best solutions below