Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1.0 and v1.2.0 do not run any tests #2217

Closed
oocx opened this issue Jun 29, 2016 · 15 comments
Closed

v1.1.0 and v1.2.0 do not run any tests #2217

oocx opened this issue Jun 29, 2016 · 15 comments

Comments

@oocx
Copy link

oocx commented Jun 29, 2016

Expected behavior

Karma runs my tests

Actual behavior

I see the following output:

29 06 2016 15:12:22.909:INFO [karma]: Karma v1.1.0 server started at http://localhost:9876/
29 06 2016 15:12:22.913:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
29 06 2016 15:12:22.927:INFO [launcher]: Starting browser PhantomJS
29 06 2016 15:12:25.739:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#bDpfsp5qhtjVLGXQAAAA with id 3610229

START:
(node:20928) Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]
(node:20928) Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]
(node:20928) Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]
(node:20928) Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]
(node:20928) Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]
(node:20928) Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]
(node:20928) Warning: .then() only accepts functions but was passed: [object Undefined], [object Undefined]
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmineRequire
  at G:/Cloud/Apps/REMProcessPilot/angular2-webpack/Diamant.Cloud.Apps.REMProcessPilot/node_modules/karma-jasmine-html-reporter/src/lib/html.jasmine.reporter.js:24
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmineRequire
  at G:/Cloud/Apps/REMProcessPilot/angular2-webpack/Diamant.Cloud.Apps.REMProcessPilot/node_modules/karma-jasmine-html-reporter/src/lib/html.jasmine.reporter.js:24
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmineRequire
  at G:/Cloud/Apps/REMProcessPilot/angular2-webpack/Diamant.Cloud.Apps.REMProcessPilot/node_modules/karma-jasmine-html-reporter/src/lib/html.jasmine.reporter.js:24

Finished in 0.151 secs / 0 secs

SUMMARY:
√ 0 tests completed

Enviroment Details

  • Karma Version 1.1.0
  • Windows 8.1

Karma.conf.js:

const webpackConfig = require('./webpack.tests.config.js');

module.exports = function (config) {
    config.set({

        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '..',

        // frameworks to use
        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            { pattern: 'config/tests.js', included: true, watched: false },
            { pattern: 'static/images/**/*', included: false, watched: false },
            { pattern: 'static/data/**/*', included: false, watched: false }
        ],

        // list of files to exclude
        exclude: [
        ],
        proxies: {
            '/images': '/base/static/images',
            '/data': '/base/static/data'
        },

        webpack: webpackConfig,

        webpackMiddleware: {
            noInfo: true,
            stats: {
                colors: true
            }
        },

        plugins: [
            'karma-webpack',
            'karma-jasmine',
            'karma-phantomjs-launcher',
            'karma-chrome-launcher',
            'karma-verbose-reporter',
            'karma-clear-screen-reporter',
            'karma-jasmine-html-reporter',
            'karma-sourcemap-loader',
            'karma-mocha-reporter',
            'karma-trx-reporter'
        ],

        preprocessors: {
            'config/tests.js': ['webpack', 'sourcemap'],
        },

        verboseReporter: {
            color: 'full',
        },

        trxReporter: { outputFile: 'test-results.trx' },

        mochaReporter: {
            // output: 'autowatch'

        },


        // test results reporter to use
        // possible values: 'progress', 'verbose', 'kjhtml', 'mocha', 'trx'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['kjhtml', 'mocha', 'trx'],

        // web server port
        port: 9876,

        webpackServer: { noInfo: true },

        // enable / disable colors in the output (reporters and logs)
        colors: true,

        // level of logging
        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: true,

        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['PhantomJS'],
        //browsers: ['Chrome'],

        // Continuous Integration mode
        // if true, Karma captures browsers, runs the tests and exits
        singleRun: false,

        // Concurrency level
        // how many browser should be started simultaneous
        concurrency: Infinity
    });
}

Steps to reproduce the behaviour

  1. Upgrade karma to 1.1.0
  2. karma start karma.conf.js

Karma works as expected with 1.0.0

@kevinSuttle
Copy link

kevinSuttle commented Jun 30, 2016

Same, but different env.

❯ karma start

30 06 2016 00:56:05.865:INFO [karma]: Karma v1.1.0 server started at http://localhost:9876/
30 06 2016 00:56:05.868:INFO [launcher]: Launching browser Chrome with unlimited concurrency
30 06 2016 00:56:05.877:INFO [launcher]: Starting browser Chrome
30 06 2016 00:56:06.924:INFO [Chrome 51.0.2704 (Mac OS X 10.11.5)]: Connected on socket /#PUznwnnYyUP5WpwSAAAA with id 37853966
Chrome 51.0.2704 (Mac OS X 10.11.5) ERROR
  Uncaught TypeError: Cannot read property 'call' of undefined
  at node_modules/mocha/mocha.js:707


