@ornikar/jest-config-react-native 3.1.2 → 3.2.0

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 CHANGED
@@ -3,6 +3,33 @@
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.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
+
8
+
9
+ ### Features
10
+
11
+ * 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
+
13
+
14
+
15
+
16
+
17
+ ## [3.1.4](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@3.1.3...@ornikar/jest-config-react-native@3.1.4) (2022-01-17)
18
+
19
+ **Note:** Version bump only for package @ornikar/jest-config-react-native
20
+
21
+
22
+
23
+
24
+
25
+ ## [3.1.3](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@3.1.2...@ornikar/jest-config-react-native@3.1.3) (2022-01-07)
26
+
27
+ **Note:** Version bump only for package @ornikar/jest-config-react-native
28
+
29
+
30
+
31
+
32
+
6
33
  ## [3.1.2](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react-native@3.1.1...@ornikar/jest-config-react-native@3.1.2) (2022-01-05)
7
34
 
8
35
  **Note:** Version bump only for package @ornikar/jest-config-react-native
package/jest-preset.js CHANGED
@@ -14,16 +14,23 @@ function customizer(objValue, srcValue) {
14
14
 
15
15
  const basePreset = mergeWith(expoPreset, jestPreset, customizer);
16
16
 
17
- module.exports = mergeWith(
18
- basePreset,
19
- {
20
- testMatch: ['<rootDir>/src/**/stories.{ts,tsx}', '<rootDir>/src/**/*.stories.{ts,tsx}'],
21
- moduleNameMapper: {
22
- '\\.css': '<rootDir>/src/__mocks__/styleMock.ts',
23
- '^@storybook/addon-actions$': require.resolve('./__mocks__/@storybook/addon-actions.js'),
24
- '@storybook/react-native$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
25
- '^@storybook/react-native$': require.resolve('./__mocks__/@storybook/react-native.jsx'),
26
- },
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'),
27
25
  },
28
- customizer,
29
- );
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
+ '\\.svg$': '@ornikar/jest-config-react-native/svg-transformer',
35
+ },
36
+ };
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+
5
+ module.exports = {
6
+ resolveSnapshotPath: (testPath, snapshotExtension) => {
7
+ const snapshotPath = `${path.dirname(testPath)}/__native_snapshots__/${path.basename(
8
+ testPath,
9
+ )}${snapshotExtension}`;
10
+ return snapshotPath;
11
+ },
12
+
13
+ resolveTestPath: (snapshotFilePath, snapshotExtension) => {
14
+ const testPath = snapshotFilePath.replace('/__native_snapshots__', '').slice(0, -snapshotExtension.length);
15
+ return testPath;
16
+ },
17
+
18
+ testPathForConsistencyCheck: 'src/shared/components/Button/Button.test.tsx',
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ornikar/jest-config-react-native",
3
- "version": "3.1.2",
3
+ "version": "3.2.0",
4
4
  "description": "jest config",
5
5
  "repository": "ornikar/shared-configs",
6
6
  "main": "jest-preset.js",
@@ -19,7 +19,8 @@
19
19
  "react-dom": "^17.0.0"
20
20
  },
21
21
  "dependencies": {
22
- "@ornikar/jest-config": "^7.1.1",
22
+ "@ornikar/jest-config": "^7.1.3",
23
+ "jest-svg-transformer": "^1.0.0",
23
24
  "lodash.mergewith": "4.6.2"
24
25
  },
25
26
  "devDependencies": {
@@ -28,5 +29,5 @@
28
29
  "jest-expo": "44.0.1",
29
30
  "react": "17.0.2"
30
31
  },
31
- "gitHead": "020fbde2bc77c0460fe91da0168b1e6cc8ac0bdd"
32
+ "gitHead": "d27b3d1e2257b5a31923277c60ef26858bd4b59d"
32
33
  }
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('jest-svg-transformer');