@ornikar/jest-config-react-native 3.2.0-alpha.0 → 3.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -2
- package/jest-preset.js +20 -11
- package/package.json +2 -3
- package/svg-transformer-inline.js +3 -0
- package/svg-transformer.js +22 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## [3.2.1](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@3.2.0...@ornikar/jest-config-react-native@3.2.1) (2022-01-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **jest-config-react-native:** fix typo [no issue] ([#631](https://github.com/ornikar/shared-configs/issues/631)) ([41905a1](https://github.com/ornikar/shared-configs/commit/41905a1a940f31aaa700c8a7c8ddc86c1dd3ec66))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.2.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@3.1.4...@ornikar/jest-config-react-native@3.2.0) (2022-01-18)
|
|
7
18
|
|
|
8
19
|
|
|
9
20
|
### Features
|
|
10
21
|
|
|
11
|
-
* jest-config native and web improvements ([
|
|
22
|
+
* jest-config native and web improvements [no issue] ([#630](https://github.com/ornikar/shared-configs/issues/630)) ([0e00bf2](https://github.com/ornikar/shared-configs/commit/0e00bf2ac1fa6d40e9d4063a3c94c18385060dcd))
|
|
12
23
|
|
|
13
24
|
|
|
14
25
|
|
package/jest-preset.js
CHANGED
|
@@ -14,15 +14,24 @@ function customizer(objValue, srcValue) {
|
|
|
14
14
|
|
|
15
15
|
const basePreset = mergeWith(expoPreset, jestPreset, customizer);
|
|
16
16
|
|
|
17
|
-
module.exports =
|
|
18
|
-
basePreset,
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
moduleNameMapper
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
17
|
+
module.exports = {
|
|
18
|
+
...basePreset,
|
|
19
|
+
testMatch: [...basePreset.testMatch, '<rootDir>/src/**/stories.{ts,tsx}', '<rootDir>/src/**/*.stories.{ts,tsx}'],
|
|
20
|
+
moduleNameMapper: {
|
|
21
|
+
...basePreset.moduleNameMapper,
|
|
22
|
+
'^@storybook/addon-actions$': require.resolve('./__mocks__/@storybook/addon-actions.js'),
|
|
23
|
+
'@storybook/react-native$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
|
|
24
|
+
'^@storybook/react-native$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
transform: {
|
|
27
|
+
// remove svg asset transformer from expo config, as we configure svg with custom metro transformer
|
|
28
|
+
...Object.fromEntries(
|
|
29
|
+
Object.entries(basePreset.transform).map(([key, value]) => {
|
|
30
|
+
if (key.includes('|svg|')) return [key.replace('|svg|', '|'), value];
|
|
31
|
+
return [key, value];
|
|
32
|
+
}),
|
|
33
|
+
),
|
|
34
|
+
'\\.inline\\.svg$': '@ornikar/jest-config-react-native/svg-transformer-inline',
|
|
35
|
+
'\\.svg$': '@ornikar/jest-config-react-native/svg-transformer',
|
|
36
|
+
},
|
|
37
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/jest-config-react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0-beta.1",
|
|
4
4
|
"description": "jest config",
|
|
5
5
|
"repository": "ornikar/shared-configs",
|
|
6
6
|
"main": "jest-preset.js",
|
|
@@ -28,6 +28,5 @@
|
|
|
28
28
|
"@testing-library/react-native": "9.0.0",
|
|
29
29
|
"jest-expo": "44.0.1",
|
|
30
30
|
"react": "17.0.2"
|
|
31
|
-
}
|
|
32
|
-
"gitHead": "d1f9624fe4d1c454ce07be566aee9a177553a85f"
|
|
31
|
+
}
|
|
33
32
|
}
|
package/svg-transformer.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const { process } = require('jest-svg-transformer');
|
|
4
|
+
|
|
5
|
+
exports.process = (src, filepath) => {
|
|
6
|
+
const content = process(src, filepath);
|
|
7
|
+
return content.replace(
|
|
8
|
+
/module.exports = (.*);/,
|
|
9
|
+
`module.exports = new Proxy({}, {
|
|
10
|
+
get: function getter(target, key) {
|
|
11
|
+
if (key === '__esModule') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (key === 'default') {
|
|
15
|
+
return $1.name;
|
|
16
|
+
}
|
|
17
|
+
if (key === 'ReactComponent') {
|
|
18
|
+
return $1;
|
|
19
|
+
}
|
|
20
|
+
throw new Error('Invalid key for svg-transformer jest mock :' + key);
|
|
21
|
+
}
|
|
22
|
+
});`,
|
|
23
|
+
);
|
|
24
|
+
};
|