darul75/web-react

Tests

Closed this issue · 5 comments

ktmn commented

Quick question about tests

C:\Users\User\Documents\Apps\web-react (master)
λ npm run test

> web-react@1.0.6 test C:\Users\User\Documents\Apps\web-react
> mocha app/**/*-test.js --colors --compilers js:babel/register --recursive



  Todo-item component
    1) "before all" hook: render and locate element


  0 passing (67ms)
  1 failing

  1) Todo-item component "before all" hook: render and locate element:
     Error: Cannot find module 'jsdom'
      at Object.<anonymous> (C:/Users/User/Documents/Apps/web-react/conf/tests/setup.js:1:13)
      at Context.<anonymous> (C:/Users/User/Documents/Apps/web-react/app/components/TodoSection/__tests__/TodoItem-test.js:15:4)

I did try to install them globally

npm i mocha -g
npm i jsdom -g

but still got that error. Then I tried to install it locally

npm i jsdom --save

and now it's giving this error:

  1) Todo-item component "before all" hook: render and locate element:
     C:\Users\User\Documents\Apps\web-react\node_modules\jsdom\lib\jsdom.js:3
`jsdom 4.x onward only works on io.js, not Node.js™: https://github.com/tmpvar
^

Is it wrong jsdom or something?

Have you run npm install first ? I remember jsdom new version are not compliant with node, check for and old one.
Or remove node_modules folder and run npm install
Again

currently doing some changes on master branch, be careful to use released one

ktmn commented

I ran npm install, it installed the "jsdom": "^5.5.0" version

If I remove version 5.5.0, change it to ^2.0.0 and run install again it starts throwing errors about me not having python installed. So now I need that too?

ktmn commented

Installed Python 2.7 and Visual Studio Express 2013 (1.2gb, that's quite the dependancy!) and changed both jsdom versions in the package.json to 3.0.0, ran npm install and tests now work.

Sorry busy repairing car this morning ;) nice work I remember having installed all this stuff, nice work dude