From df24a9fa48a3390dfd166eee21f7b394a83ea1ac Mon Sep 17 00:00:00 2001 From: Igor Wessel Date: Sun, 21 Aug 2022 10:24:44 -0300 Subject: [PATCH] tests(styled-components-native): fix settings --- jest.config.js | 45 ++++++++++++++----- .../babel.config.json | 3 ++ .../styled-components-native/jest.config.cjs | 9 ---- .../styled-components-native/package.json | 3 +- 4 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 packages/styled-components-native/babel.config.json delete mode 100644 packages/styled-components-native/jest.config.cjs 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"