Closed AdamBrodzinski closed 6 years ago
Hi there ๐ tests are broken right now for Reason-scripts, and we donโt have a good plan to fix it.
The problem is that compiling to ES6 modules entirely breaks Jest, because BuckleScript also compiles node_modules to ES6 modules. Jest doesnโt process these, so everything ends up broken. Itโs a choice of either ES6 modules at the moment, or tests ๐
Ah ok good to know, and thanks for the super fast response!
So I have my bsconfig
set to commonjs
, is it expected to break in both cases of es6
or commonjs
? Everything works as long as I do either of the 2 work around options above with commonjs
(fresh install with react boilerplate + subdirs config).
{
"name": "reason-scripts",
"sources": [{ "dir": "src", "subdirs": true }],
"bs-dependencies": ["reason-react", "@glennsl/bs-jest", "bs-fetch"],
"reason": {
"react-jsx": 2
},
"refmt": 3,
"package-specs": {
"module": "commonjs",
"in-source": true
},
"suffix": ".bs.js"
}
and package.json
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.4.2",
"react-dom": "^16.4.2",
"reason-scripts": "1.0.0-beta4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"@glennsl/bs-jest": "^0.4.3",
"bs-fetch": "^0.3.0",
"bs-platform": "^4.0.3",
"reason-react": "^0.5.3"
}
}
I've had issues with reason-scripts for tests and coverage for some time and ended up calling jest instead for simple testing.
"test": "jest --env=jsdom --testMatch='**/test/*test.{js, re}' --watch"
Also stuck on 0.8.0
since I can't get code coverage to work with later versions ๐ฟ
@rrdelaney Bit of an issue high-jack, I noticed reason-scripts development slowed down and is now part of reasonml-old
, I presume users should be looking to migrate away from these scripts? Are there plans for a successor project? Or should I stop being lazy and learn how to configure my projects? ๐
@RawToast Best way to run a Reason project in my experience is to use bsb -init && yarn add --dev parcel
. There's no hacks like bs-loader
had and is a much more stable setup.
Hello,
I'm using the latest
1.0.0-beta4
and when I do ayarn test
the test that's included does not run. I'm pretty sure at some point in the past it did run however. I'm more than happy to setup a repro and give more info but I wasn't sure if this was a known problem.However, i've figured out how to narrow it down and make those tests pass.
Option 1 First I have to remove the
.bs.js
to get it to see the js file then change the_test
to.test
... eg changeapp_test.bs.js
toapp.test.js
then jest picks up the file and shows me the pass/fail as expected. This isn't useable of course but at least shines some light onto a file pattern matching issue.Option 2 Put the tests in a
__tests__
directory and turn onsubdirs
in the bsconfig.OSX 10.12.4 bs-platform - 4.0.3 1.0.0-beta-4
Thanks for all you're hard work! ๐บ ๐