eddyerburgh / jest-transform-stub Goto Github PK
View Code? Open in Web Editor NEWJest stub transform
License: MIT License
Jest stub transform
License: MIT License
When importing an image, the import returns an empty Object
instead of a an empty String
.
This causes issues with prop type validation / type checking.
I don't understand how it's happening as all the index.js
of this package does is return ''
, but in a normal Vue CLI 3 setup with jest enabled, the prop type for images is object
.
I installed it and I use the project created by create react app.
but never run
● Test suite failed to run
/path/to/node_modules/jest-styled-components/src/toHaveStyleRule.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import { __DO_NOT_USE_OR_YOU_WILL_BE_HAUNTED_BY_SPOOKY_GHOSTS as internals } from 'styled-components'
where can I write it?
transform: {
"^.+\\.js$": "babel-jest",
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
},
I wrote in package.json
> react-scripts-ts test --env=jsdom
Out of the box, Create React App only supports overriding these Jest options:
• collectCoverageFrom
• coverageReporters
• coverageThreshold
• snapshotSerializers
• moduleNameMapper.
These options in your package.json Jest configuration are not currently supported by Create React App:
• transform
If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.
npm ERR! Test failed. See above for more details.
the error.
When using storybook,
transform: {
'^.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
// ... snip ...
},
cannot fix the problem (Syntax Error: Invalid or unexpected token
), but,
moduleNameMapper: {
'^.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
},
can fix the problem. I'm not sure the reason.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.