2017-11-15 1 views
3

Ich versuche, Setup Scherz Konfiguration für IntelliJ aber ich erhalte diesen Fehler in der IDE Failed to parse Jest config jest.config.js: malformed JSON: enter image description hereMalformed JSON läuft Jest in IntelliJ IDEA

jedoch die Tests in der Konsole arbeiten:

➜ project-web git:(master) ✗ jest --config jest.config.js src/client/components 
PASS src/client/components/FormInput/index.test.tsx 
PASS src/client/components/Card/index.test.tsx 
PASS src/client/components/Button/indext.test.tsx 
PASS src/client/components/StepsBar/components/Step/Step.test.jsx 
FAIL src/client/components/Help/index.test.tsx 

Whith dieser IDE-Konfiguration: IDE configuration

Und jest.config.js:

module.exports = { 
    moduleFileExtensions: ["js", "jsx", "ts", "tsx"], 
    ["moduleNameMapper"]: { 
    // These take care of webpack's alias 
    ["^Redux(.*)"]: "<rootDir>/src/client/redux$1", 
    ["^Static(.*)"]: "<rootDir>/src/static$1", 
    ["^Components(.*)"]: "<rootDir>/src/client/components$1", 
    ["^Hoc(.*)"]: "<rootDir>/src/client/hoc$1", 
    ["^Services(.*)"]: "<rootDir>/src/client/services$1", 
    ["^Constants(.*)"]: "<rootDir>/src/client/constants$1", 
    ["^Scenes(.*)"]: "<rootDir>/src/client/scenes$1", 
    ["^Types(.*)"]: "<rootDir>/src/client/types", 
    ["^Helpers(.*)"]: "<rootDir>/src/client/helpers$1", 

    // These take care of imports of non-js assets (which are allowed by 
    // webpack, but not by Babel). Will import the object specified in the 
    // matching mock file instead of the asset. The object keys act as regex. 
    ["\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$"]: "<rootDir>/src/__mocks__/fileMock.js", 
    ["\\.(css|less)$"]: "<rootDir>/src/__mocks__/styleMock.js" 
    // NOTE: in the regexs above, "\\." means "a literal period" because the two 
    // slashes collapse into one. 
    }, 
    // Test files to exclude. Note that node_modules are excluded by default, but 
    // because we're overwriting the default array, they must be added again. 
    testPathIgnorePatterns: ["<rootDir>/src/build/", "<rootDir>/node_modules/"], 

    // Transform functions. Any file matching the following regexs will be 
    // transpiled **synchronously** with the specified function. 
    transform: { 
    ["^.+\\.(js|jsx|ts|tsx)$"]: "<rootDir>/src/build/test/transformer.js" 
    }, 
    testMatch: [ 
    "**/*.test.(js|jsx|tsx|ts)" 
    ], 
    modulePaths: ["<rootDir>/src/client/", "<rootDir>/src/static/"], 
    setupFiles: ["<rootDir>/test/jestSetup.js"], 
    snapshotSerializers: ["enzyme-to-json/serializer"], 
} 

Wenn ich keine Konfigurationsdatei in der Konfiguration der IDE einstelle, wird der Test mit der Standardkonfiguration und nicht mit meiner jest.config.js Datei ausgeführt.

Dank

+2

ich auch dieses Problem haben. Ich kann die Tests im webstorm laufen lassen, wenn ich das jest.config.js reines JSON mache (entferne '' 'module.exports =' ''), aber dann kann ich nicht vom Terminal laufen – Steph

+1

Ich schuf ein Problem in ihrem Plattform. Ich werde dich auf dem Laufenden halten. https://youtrack.jetbrains.com/issue/IDEA-182942 –

Antwort