Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Test-app doesn't work #23

Open
fridek opened this issue Aug 21, 2015 · 2 comments
Open

Test-app doesn't work #23

fridek opened this issue Aug 21, 2015 · 2 comments

Comments

@fridek
Copy link

fridek commented Aug 21, 2015

For some time I'm trying to get my app working with karma-closure, unsuccessfully. Files seem to load, there are no errors even on debug setting, yet still no tests run and karma fails.
To finally find what is the proper karma.conf.js I turned to the example, and after adding a minimal package json (which is missing)

  "devDependencies": {
    "karma": "latest",
    "karma-jasmine": "latest",
    "karma-chrome-launcher": "latest"
  }

i runned karma start karma.conf.js just to see

Chrome 44.0.2403 (Linux 0.0.0) ERROR: 'goog.require could not find: main'

Chrome 44.0.2403 (Linux 0.0.0) ERROR
  Uncaught Error: goog.require could not find: main
  at karma-closure/test-app/lib/goog/base.js:353

So it seems the example app doesn't seem to work either.

My main app setup is:

// Karma configuration
// Generated on Sat Aug 08 2015 20:45:45 GMT+0200 (CEST)

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

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

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

    // list of files / patterns to load in the browser
    files: [
      // closure base
      'bower_components/closure-library/closure/goog/base.js',

      // included files - tests
      'app/src/**/*_test.js',

      // source files - these are only watched and served
      {pattern: 'app/src/**/*!(_test).js', included: false},

      // external deps
      {pattern: 'bower_components/closure-library/closure/goog/deps.js', included: false, served: false}
    ],

    // list of files to exclude
    exclude: [
      'bower_components/closure-library/closure/goog/**/*_test.js'
    ],

    preprocessors: {
      'app/src/**/*_test.js': ['closure', 'closure-iit'],
      'app/src/**/*!(_test).js': ['closure', 'coverage'],
      'bower_components/closure-library/closure/goog/deps.js': ['closure-deps']
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['nyan', 'coverage'],

    // web server port
    port: 9876,

    // 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_DEBUG,

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

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

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

and the result is

17:50 $ npm test

> myapp@0.0.1 test /home/myapp
> karma start karma.conf.js

21 08 2015 17:50:36.697:DEBUG [plugin]: Loading karma-* from /home/myapp/node_modules
21 08 2015 17:50:36.699:DEBUG [plugin]: Loading plugin /home/myapp/node_modules/karma-chrome-launcher.
21 08 2015 17:50:36.702:DEBUG [plugin]: Loading plugin /home/myapp/node_modules/karma-closure.
21 08 2015 17:50:36.703:DEBUG [plugin]: Loading plugin /home/myapp/node_modules/karma-coverage.
21 08 2015 17:50:36.793:DEBUG [plugin]: Loading plugin /home/myapp/node_modules/karma-jasmine.
21 08 2015 17:50:36.793:DEBUG [plugin]: Loading plugin /home/myapp/node_modules/karma-jasmine-matchers.
21 08 2015 17:50:36.794:DEBUG [plugin]: Loading plugin /home/myapp/node_modules/karma-nyan-reporter.

21 08 2015 17:50:36.832:DEBUG [preprocessor.coverage]: Processing "/home/myapp/app/src/main_test.js".
21 08 2015 17:50:36.841:DEBUG [preprocessor.coverage]: Processing "/home/myapp/app/src/ui/menu.jsx.js".
21 08 2015 17:50:36.843:DEBUG [preprocessor.coverage]: Processing "/home/myapp/app/src/ui/menu.js".
21 08 2015 17:50:36.846:DEBUG [preprocessor.coverage]: Processing "/home/myapp/app/src/main_test.js".
21 08 2015 17:50:36.893:DEBUG [preprocessor.coverage]: Processing "/home/myapp/app/src/main.js".
21 08 2015 17:50:36.897:INFO [karma]: Karma v0.13.9 server started at http://localhost:9876/
21 08 2015 17:50:36.899:INFO [launcher]: Starting browser Chrome
21 08 2015 17:50:36.899:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-45511918
21 08 2015 17:50:36.900:DEBUG [launcher]: google-chrome --user-data-dir=/tmp/karma-45511918 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=45511918
21 08 2015 17:50:37.793:DEBUG [web-server]: serving: /home/myapp/node_modules/karma/static/client.html
21 08 2015 17:50:37.801:DEBUG [web-server]: serving: /home/myapp/node_modules/karma/static/karma.js
21 08 2015 17:50:37.853:DEBUG [karma]: A browser has connected on socket WJIxZSuJSTDUf6-hAAAA
21 08 2015 17:50:37.854:DEBUG [web-server]: serving: /home/myapp/node_modules/karma/static/favicon.ico
21 08 2015 17:50:37.857:DEBUG [web-server]: upgrade /socket.io/?EIO=3&transport=websocket&sid=WJIxZSuJSTDUf6-hAAAA
21 08 2015 17:50:37.877:INFO [Chrome 44.0.2403 (Linux 0.0.0)]: Connected on socket WJIxZSuJSTDUf6-hAAAA with id 45511918
21 08 2015 17:50:37.877:DEBUG [launcher]: Chrome (id 45511918) captured in 0.98 secs
21 08 2015 17:50:37.884:DEBUG [web-server]: serving: /home/myapp/node_modules/karma/static/context.html
21 08 2015 17:50:37.888:DEBUG [middlware:source-files]: Requesting /base/node_modules/karma-closure/lib/no_deps_bullshit.js?4fdb1bf4700b2a9640ab9cdabde9b7f4525a2fc5 /
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Fetching /home/myapp/node_modules/karma-closure/lib/no_deps_bullshit.js
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Requesting /base/node_modules/jasmine-core/lib/jasmine-core/jasmine.js?578a1e5ff14db21b04e2d6db7fd0eda37042440c /
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Fetching /home/myapp/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Requesting /base/node_modules/karma-jasmine/lib/boot.js?4a7da64f416169520c9d5c43b5a7feac6bde9104 /
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Fetching /home/myapp/node_modules/karma-jasmine/lib/boot.js
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Requesting /base/node_modules/karma-jasmine/lib/adapter.js?3030709c83121e1b2ca4d1e657306b834fc13350 /
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Fetching /home/myapp/node_modules/karma-jasmine/lib/adapter.js
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Requesting /base/node_modules/karma-jasmine-matchers/node_modules/jasmine-expect/dist/jasmine-matchers.js?301a257b3374d4e9240a3ff6824e6a46f77699c7 /
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Fetching /home/myapp/node_modules/karma-jasmine-matchers/node_modules/jasmine-expect/dist/jasmine-matchers.js
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Requesting /base/bower_components/closure-library/closure/goog/base.js?969b5a69361222bc585c6096a36f195b26b85300 /
21 08 2015 17:50:37.889:DEBUG [middlware:source-files]: Fetching /home/myapp/bower_components/closure-library/closure/goog/base.js
21 08 2015 17:50:37.890:DEBUG [web-server]: serving (cached): /home/myapp/node_modules/karma-closure/lib/no_deps_bullshit.js
21 08 2015 17:50:37.890:DEBUG [web-server]: serving (cached): /home/myapp/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
21 08 2015 17:50:37.890:DEBUG [web-server]: serving (cached): /home/myapp/node_modules/karma-jasmine/lib/boot.js
21 08 2015 17:50:37.890:DEBUG [web-server]: serving (cached): /home/myapp/node_modules/karma-jasmine/lib/adapter.js
21 08 2015 17:50:37.891:DEBUG [web-server]: serving (cached): /home/myapp/node_modules/karma-jasmine-matchers/node_modules/jasmine-expect/dist/jasmine-matchers.js
21 08 2015 17:50:37.891:DEBUG [web-server]: serving (cached): /home/myapp/bower_components/closure-library/closure/goog/base.js
21 08 2015 17:50:37.892:DEBUG [middlware:source-files]: Requesting /base/app/src/main_test.js?7466871f56dbbee3808c2e0e2209579c98de47e1 /
21 08 2015 17:50:37.892:DEBUG [middlware:source-files]: Fetching /home/myapp/app/src/main_test.js
21 08 2015 17:50:37.892:DEBUG [web-server]: serving (cached): /home/myapp/app/src/main_test.js
21 08 2015 17:50:37.919:DEBUG [karma]: Run complete, exiting.
21 08 2015 17:50:37.919:DEBUG [launcher]: Disconnecting all browsers
21 08 2015 17:50:38.616:DEBUG [launcher]: Process Chrome exited with code 0
21 08 2015 17:50:38.616:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-45511918
npm ERR! Test failed.  See above for more details.
@hikirsch
Copy link
Contributor

I have the same issue. I've narrowed this down to the fact that the file_list_modified event wont fire a files promise in Protractor 0.13.0 anymore, but simply resolves the files directly. Simply removing the excess seemed to fix it. I can prepare a pull request tomorrow if the dev's are ok with that.

The only reference to this change that I can find is here: karma-runner/karma#851 (comment)

@hikirsch
Copy link
Contributor

this can be closed now with 0.1.1

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

No branches or pull requests

2 participants