Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

craco test fails #24

Open
nirvdrum opened this issue Nov 20, 2019 · 4 comments
Open

craco test fails #24

nirvdrum opened this issue Nov 20, 2019 · 4 comments

Comments

@nirvdrum
Copy link

I've updated my package.json as shown in the test app, so I have:

"scripts": {
  "test": "craco test"
}

With this change, my test suite no longer runs. I went and checked out the craco-antd test app and I can't get yarn test to work there either. It looks like the less compiler isn't being invoked when it should :

 FAIL  src/App.test.tsx
  ● Test suite failed to run

    /home/nirvdrum/dev/workspaces/craco-antd/test-app/node_modules/antd/es/button/style/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import '../../style/index.less';
                                                                                             ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      10 | };
      11 | 
    > 12 | class App extends Component<any, State> {
         | ^
      13 |   state: State;
      14 | 
      15 |   constructor(props: any) {

      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:471:17)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:513:25)
      at Object.<anonymous> (src/App.tsx:12:1)
@filipjnc
Copy link

filipjnc commented Feb 16, 2020

The fix is here. Looking forward for the author to fix it.

@nirvdrum
Copy link
Author

Thanks for letting me know there's a solution available.

alistairjcbrown added a commit to alistairjcbrown/craco-antd that referenced this issue Jun 8, 2020
This change uses AntD code from `lib/` instead of `es/`, using
transpiled code as Jest will not transpile included code from
`node_modules`. Styles are also not included. There is no change for
built time, which continues to use the module code and pull styles.

Fixes DocSpring#10
Fixes DocSpring#24
@alistairjcbrown
Copy link

Has this issue been fixed now that PR #31 has landed and been released?

@nirvdrum
Copy link
Author

I'll try it out shortly. I had been holding off on upgrading for #42. I wasn't sure if the releases on NPM were legitimate or a hacked account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants