mantra-sample-blog-app icon indicating copy to clipboard operation
mantra-sample-blog-app copied to clipboard

jsdom error on npm test

Open themeteorchef opened this issue 8 years ago • 3 comments

When I try to run tests I'm getting the following output. Of note, linting seems to work fine but as soon as the tests start up this error happens:

rglover @ ~/projects/themeteorchef/snippets/mantra/demo (master) $ npm test

> [email protected] test /Users/rglover/projects/themeteorchef/snippets/mantra/demo
> npm run lint && npm run testonly


> [email protected] lint /Users/rglover/projects/themeteorchef/snippets/mantra/demo
> eslint ./lib ./client ./server --ext .js


> [email protected] testonly /Users/rglover/projects/themeteorchef/snippets/mantra/demo
> mocha .scripts/mocha_boot.js client/**/tests/**/*.js --compilers js:babel-core/register

/Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/jsdom/lib/jsdom.js:3
() => `jsdom 7.x onward only works on Node.js 4 or newer: https://github.com/t
 ^
SyntaxError: Unexpected token )
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Module._extensions..js (module.js:478:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/babel-core/node_modules/babel-register/lib/node.js:166:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (mocha_boot.js:1:13)
    at Module._compile (module.js:460:26)
    at loader (/Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/babel-core/node_modules/babel-register/lib/node.js:158:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/babel-core/node_modules/babel-register/lib/node.js:168:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/mocha/lib/mocha.js:468:10)
    at Object.<anonymous> (/Users/rglover/projects/themeteorchef/snippets/mantra/demo/node_modules/mocha/bin/_mocha:403:18)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "run" "testonly"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] testonly: `mocha .scripts/mocha_boot.js client/**/tests/**/*.js --compilers js:babel-core/register`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] testonly script 'mocha .scripts/mocha_boot.js client/**/tests/**/*.js --compilers js:babel-core/register'.
npm ERR! This is most likely a problem with the mantra-demo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha .scripts/mocha_boot.js client/**/tests/**/*.js --compilers js:babel-core/register
npm ERR! You can get their info via:
npm ERR!     npm owner ls mantra-demo
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/rglover/projects/themeteorchef/snippets/mantra/demo/npm-debug.log
npm ERR! Test failed.  See above for more details.

Can this be easily solved by swapping a version somewhere or is it a bigger issue?

themeteorchef avatar May 05 '16 11:05 themeteorchef

Can you tell me what's your node version?

I mean that could you try to use node v6.0.0?

xcv58 avatar May 05 '16 20:05 xcv58

Same issue using node v4.20.6. Haven't had a chance to try with new node yet but I'm sure that's the issue.

ariesshrimp avatar Jun 09 '16 00:06 ariesshrimp

Got the same error ; updated to node 6.3.1 with n -> works fine, with just few warnings and 1 pending test :

npm test

> [email protected] test /Users/laurent/dev/meteor/mantra-sample-blog-app
> npm run lint && npm run testonly


> [email protected] lint /Users/laurent/dev/meteor/mantra-sample-blog-app
> eslint ./lib ./client ./server --ext .js


> [email protected] testonly /Users/laurent/dev/meteor/mantra-sample-blog-app
> mocha .scripts/mocha_boot.js client/**/tests/**/*.js --compilers js:babel-core/register



  comments.actions.comments
    create
      ✓ should reject if text is not there
      ✓ should reject if postId is not there
      ✓ should clear older LocalState for CREATE_COMMENT_ERROR
      ✓ should call Meteor.call to save the comment
      after Meteor.call
        if there is error
          ✓ should set CREATE_COMMENT_ERROR with the error message
    clearErrors
      ✓ should clear CREATE_COMMENT_ERROR local state

  comments.components.comment_list
    ✓ should list given number of items
    ✓ should list comment author for each item
    ✓ should list comment text for each item
    ✓ should list saving status for each item

  comments.components.create_comment
    ✓ should show the error if there are any
    ✓ should display the create comment form
    ✓ should create a new comment when click on the button

  comments.containers.comment_list
    composer
      ✓ should subscribe to posts.comments
      after subscribed
        ✓ should fetch data from all comments & pass to onData

  comments.containers.create_comment
    composer
      ✓ should get CREATE_COMMENT_ERROR from local state
      ✓ should call onData with null and {error}
      ✓ should return clearErrors
    depsMapper
      actions
        ✓ should map comments.create
        ✓ should map comments.clearErrors
      context
        ✓ should map the whole context as a function

  core.actions.posts
    create
      ✓ should reject if title is not there
      ✓ should reject if content is not there
      ✓ should clear older LocalState for SAVING_ERROR
      ✓ should call Meteor.call to save the post
      ✓ should redirect user to the post
      after Meteor.call
        if there is error
          ✓ should set SAVING_ERROR with the error message
    clearErrors
      ✓ should clear SAVING_ERROR local state

  core.components.main_layout
    ✓ should contain navigation
    ✓ should render childrens

  core.components.navigation
    ✓ should contain a link to home
    ✓ should contain a link to create a new post

  core.components.newpost
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
Warning: ReactComponentTreeDevtool: Missing React element for debugID 5 when building stack
    ✓ should show the error if there are any
    ✓ should display the create post form
    ✓ should create a new post when click on the button

  core.components.post
    ✓ should display the post title
    ✓ should display the post content
    ✓ should display saving indicator if saving prop is there

  core.components.postlist
    ✓ should list given number of items
    ✓ should list post title for each item
    ✓ shallow list post link for each items

  core.containers.newpost
    composer
      ✓ should get SAVING_ERROR from local state
      ✓ should call onData with null and {error}
      ✓ should return clearErrors
      - should get SAVING_NEW_POST from local state
    depsMapper
      actions
        ✓ should map posts.create
        ✓ should map posts.clearErrors
      context
        ✓ should map the whole context as a function

  core.containers.post
    composer
      ✓ should subscribe to the given postId via prop
      before subscription ready
        with latency componsation
          ✓ should call onData with data
        with no latency componsation
          ✓ should call onData without nothing
      after subscription is ready
        ✓ should call onData with data

  core.containers.postlist
    composer
      ✓ should subscribe to posts.list
      after subscribed
        ✓ should fetch data from all posts & pass to onData


  53 passing (255ms)
  1 pending

What's the pending test ( "should get SAVING_NEW_POST from local state" )

lc3t35 avatar Aug 03 '16 17:08 lc3t35