Comments (11)
yes, https://github.com/axelchalon/craco-issue
Notice how yarn start
works but yarn test
doesn't.
Some observations: tests work if there is only one test file, and tests work if I remove babel: {...}
from the export of craco.config.js
from craco.
Thank you for your bug report and your solution, I will look into this before the end of the week!
from craco.
Hi! The test
command doesn't seem to take the --react-scripts
value into account:
craco test --react-scripts ../../node_modules/react-scripts
FAIL src/stores/sendStore.spec.js
● Test suite failed to run
Cannot find module '/home/nicolas/www/fether/packages/fether-react/node_modules/react-scripts/config/paths.js'
craco {build,start} --react-scripts ../../node_modules/react-scripts
both work fine though!
from craco.
It took a while but I finally found some time to work on this!
It was not an easy one.
I published an alpha version, if anyone can try it: https://www.npmjs.com/package/@craco/craco/v/4.0.0
The problem was that the --workspace
, --scripts-version
and --react-scripts
options are provided by the CLI and the custom babel-jest
transformer provided by craco
doesn't have access to those options since the babel-jest
transformer is called directly by Jest in another process.
The solution is to define those options in the craco.config.js
file.
You can have a look here for the config: https://github.com/sharegate/craco/blob/add-paths-to-config-file/packages/craco/README.md#configuration-overview
Of course there is some drawback...
--workspace
,--scripts-version
and--react-scripts
cannot be specified by the CLI anymore.- Custom location for the config file (
--config
) cannot be specified if you need to usecraco
support forbabel-jest
from craco.
Can confirm craco {test,build,start}
all work fine with craco v4.0.0 and specifying reactScriptsPath
in craco.config.js 👍 thank you!
from craco.
@teevik I will add a configuration value to facilitate the usage of workspace but in the meantime what you can do is:
craco start --react-scripts ../../../node_modules/react-scripts
from craco.
Alright, thank you so much!
from craco.
@axelchalon +1. passing --workspace
flag did not help as well
from craco.
I will look into this as soon as possible. Thank you.
from craco.
@iamawebgeek @axelchalon could you provide a simple repository that reproduce the case?
It works fine with my sandbox project with either the --workspace
flag or a custom --react-scripts
path
"test": "craco test --verbose --workspace",
"test-react-scripts": "craco test --verbose --react-scripts ../../node_modules/react-scripts-custom"
Thank you
from craco.
Thank you @axelchalon
Oh that explains why, my sandbox project contains a single test file.
from craco.
Related Issues (20)
- `webpack`: TypeError: Cannot read properties of undefined (reading 'toString') HOT 1
- Add more unit and integration tests
- Craco start failed with `compiler.plugin is not a function` HOT 1
- craco changes the output content of the package file to package the original configuration file and own custom folder
- jest coverage options not used
- run craco start/build, it will exec twice craco.config.js HOT 1
- Development Server not Starting (craco start) HOT 2
- Change webpackConfig.entry as object, it build failed HOT 2
- CRACO build failes because of React Refresh Babel HOT 3
- I hope that the documentation can give an example of typescript configuration.
- Unable to build with Craco 7 due to attempted import error in React library
- Selectively suppress webpack runtime errors? HOT 1
- How can I import a hbs file as a string?
- Suport aliases in npx uninmported
- Depend on babel-jest HOT 3
- CRACO with linaria
- When I use babel to import other project's component, Unexpected behavior occur
- Existing jest tests are failing with upgrade to craco major version 7
- TypeError: Cannot read properties of undefined (reading 'D:\projects\my-project\frontend\craco.config.js')
- the svg in the package will be parsed into a path
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from craco.