npm ERR! Test failed.  See above for more details.

Test

describe('test'), () => {
  it('works'), () => {
  // it works
  }
}

In my case, downgrading to 1.0 does not help.

30 06 2016 01:04:37.620:INFO [karma]: Karma v1.0.0 server started at http://localhost:9876/
30 06 2016 01:04:37.623:INFO [launcher]: Launching browser Chrome with unlimited concurrency
30 06 2016 01:04:37.630:INFO [launcher]: Starting browser Chrome
30 06 2016 01:04:38.762:INFO [Chrome 51.0.2704 (Mac OS X 10.11.5)]: Connected on socket /#-xyAZYJ_t7xKqlgKAAAA with id 99821804
Chrome 51.0.2704 (Mac OS X 10.11.5) ERROR
  Uncaught TypeError: Cannot read property 'call' of undefined
  at node_modules/mocha/mocha.js:707


npm ERR! Test failed.  See above for more details.

Nor does an older version.

30 06 2016 01:11:58.152:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
30 06 2016 01:11:58.160:INFO [launcher]: Starting browser Chrome
30 06 2016 01:11:59.535:INFO [Chrome 51.0.2704 (Mac OS X 10.11.5)]: Connected on socket /#kmC-lF1fJcKQ3FYuAAAA with id 24896962
Chrome 51.0.2704 (Mac OS X 10.11.5) ERROR
  Uncaught TypeError: Cannot read property 'call' of undefined
  at /Users/kevinSuttle/Code/platform-ui-primitives/node_modules/mocha/mocha.js:707

karma.config.js

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['mocha'],
    files: [
      'test/index.test.js',
    ],
    reporters: ['progress'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: false,
    browsers: ['Chrome'],
    singleRun: true,
    concurrency: Infinity,
  })
}

I noticed I don't get the error when I set singleRun: false or use the --no-single-run flag on the CLI.

> karma start "--autowatch" "--no-single-run"

30 06 2016 01:21:24.661:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
30 06 2016 01:21:24.684:INFO [launcher]: Starting browser Chrome
30 06 2016 01:21:27.039:INFO [Chrome 51.0.2704 (Mac OS X 10.11.5)]: Connected on socket /#QKoNH6EioACbsX-6AAAA with id 71228018

@kevinSuttle
Copy link

@oocx Are you using Babel 6 and/or Webpack 2.x?

@oocx
Copy link
Author

oocx commented Jun 30, 2016

Babel 6 and Webpack 1.13.1

I'm compiling with TypeScript to ES2015 (so that I can use async/await in TypeScript), and then from ES2015 to ES5 with Babel.

Here are my devDependencies:

"devDependencies": {
    "awesome-typescript-loader": "^1.1.1",
    "babel-core": "^6.10.4",
    "babel-loader": "^6.2.4",
    "babel-preset-es2015": "^6.9.0",
    "canonical-path": "0.0.2",
    "codelyzer": "0.0.24",
    "copy-webpack-plugin": "3.0.1",
    "css-loader": "^0.23.1",
    "dgeni": "^0.4.2",
    "dgeni-packages": "^0.13.0",
    "file-loader": "^0.9.0",
    "istanbul-instrumenter-loader": "^0.2.0",
    "jasmine-core": "^2.4.1",
    "json-loader": "^0.5.4",
    "karma": "^1.0.0",
    "karma-chrome-launcher": "^1.0.1",
    "karma-clear-screen-reporter": "^1.0.0",
    "karma-coverage": "^1.0.0",
    "karma-firefox-launcher": "^1.0.0",
    "karma-ie-launcher": "^1.0.0",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.0",
    "karma-mocha-reporter": "^2.0.4",
    "karma-phantomjs-launcher": "^1.0.1",
    "karma-remap-istanbul": "https://github.com/ghpabs/karma-remap-istanbul",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-trx-reporter": "^0.2.6",
    "karma-verbose-reporter": "0.0.3",
    "karma-webpack": "^1.7.0",
    "less": "^2.7.1",
    "less-loader": "^2.2.3",
    "phantomjs-prebuilt": "^2.1.7",
    "promise-loader": "^1.0.0",
    "protractor": "^3.3.0",
    "raw-loader": "^0.5.1",
    "remap-istanbul": "^0.6.4",
    "rimraf": "^2.5.2",
    "source-map-loader": "^0.1.5",
    "style-loader": "^0.13.1",
    "ts-node": "^0.9.3",
    "tslint": "^3.12.1",
    "tslint-loader": "^2.1.5",
    "typedoc": "^0.4.4",
    "typescript": "^1.8.10",
    "typings": "^1.3.1",
    "url-loader": "^0.5.7",
    "webpack": "^1.13.1",
    "webpack-dev-server": "^1.14.1"
  },

