mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-05-28 08:17:37 +08:00
Adds JSX extension support (#563)
* Adds JSX extension support * PR changes * Add testRegex * Add note about not recommending JSX, link to issue
This commit is contained in:
committed by
Dan Abramov
parent
6da29550de
commit
49e4f64620
@@ -19,6 +19,7 @@ module.exports = (resolve, rootDir) => {
|
||||
}
|
||||
|
||||
const config = {
|
||||
moduleFileExtensions: ['jsx', 'js', 'json'],
|
||||
moduleNameMapper: {
|
||||
'^[./a-zA-Z0-9$_-]+\\.(jpg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm)$': resolve('config/jest/FileStub.js'),
|
||||
'^[./a-zA-Z0-9$_-]+\\.css$': resolve('config/jest/CSSStub.js')
|
||||
@@ -26,7 +27,8 @@ module.exports = (resolve, rootDir) => {
|
||||
scriptPreprocessor: resolve('config/jest/transform.js'),
|
||||
setupFiles: setupFiles,
|
||||
testPathIgnorePatterns: ['<rootDir>/(build|docs|node_modules)/'],
|
||||
testEnvironment: 'node'
|
||||
testEnvironment: 'node',
|
||||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(js|jsx)$',
|
||||
};
|
||||
if (rootDir) {
|
||||
config.rootDir = rootDir;
|
||||
|
||||
Reference in New Issue
Block a user