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

End webpack-isomorphic-tools in mocha process when testing render on server #50

Closed
joehua87 opened this issue Feb 16, 2016 · 5 comments
Closed

Comments

@joehua87
Copy link

Thank you for your awesome works :)

I've try to test render on server, everything work well but I cannot find a way to end web pack-isomorphic-tools process

Code here:
https://github.com/joehua87/redux-universal/blob/master/tests/server-render.test.js

Can we provide the way to force stop it?
Thank you :)

@joehua87 joehua87 changed the title End mocha process when testing server on render End pack-isomorphic-tools in mocha process when testing server on render Feb 16, 2016
@joehua87 joehua87 changed the title End pack-isomorphic-tools in mocha process when testing server on render End webpack-isomorphic-tools in mocha process when testing server on render Feb 16, 2016
@joehua87 joehua87 changed the title End webpack-isomorphic-tools in mocha process when testing server on render End webpack-isomorphic-tools in mocha process when testing render on server Feb 16, 2016
@catamphetamine
Copy link
Owner

Hello.
I guess that may be the case when it waits for webpack-assets.json to be created and doesn't exit until the file is created
https://github.com/halt-hammerzeit/webpack-isomorphic-tools/blob/master/source/index.js#L589-L595

Check that ${root}/webpack-assets.json file exists before running these tests.
Or you can do a simple fs.writeFileSync() in this case.

@joehua87
Copy link
Author

I see that the file is created & I can receive the rendered content. All tests passed except exit

@catamphetamine
Copy link
Owner

I cloned your repo and ran the tests (npm test instead of npm run test) and they are passing.
You should also add mocha to your dependencies.

G:\work\redux-universal [tests +1 ~1 -0 !]> npm test

> redux-universal@0.1.0 test G:\work\redux-universal
> better-npm-run test

running better-npm-run in G:\work\redux-universal
Executing script: test

to be executed: webpack --config webpack/webpack.config.js && mocha --require babel-register ./tests/**/*.test.js -t 250
00
Hash: 19beed511fe22cf1c50b
Version: webpack 1.12.13
Time: 6567ms
                       Asset     Size  Chunks             Chunk Names
            vendor.bundle.js   3.4 MB       0  [emitted]  vendor
main-19beed511fe22cf1c50b.js  2.45 MB       1  [emitted]  main
Hash: 19beed511fe22cf1c50b
Version: webpack 1.12.13
Time: 6567ms
                       Asset     Size  Chunks             Chunk Names
            vendor.bundle.js   3.4 MB       0  [emitted]  vendor
main-19beed511fe22cf1c50b.js  2.45 MB       1  [emitted]  main
   [0] multi vendor 40 bytes {0} [built]
   [0] multi main 40 bytes {1} [built]
    + 1030 hidden modules


  Server Rendering
    /user
==> �  Listening on port 3000. Open up http://localhost:3000/ in your browser.
Action {}
      √ should has users rendered
    /user:username
Action {}
Action {}
Action { type: '$$local.register',
  payload:
   { ident: 'app',
     initial: 0,
     reducer: [Function: reducer],
     persist: [Function: identity] } }
      √ should has users rendered
      √ should has user detail rendered


  3 passing (7s)

G:\work\redux-universal [tests +1 ~1 -0 !]>

@joehua87
Copy link
Author

Thank you :)

@catamphetamine
Copy link
Owner

FYI
I'm posting this in every issue and PR to notify whoever may be interested:
today I've released an alternative helper library called universal-webpack.
It takes a different approach than webpack-ismorphic-tools and instead of hacking Node.js require() calls it just compiles all code with target: 'node' webpack configuration option.
As a result, all Webpack plugins and features are supported.
If you think you might need that here's an example project:
https://github.com/halt-hammerzeit/webpack-react-redux-isomorphic-render-example

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

No branches or pull requests

2 participants