diff --git a/jest.config.js b/jest.config.js index cecae27a..0069d4a2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,13 +1,36 @@ module.exports = { - testEnvironment: 'jsdom', - transformIgnorePatterns: ['.*(node_modules)(?!.*@xstyled.*).*$'], - transform: { - '^.+\\.(j|t)sx?$': 'babel-jest', - }, - testPathIgnorePatterns: ['/node_modules/', '/website/'], - coveragePathIgnorePatterns: ['/node_modules/', '/dist/'], - moduleNameMapper: { - 'styled-components': - '/node_modules/styled-components/dist/styled-components.browser.cjs.js', - }, + projects: [ + { + displayName: 'web', + testEnvironment: 'jsdom', + transformIgnorePatterns: ['.*(node_modules)(?!.*@xstyled.*).*$'], + transform: { + '^.+\\.(j|t)sx?$': 'babel-jest', + }, + testPathIgnorePatterns: [ + '/node_modules/', + '/website/', + '/packages/styled-components-native/', + ], + coveragePathIgnorePatterns: ['/node_modules/', '/dist/'], + moduleNameMapper: { + 'styled-components': + '/node_modules/styled-components/dist/styled-components.browser.cjs.js', + }, + }, + { + displayName: 'native', + preset: 'react-native', + transformIgnorePatterns: ['node_modules/(?!@react-native|react-native)'], + transform: { + '^.+\\.(j|t)sx?$': 'babel-jest', + }, + testPathIgnorePatterns: [ + '/node_modules/', + '/website/', + '/packages/(?!styled-components-native)', + ], + coveragePathIgnorePatterns: ['/node_modules/', '/dist/'], + }, + ], } diff --git a/packages/styled-components-native/babel.config.json b/packages/styled-components-native/babel.config.json new file mode 100644 index 00000000..d4b74b5b --- /dev/null +++ b/packages/styled-components-native/babel.config.json @@ -0,0 +1,3 @@ +{ + "presets": ["module:metro-react-native-babel-preset"] +} diff --git a/packages/styled-components-native/jest.config.cjs b/packages/styled-components-native/jest.config.cjs deleted file mode 100644 index 1d0b8c40..00000000 --- a/packages/styled-components-native/jest.config.cjs +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - preset: 'react-native', - transformIgnorePatterns: ['node_modules/(?!@react-native|react-native)'], - transform: { - '^.+\\.(j|t)sx?$': 'babel-jest', - }, - testPathIgnorePatterns: ['/node_modules/', '/website/'], - coveragePathIgnorePatterns: ['/node_modules/', '/dist/'], -} diff --git a/packages/styled-components-native/package.json b/packages/styled-components-native/package.json index 5db00270..5d93a113 100644 --- a/packages/styled-components-native/package.json +++ b/packages/styled-components-native/package.json @@ -26,7 +26,8 @@ "scripts": { "reset": "rm -rf dist", "build": "../../node_modules/.bin/rollup -c ../../build/rollup.config.js", - "prepublishOnly": "npm run reset && npm run build" + "prepublishOnly": "npm run reset && npm run build", + "test": "jest" }, "publishConfig": { "access": "public"