@mspoulsen
Copy link

I use same simple config as Kevin and my tests don't run either. I don't get any errors, karma just doesn't run my tests. My solution was also to add --auto-watch --no-single-run. I tried 0.13.22, 1.0.0 and 1.1.0 and behavior is the same in all of them.

@pracucci
Copy link

Same here. I had to switch back to 0.13.* to fix it.

@jacquesdev
Copy link

For what it's worth, I tested on 1.0.0 and 1.10 and had the issue, but it's no longer there when I went back to 0.13.22.

@kevinSuttle
Copy link

@jacquesdev What else changed in your package.json?

@jacquesdev
Copy link

jacquesdev commented Jul 15, 2016

Nothing else changed, I am setting up tests for the first time. When I tried running tests on 1+ I get the warning, but not on 0.13.22. Since I am just getting the warnings and no errors, I guess I don't have the exact same issue the other users are having.

@lukeapage
Copy link
Contributor

Same problem here, also using webpack. In my case it works in 1.0.0 but not 1.1.0 or 1.1.2

11 08 2016 19:47:27.122:INFO [karma]: Karma v1.1.0 server started at http://localhost:9876/
11 08 2016 19:47:27.124:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
11 08 2016 19:47:27.374:INFO [launcher]: Starting browser PhantomJS
11 08 2016 19:47:30.463:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#DAIf8NHeJumyG8OvAAAA with id 35542584
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmineRequire
  at C:/Project/node_modules/karma-jasmine-html-reporter/src/lib/html.jasmine.reporter.js:24

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmineRequire
  at C:/Project/node_modules/karma-jasmine-html-reporter/src/lib/html.jasmine.reporter.js:24

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmineRequire
  at C:/Project/node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:6

PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmineRequire
  at C:/Project/node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:6

Warning: Task "karma:debug" failed. Use --force to continue.

@dignifiedquire
Copy link
Member

The original issue has been resolved in the latest version. @lukeapage can you open a new issue about your problem please?

@oocx
Copy link
Author

oocx commented Aug 12, 2016

The problem is NOT fixed. Please reopen this issue.

All you fixed is that the output no longer contains the promise warnings, which is not what this bug report was about. The problem is that karma is not running any tests!

START:
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmine
  at G:/Cloud/Apps/REMProcessPilot/angular2-webpack/Diamant.Cloud.Apps.REMProcessPilot/node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:6
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmine
  at G:/Cloud/Apps/REMProcessPilot/angular2-webpack/Diamant.Cloud.Apps.REMProcessPilot/node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:6
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  ReferenceError: Can't find variable: jasmine
  at G:/Cloud/Apps/REMProcessPilot/angular2-webpack/Diamant.Cloud.Apps.REMProcessPilot/node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:6
12 08 2016 07:22:49.004:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times)
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  Disconnectedundefined
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  Disconnectedundefined
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
  Disconnectedundefined
12 08 2016 07:22:49.008:ERROR [launcher]: PhantomJS crashed.


Finished in 0.142 secs / 0 secs

SUMMARY:
√ 0 tests completed

@oocx oocx changed the title v1.1.0 does not run any tests v1.1.0 and v1.2.0 do not run any tests Aug 12, 2016
@dignifiedquire
Copy link
Member

@oocx can you please provide a repo that reproduces this error, all jasmine tests I have are running fine on the latest version.

@oocx
Copy link
Author

oocx commented Sep 1, 2016

After updating other dependencies, karma 1.2 is working for me now. I don't know which combination of dependencies exactly has caused the problem. I updated from Angular RC5 to RC6 and during that update I also updated jasmine-core (to 2.5.0), zone.js (to 0.6.17), rxjs (to 5.0.0-beta.11) and several other dependencies.

@oocx oocx closed this as completed Sep 1, 2016
@Rouche
Copy link

Rouche commented Aug 16, 2017

On Linux,
karma 1.7.0, jasmine-core 2.7.0 - same problem
ReferenceError: Can't find variable: jasmineRequire
We also use grunt-karma, but it seems old and a deprecation warning appear on top of the start process:

[ERROR] WARN `start` method is deprecated since 0.13. It will be removed in 0.14. Please use 
[ERROR]   server = new Server(config, [done])
[ERROR]   server.start()
[ERROR] instead.

@tyeHoward
Copy link

Saw this problem on Linux, karma 1.7.1, karma-jasmine 0.1.6.
Updating karma-jasmine to 1.1.1 resolved the issue.

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

No branches or pull requests

9 participants