redux-utilities / redux-actions

Flux Standard Action utilities for Redux.
https://redux-actions.js.org
MIT License
6.51k stars 301 forks source link

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

Open Pavel4444 opened 1 month ago

Pavel4444 commented 1 month ago

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
    }