rrdelaney / reason-scripts

:beginner: Create a ReasonML and React development environment
MIT License
628 stars 58 forks source link

yarn test throws "Path must be a string." #50

Closed ghost closed 5 years ago

ghost commented 6 years ago

Hi guys,

I'm trying to run the tests but got "TypeError: Path must be a string.". I tried to install a new version of jest but it's not working as well.

rrdelaney commented 6 years ago

This is a known issue. Tests are currently broken on the latest version.

matdurand commented 6 years ago

I tried updating bs-jest to use the latest version inside reason-scripts, and now I'm getting:

/node_modules/@glennsl/bs-jest/src/jest.js:3
import * as List from "bs-platform/lib/es6/list.js";
^^^^^^

SyntaxError: Unexpected token import
rrdelaney commented 6 years ago

It's because of the ES modules flag being enabled, and Jest not being able to process it. Working on the fix ATM

anmonteiro commented 6 years ago

I fixed the original issue in bs-loader. Relevant commit: https://github.com/reasonml-community/bs-loader/commit/7b5b1a8441a8f289454c51c045aaf59b850a49c0

Not sure if this still needs to remain open because of the ES6 import error?

tkivela commented 6 years ago

Would be nice if another issue was opened about ES modules import bug, just trying Reason first time today and stumbled directly into it when trying 'yarn test'.

matdurand commented 6 years ago

Just a follow up on this...

I'm wondering why this commit doesn't seem to be part of the beta4 release. https://github.com/reasonml-community/reason-scripts/commit/71ecde5c4326fd6298170d1bedf5d8379ef133f7

I created a new project using beta4 and it doesn't match App_test.re. But referring master directly from github in package.json does the trick. However, I get a "Test suite failed to run" message with any apparent error for the standard "addition" sample test.

anmonteiro commented 6 years ago

@matdurand that's... weird. I'll double check tomorrow, and will cut a new release if I see the same.

reccanti commented 6 years ago

Hi everyone! I just ran into this issue @matdurand mentioned. Does anyone know if there's a fix or a workaround for it yet?

hmttrp commented 6 years ago

As stated here there will be a new release with a fix for this. Altho I wasn't able to test it yet.

For now you could replace in your bsconfig.json es6 with commonjs

"package-specs": {
    "module": "commonjs",
    "in-source": true
},
rrdelaney commented 5 years ago

Tests are pretty broke in reason-scripts, and there's no expected fix.