diff --git a/babel.config.js b/jest/babel.config.js similarity index 100% rename from babel.config.js rename to jest/babel.config.js diff --git a/jest.config.js b/jest/jest.config.js similarity index 84% rename from jest.config.js rename to jest/jest.config.js index c395caca..b58933c4 100644 --- a/jest.config.js +++ b/jest/jest.config.js @@ -1,4 +1,8 @@ module.exports = { + rootDir: '../', + transform: { + '^.+\\.[jt]sx?$': ['babel-jest', { configFile: './jest/babel.config.js' }] + }, moduleNameMapper: { '.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy', '.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': diff --git a/package.json b/package.json index a56f02a7..497902ed 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "start": "gatsby develop --host 0.0.0.0", "build": "gatsby build && npm run copy", "ssr": "npm run build && serve -s public/", - "test": "npm run lint && jest --coverage --silent", - "test:watch": "npm run lint && jest --coverage --watch", + "test": "npm run lint && jest -c jest/jest.config.js --coverage --silent", + "test:watch": "npm run lint && jest -c jest/jest.config.js --coverage --watch", "copy": "cp -R content/media/ public", "lint": "run-p --continue-on-error lint:js lint:css lint:md", "lint:js": "eslint --ignore-path .gitignore --ext .js,.jsx,.ts,.tsx .",