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

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

Open
Pavel4444 opened this issue Jul 22, 2024 · 0 comments
Open

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

Pavel4444 opened this issue Jul 22, 2024 · 0 comments

Comments

@Pavel4444
Copy link

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
    }
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