akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.77k stars 2.1k forks source link

Issues with project testing suite & Karma/Enzyme; #482

Closed pelhage closed 8 years ago

pelhage commented 8 years ago

Hey, I'd like to set up some tests for react-slick, but am having a few issues with the current set up:

A couple issues that are related

  1. npm run dev-test runs tests, but doesn't work when trying to use enzyme's render method.

PhantomJS 2.1.1 (Mac OS X 0.0.0) sample enzyme test should render FAILED
        TypeError: undefined is not a constructor (evaluating '_cheerio2['default'].load(html)') in /Users/Patrick/MEGA/Projects/react-slick/test/sample.js (line 32423)
        render@/Users/Patrick/MEGA/Projects/react-slick/test/sample.js:32423:36
        /Users/Patrick/MEGA/Projects/react-slick/test/sample.js:65:39
PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 2 of 2 (1 FAILED) (0 secs / 0.017 secPhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 2 of 2 (1 FAILED) (0.005 secs / 0.017 secs)```

I tried implementing some solutions to similarly reported issues but no luck. See https://github.com/airbnb/enzyme/issues/309 && https://github.com/producthunt/chai-enzyme/issues/46 && https://github.com/airbnb/enzyme/issues/47

  1. npm run test is returning errors (see npm debug log below)
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'test' ]
2 info using npm@2.15.8
3 info using node@v4.4.7
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info pretest react-slick@0.14.3
6 info test react-slick@0.14.3
7 verbose unsafe-perm in lifecycle true
8 info react-slick@0.14.3 Failed to exec test script
9 verbose stack Error: react-slick@0.14.3 test: `karma start --single-run`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:217:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:827:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid react-slick@0.14.3
11 verbose cwd /Users/Patrick/MEGA/Projects/react-slick
12 error Darwin 15.5.0
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "test"
14 error node v4.4.7
15 error npm  v2.15.8
16 error code ELIFECYCLE
17 error react-slick@0.14.3 test: `karma start --single-run`
17 error Exit status 1
18 error Failed at the react-slick@0.14.3 test script 'karma start --single-run'.
18 error This is most likely a problem with the react-slick package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     karma start --single-run
18 error You can get information on how to open an issue for this project with:
18 error     npm bugs react-slick
18 error Or if that isn't available, you can get their info via:
18 error
18 error     npm owner ls react-slick
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

2 could be a problem with my setup, but that would be surprising because npm run dev-test works and is the same command but without the --single-run flag

pelhage commented 8 years ago

If we could solve this, either by addressing the root problem or even switching to a slightly different testing set up, I'd be happy to start implementing tests for this project!

akiran commented 8 years ago

I create test setup with jest and enzyme.

Welcome PR's for tests