default icon indicating copy to clipboard operation
default copied to clipboard

Npm run test fails

Open laszlocph opened this issue 6 years ago • 3 comments

https://github.com/preactjs/preact-cli/issues/892

laszlocph avatar Sep 25 '19 12:09 laszlocph

I'm also getting the same error -

image

thesobercoder avatar Jul 29 '20 08:07 thesobercoder

I was able to fix this by doing the following changes. I've also fixed the lint issue. The default lint script doesn't work. -

jest.config.js

module.exports = {
    preset: "jest-preset-preact",
    setupFiles: [
        "<rootDir>/src/tests/__mocks__/setupTests.js",
        "<rootDir>/src/tests/__mocks__/browserMocks.js",
        "<rootDir>/src/tests/__mocks__/fileMocks.js"
    ],
    testURL: "http://localhost:8080",
    moduleNameMapper: {
        "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
            "<rootDir>/src/tests/__mocks__/fileMocks.js"
    },
    testPathIgnorePatterns: ["<rootDir>/node_modules/"],
    testMatch: ["<rootDir>/src/tests/**/*.test.{js,jsx,ts,tsx}"],
    transform: {
        "^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest"
    }
};

package.json

"scripts": {
        "lint": "eslint ./src --ext .js --ext .ts --ext .jsx --ext .tsx",
        "test": "jest"
    },

thesobercoder avatar Jul 29 '20 11:07 thesobercoder

Has this not been fixed with #31 ?

ForsakenHarmony avatar Sep 07 '20 02:09 ForsakenHarmony