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

Npm run test fails #30

Open
laszlocph opened this issue Sep 25, 2019 · 3 comments
Open

Npm run test fails #30

laszlocph opened this issue Sep 25, 2019 · 3 comments

Comments

@laszlocph
Copy link

preactjs/preact-cli#892

@thesobercoder
Copy link

I'm also getting the same error -

image

@thesobercoder
Copy link

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

@ForsakenHarmony
Copy link
Contributor

Has this not been fixed with #31 ?

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

3 participants