@ornikar/jest-config-react 9.5.1 → 9.6.2

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/.eslintrc.json CHANGED
@@ -1,4 +1,8 @@
1
1
  {
2
2
  "root": true,
3
- "extends": ["@ornikar/eslint-config/node"]
3
+ "extends": ["@ornikar/eslint-config/node"],
4
+ "rules": {
5
+ "security/detect-non-literal-fs-filename": "off",
6
+ "security/detect-non-literal-require": "off"
7
+ }
4
8
  }
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
+ ## [9.6.2](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@9.6.1...@ornikar/jest-config-react@9.6.2) (2022-06-20)
7
+
8
+ **Note:** Version bump only for package @ornikar/jest-config-react
9
+
10
+
11
+
12
+
13
+
14
+ ## [9.6.1](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@9.6.0...@ornikar/jest-config-react@9.6.1) (2022-04-19)
15
+
16
+ **Note:** Version bump only for package @ornikar/jest-config-react
17
+
18
+
19
+
20
+
21
+
22
+ # [9.6.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@9.5.1...@ornikar/jest-config-react@9.6.0) (2022-04-01)
23
+
24
+
25
+ ### Features
26
+
27
+ * **jest-config-react:** improve svg transformer [no issue] ([#688](https://github.com/ornikar/shared-configs/issues/688)) ([d353d0e](https://github.com/ornikar/shared-configs/commit/d353d0e5151a3e0b790fc5805bc73bf9350efd68))
28
+
29
+
30
+
31
+
32
+
6
33
  ## [9.5.1](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@9.5.0...@ornikar/jest-config-react@9.5.1) (2022-03-29)
7
34
 
8
35
 
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@ornikar/jest-config-react",
3
- "version": "9.5.1",
3
+ "version": "9.6.2",
4
4
  "description": "✅⚛️ jest config for react",
5
- "repository": "ornikar/shared-configs",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/ornikar/shared-configs.git",
8
+ "directory": "@ornikar/jest-config-react"
9
+ },
6
10
  "main": "jest-preset.js",
7
11
  "license": "ISC",
8
12
  "engines": {
@@ -19,16 +23,15 @@
19
23
  "react-dom": "^16.6.3 || ^17.0.0"
20
24
  },
21
25
  "dependencies": {
22
- "@ornikar/jest-config": "^7.1.4",
23
- "identity-obj-proxy": "^3.0.0",
24
- "jest-svg-transformer": "^1.0.0"
26
+ "@ornikar/jest-config": "^7.1.5",
27
+ "identity-obj-proxy": "^3.0.0"
25
28
  },
26
29
  "devDependencies": {
27
- "@testing-library/react": "12.1.4",
30
+ "@testing-library/react": "12.1.5",
28
31
  "@testing-library/react-hooks": "7.0.2",
29
32
  "jest": "26.6.3",
30
33
  "react": "17.0.2",
31
34
  "react-dom": "17.0.2"
32
35
  },
33
- "gitHead": "1b5a0d70d0312f9c1daa99b73c5b2b5c6ea1c8eb"
36
+ "gitHead": "ab2d4c9d4c9b8c9c610eb592330cfa99ec5c21fc"
34
37
  }
@@ -3,8 +3,8 @@
3
3
  const path = require('path');
4
4
 
5
5
  module.exports = {
6
- process(src, filename) {
7
- const assetFilename = JSON.stringify(path.basename(filename));
6
+ process(src, filePath) {
7
+ const assetFilename = JSON.stringify(path.basename(filePath));
8
8
  return `module.exports = ${assetFilename};`;
9
9
  },
10
10
  };
@@ -1,5 +1,17 @@
1
1
  'use strict';
2
2
 
3
- const { process } = require('jest-svg-transformer');
3
+ const path = require('path');
4
4
 
5
- exports.process = process;
5
+ exports.process = function process(src, filePath) {
6
+ const assetFilename = JSON.stringify(path.basename(filePath));
7
+ return `
8
+ const { jsx } = require('react/jsx-runtime');
9
+ function JestSvgComponent(props) {
10
+ return jsx(
11
+ 'svg',
12
+ Object.assign({}, props, {'data-file-name': ${assetFilename}})
13
+ );
14
+ }
15
+ module.exports = JestSvgComponent;
16
+ `;
17
+ };
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const { process } = require('jest-svg-transformer');
3
+ const path = require('path');
4
+ const { process } = require('./svg-transformer-inline');
4
5
 
5
- exports.process = (src, filepath) => {
6
- const content = process(src, filepath);
6
+ exports.process = (src, filePath) => {
7
+ const assetFilename = JSON.stringify(path.basename(filePath));
8
+ const content = process(src, filePath);
7
9
  return content.replace(
8
10
  /module.exports = (.*);/,
9
11
  `module.exports = new Proxy({}, {
@@ -12,7 +14,7 @@ exports.process = (src, filepath) => {
12
14
  return true;
13
15
  }
14
16
  if (key === 'default') {
15
- return $1.name;
17
+ return ${assetFilename};
16
18
  }
17
19
  if (key === 'ReactComponent') {
18
20
  return $1;