Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-scripts/config/jest/fileTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ module.exports = {
const pascalCaseFilename = camelcase(path.parse(filename).name, {
pascalCase: true,
});
const componentName = `Svg${pascalCaseFilename}`;
// Convert invalid character to ASCII number
const pascalCaseValidFilename = pascalCaseFilename
.split('')
.map(char => (/[a-zA-Z0-9_]/.test(char) ? char : char.codePointAt(0)))
.join('');
const componentName = `Svg${pascalCaseValidFilename}`;
return `const React = require('react');
module.exports = {
__esModule: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@

import React from 'react';
import logo from './assets/logo.svg';
import logo2 from './assets/logo@2x.svg';

const SvgInclusion = () => (
<img id="feature-svg-inclusion" src={logo} alt="logo" />
<>
<img id="feature-svg-inclusion" src={logo} alt="logo" />
<img src={logo2} alt="logo" />
</>
);

export default SvgInclusion;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.