@ornikar/jest-config-react-native 3.2.1 → 3.3.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 +19 -0
- package/jest-preset.js +4 -0
- package/package.json +2 -2
- package/svg-transformer-inline.js +3 -0
- package/svg-transformer.js +22 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
## [3.3.1](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@3.3.0...@ornikar/jest-config-react-native@3.3.1) (2022-02-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ornikar/jest-config-react-native
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.3.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@3.2.1...@ornikar/jest-config-react-native@3.3.0) (2022-01-31)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **jest-config-react-native:** support svg with svgr named loader CME-229 ([#638](https://github.com/ornikar/shared-configs/issues/638)) ([09c70f7](https://github.com/ornikar/shared-configs/commit/09c70f753217c8dfee467c79c240d36eaa041f28))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [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
26
|
|
|
8
27
|
|
package/jest-preset.js
CHANGED
|
@@ -22,6 +22,8 @@ module.exports = {
|
|
|
22
22
|
'^@storybook/addon-actions$': require.resolve('./__mocks__/@storybook/addon-actions.js'),
|
|
23
23
|
'@storybook/react-native$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
|
|
24
24
|
'^@storybook/react-native$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
|
|
25
|
+
'@storybook/react$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
|
|
26
|
+
'^@storybook/react$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
|
|
25
27
|
},
|
|
26
28
|
transform: {
|
|
27
29
|
// remove svg asset transformer from expo config, as we configure svg with custom metro transformer
|
|
@@ -31,6 +33,8 @@ module.exports = {
|
|
|
31
33
|
return [key, value];
|
|
32
34
|
}),
|
|
33
35
|
),
|
|
36
|
+
// legacy support, use { ReactComponent } from .svg instead.
|
|
37
|
+
'\\.inline\\.svg$': '@ornikar/jest-config-react-native/svg-transformer-inline',
|
|
34
38
|
'\\.svg$': '@ornikar/jest-config-react-native/svg-transformer',
|
|
35
39
|
},
|
|
36
40
|
};
|
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.1",
|
|
4
4
|
"description": "jest config",
|
|
5
5
|
"repository": "ornikar/shared-configs",
|
|
6
6
|
"main": "jest-preset.js",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"jest-expo": "44.0.1",
|
|
30
30
|
"react": "17.0.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "79feb2a89340133a6f21ebaf93735561b9eb3586"
|
|
33
33
|
}
|
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 true;
|
|
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
|
+
};
|