squidfunk / karma-viewport

A Karma plugin for testing responsive features and layout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with PhantomJs

woile opened this issue · comments

Description

I'm trying to configure karma-viewport with nwb

It uses the same configuration as karma. Reference here

Expected behavior

Should be able to run tests

Actual behavior

I get this error:

13 02 2018 20:00:34.010:INFO [karma]: Karma v2.0.0 server started at http://0.0.0.0:9876/
13 02 2018 20:00:34.011:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
13 02 2018 20:00:34.032:INFO [launcher]: Starting browser PhantomJS
13 02 2018 20:00:34.260:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: Connected on socket _DmFXaxpo6oUgeICAAAA with id 25650588
PhantomJS 2.1.1 (Linux 0.0.0) ERROR
  {
    "message": "ReferenceError: Can't find variable: describe\nat webpack:///tests/index-test.js:12:0 <- tests/index-test.js:23099:9",
    "str": "ReferenceError: Can't find variable: describe\nat webpack:///tests/index-test.js:12:0 <- tests/index-test.js:23099:9"
  }
PhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 0 ERROR (0.134 secs / 0 secs)
Karma exit code was 1
error Command failed with exit code 1.

Steps to reproduce the bug

  1. Create package with nwb
  2. Include in nwb.config.js:
  karma: {
    frameworks: [
      'viewport'
    ],
    plugins: [
      require('karma-viewport')
    ]
  }
  1. Run npm test
  2. Observe

Package versions

   "karma-viewport": "^0.4.2",
    "nwb": "0.21.x",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",

System information

  • OS: Linux debian sid amd64
  • Browser: PhantomJS (?)

Thanks a lot!!

Fixed. Just for reference. With nwb this is the configuration:

karma: {
    config(config) {
      config.frameworks.push('viewport')
      config.plugins.push(require('karma-viewport'))
      return config
    }
  }