Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Do the tests work? #1

Closed
rhalff opened this issue Feb 15, 2016 · 5 comments
Closed

Do the tests work? #1

rhalff opened this issue Feb 15, 2016 · 5 comments

Comments

@rhalff
Copy link

rhalff commented Feb 15, 2016

Hi I came here because my own rollup setup seems to be broke.

But when I try your repository and change the test to something failing there also seems to be no failures reported.

Just wondering whether this is my local setup or you can confirm the tests are broken.

e.g. if I change the test to something like this:
expect(wrapper.find('div')).to.have.length(99999999);

The output of running npm test is:

$ npm test

> [email protected] pretest /tmp/react-lib-starterkit
> npm run build && npm run lint


> [email protected] prebuild /tmp/react-lib-starterkit
> rimraf dist


> [email protected] build /tmp/react-lib-starterkit
> rollup-babel-lib-bundler src/index.js

Treating 'react' as external dependency
Treating 'react' as external dependency
Treating 'react' as external dependency
No name was provided for external module 'react' in options.globals – guessing 'React'
All done!
Built ES6 module for react-lib-starterkit. Took 305 ms
Built CJS module for react-lib-starterkit. Took 310 ms
Built UMD module for react-lib-starterkit. Took 317 ms

> [email protected] lint /tmp/react-lib-starterkit
> eslint .


> [email protected] test /tmp/react-lib-starterkit
> karma start

✔ /tmp/react-lib-starterkit [master|✚ 1] 
@rhalff rhalff closed this as completed Feb 15, 2016
@frostney
Copy link
Owner

Hi Rob,
unfortunately the tests don't work currently. As far as I can tell this may be related to jlmakes/karma-rollup-preprocessor#6.

I do have some local changes where I tried to fix it but without success so far.

Please leave this issue open until I find a permanent solution.

@frostney frostney reopened this Feb 15, 2016
@rhalff
Copy link
Author

rhalff commented Feb 15, 2016

Using config.LOG_DEBUG within karma gives a bit more info on what is loaded.

Apparently there is an error going on within karma-rollup-preprocessor.
I cannot get the error to actually be displayed though.

If I just a hack a console log in the catch of rollup-preprocessor, it tells me:

[Error: Couldn't find preset "airbnb" relative to directory "/tmp/starterkit/node_modules/enzyme"]

(The project base is /tmp/starterkit in this case)

The error message makes me think it's maybe npm 3 incompatability

@rhalff
Copy link
Author

rhalff commented Feb 15, 2016

This one is also useful perhaps:
rollup/rollup#357

@frostney
Copy link
Owner

Thank you for digging into this @rhalff. I've found out that rollup-plugin-node-resolver (formerly rollup-plugin-npm) doesn't play well with rollup-plugin-commonjs in the context of Karma. I've been able to do a simple example without any Enzyme, React test utils or React, but as soon I try to include non-trivial script files, Karma fails silently.

Unfortunately I feel the best option right now is to go Webpack for tests.

@frostney
Copy link
Owner

After moving the .babelrc into the structure as suggested in the issue you linked, tests with Webpack work now.

Feel free to re-open the issue @rhalff if the issue still exists for you.

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

No branches or pull requests

2 participants