Skip to content

Not working with Jest from v3.0.0 part 2 #401

@Pavel4444

Description

@Pavel4444

Updated to latest 3.0.3 and still not working. 2.6.5 working fine.

using "jest": "^29.7.0",

:

base jest conf:

module.exports = {
    globals: {
        "ts-jest": {
            isolatedModules: true,
            tsConfig: "tsconfig.test.json",
        },
        TextEncoder, TextDecoder
    },
    moduleFileExtensions: ["ts", "tsx", "js"],
    reporters: [
        "default",
        [
            "jest-junit",
            {
                outputDirectory: ".",
                outputName: "./testresults/junit-jest.xml",
                ancestorSeparator: " › ",
            },
        ],
    ],
    transform: {
        ".(ts|tsx|js)": "ts-jest",
        "^.+\\.css$": "jest-transform-css",
    },
    transformIgnorePatterns: [
        ".*\\.json",
        "<rootDir>/../node_modules/(?!(@vzp)/)",
        "<rootDir>/node_modules/(?!(@vzp)/)",
    ],
    testRegex: "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
    testPathIgnorePatterns: ["<rootDir>/cypress/", "<rootDir>/node_modules/"],
    testEnvironment: "jsdom",
};

usage of actual mapper:

const baseConfig = require("../jest.config.js");

module.exports = {
    ...baseConfig,
    moduleDirectories: [
        "node_modules",
        "app-admin", // allow absolute imports starting with 'App' (eg. resolves imports starting 'App' and not just 'app-front/App')
    ],
    moduleNameMapper: {
        "\\.(css|less)$": "<rootDir>/test/styleMock.js",
        "redux-actions": "redux-actions/dist/redux-actions"  //problem here
    },
    setupFiles: ["<rootDir>/test/setupTests.ts"],
};

error:

    Could not locate module redux-actions mapped as:
    redux-actions/dist/redux-actions.

    Please check your configuration for these entries:
    {
      "moduleNameMapper": {
        "/redux-actions/": "redux-actions/dist/redux-actions"
      },
      "resolver": undefined
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions