Giter Site home page Giter Site logo

karma-webpack's Introduction

npm node coverage

Karma Webpack

Use webpack to preprocess files in karma

Install

npm npm i -D karma-webpack

yarn yarn add -D karma-webpack

Usage

karma.conf.js

module.exports = (config) => {
  config.set({
    // ... normal karma configuration

    // make sure to include webpack as a framework
    frameworks: ['mocha', 'webpack'],
    
    plugins: [
      'karma-webpack',
      'karma-mocha',
    ],

    files: [
      // all files ending in ".test.js"
      // !!! use watched: false as we use webpacks watch
      { pattern: 'test/**/*.test.js', watched: false }
    ],

    preprocessors: {
      // add webpack as preprocessor
      'test/**/*.test.js': [ 'webpack' ]
    },

    webpack: {
      // karma watches the test entry points
      // Do NOT specify the entry option
      // webpack watches dependencies

      // webpack configuration
    },
  });
}

Default webpack configuration

This configuration will be merged with what gets provided via karma's config.webpack.

const defaultWebpackOptions = {
  mode: 'development',
  output: {
    filename: '[name].js',
    path: path.join(os.tmpdir(), '_karma_webpack_') + Math.floor(Math.random() * 1000000),
  },
  stats: {
    modules: false,
    colors: true,
  },
  watch: false,
  optimization: {
    runtimeChunk: 'single',
    splitChunks: {
      chunks: 'all',
      minSize: 0,
      cacheGroups: {
        commons: {
          name: 'commons',
          chunks: 'initial',
          minChunks: 1,
        },
      },
    },
  },
  plugins: [],
};

How it works

This project is a framework and preprocessor for Karma that combines test files and dependencies into 2 shared bundles and 1 chunk per test file. It relies on webpack to generate the bundles/chunks and to keep it updated during autoWatch=true.

The first preproccessor triggers the build of all the bundles/chunks and all following files just return the output of this one build process.

Webpack typescript support

By default karma-webpack forces *.js files so if you test *.ts files and use webpack to build typescript to javascript it works out of the box.

If you have a different need you can override by settig webpack.transformPath

// this is the by default applied transformPath
webpack: {
  transformPath: (filepath) => {
      // force *.js files by default
      const info = path.parse(filepath);
      return `${path.join(info.dir, info.name)}.js`;
    },
},

Source Maps

You can use the karma-sourcemap-loader to get the source maps generated for your test bundle.

npm i -D karma-sourcemap-loader

And then add it to your preprocessors.

karma.conf.js

preprocessors: {
  'test/test_index.js': [ 'webpack', 'sourcemap' ]
}

And tell webpack to generate sourcemaps.

webpack.config.js

webpack: {
  // ...
  devtool: 'inline-source-map'
}

Current Maintainers


Cody Mikol

Previous Maintainers

Previous maintainers of the karma-webpack plugin that have done such amazing work to get it to where it is today.


Ryan Clark

April Arcus

Mika Kalathil
Joshua Wiens Will Farley Daniela Valero
Jonathan Trang Carlos Morales

karma-webpack's People

Contributors

abraham avatar alexander-akait avatar codymikol avatar dakmor avatar dependabot[bot] avatar dignifiedquire avatar evilebottnawi avatar goldhand avatar gyandeeps avatar ibash avatar jambonrose avatar joshwiens avatar kidkarolis avatar kpdecker avatar lendar avatar limonte avatar matthieu-foucault avatar mattlewis92 avatar michael-ciniawsky avatar michaelanthonymain avatar mikaak avatar mkawalec avatar pat841 avatar rodmax avatar ryanclark avatar samwalshnz avatar simenb avatar sokra avatar teamop avatar vinteo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

karma-webpack's Issues

Throws when running multi-configs

ERROR [karma]: [TypeError: Cannot read property 'length' of undefined]
TypeError: Cannot read property 'length' of undefined
    at Plugin.<anonymous> (dev/public/karma-webpack/index.js:41:34)
    at Tapable.applyPlugins (dev/public/webpack/node_modules/tapable/lib/Tapable.js:26:37)
    at Tapable.<anonymous> (dev/public/webpack/lib/MultiCompiler.js:75:10)
    at Tapable.applyPlugins (dev/public/webpack/node_modules/tapable/lib/Tapable.js:26:37)
    at Watching._done (dev/public/webpack/lib/Compiler.js:77:17)
    at Watching.<anonymous> (dev/public/webpack/lib/Compiler.js:60:18)
    at Tapable.emitRecords (dev/public/webpack/lib/Compiler.js:279:37)
    at Watching.<anonymous> (dev/public/webpack/lib/Compiler.js:57:19)
    at dev/public/webpack/lib/Compiler.js:272:11
    at Tapable.applyPluginsAsync (dev/public/webpack/node_modules/tapable/lib/Tapable.js:60:69)

The stats object:

{ version: '1.4.13',
  hash: 'ef685547634cbd13feb0',
  errors: [],
  warnings: [],
  children:
   [ { errors: [],
       warnings: [],
       version: '1.4.13',
       hash: 'ef685547634cbd13feb0',
       time: 38,
       assetsByChunkName: [Object],
       assets: [Object],
       chunks: [Object],
       modules: [Object],
       filteredModules: 0,
       children: [],
       name: undefined } ] }

Question, what is this plugin for?

Hey there,

this may seem like I stupid question, but I am having a hard time getting Karma to work with my webpack based application. I am trying to require files in my tests, however all the aliases in my webpack config do not resolve. I can't seem to find a description of what this plugin does and I was hoping that this plugin resolves aliases, is this correct?

It may be worth noting that I am not using the webpack dev server as I required a custom solution and am using koa

Thanks in advance

Tests not always running

Can't get how to exactly reproduce it but it seems to be depending on when runner and compilation starts. If the runner is started and compilation not yet done, then the suit will not run.

--- karma-webpack/example ‹master* M› » karma start                                                                                           127 ↵
WARN [karma]: Port 9876 in use
INFO [karma]: Karma v0.12.1 server started at http://localhost:9877/
INFO [launcher]: Starting browser PhantomJS
Hash: f415b7798b75e5251339
Version: webpack 1.1.0
Time: 6ms
Asset  Size  Chunks       Chunk Names
webpack: bundle is now VALID.
webpack: bundle is now invalid.
2014-03-28 10:29 node[4862] (CarbonCore.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
2014-03-28 10:29 node[4862] (CarbonCore.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)
Hash: b79bf627a90c35d205b4
Version: webpack 1.1.0
Time: 32ms
                Asset  Size  Chunks             Chunk Names      
    _js/test/aTest.js  4547       0  [emitted]  test/aTest.js    
       _js/1.chunk.js   117       1  [emitted]                   
_js/test/bTest.coffee  4132       2  [emitted]  test/bTest.coffee
chunk    {0} _js/test/aTest.js (test/aTest.js) 679 [rendered]
    [0] ./test/aTest.js 628 {0} [built]
    [1] ./fixtures/file.js 18 {0} [built]
    [3] ./fixtures/file.coffee 33 {0} [built]
chunk    {1} _js/1.chunk.js 18 {0} {2}
    [2] ./fixtures/file.js?1 18 {1} [built]
chunk    {2} _js/test/bTest.coffee (test/bTest.coffee) 398 [rendered]
    [0] ./test/bTest.coffee 398 {2} [built]
webpack: bundle is now VALID.
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start PhantomJS again (1/2).

I always have this issue then building a bigger bundle.

cannot load 'webpack'

Errors:
Can not load "webpack"!
  TypeError: undefined is not a function
    at Plugin.notifyKarmaAboutChanges (/Users/jz/jsfiddles/template/node_modules/karma-webpack/index.js:108:15)
    at Plugin.<anonymous> (/Users/jz/jsfiddles/template/node_modules/karma-webpack/index.js:72:9)
    at Tapable.applyPlugins (/Users/jz/jsfiddles/template/node_modules/webpack/node_modules/tapable/lib/Tapable.js:26:37)
    at Watching._done (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:78:17)
    at Watching.<anonymous> (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:61:18)
    at Tapable.emitRecords (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:281:37)
    at Watching.<anonymous> (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:58:19)
    at /Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:274:11
    at Tapable.applyPluginsAsync (/Users/jz/jsfiddles/template/node_modules/webpack/node_modules/tapable/lib/Tapable.js:60:69)
    at Tapable.afterEmit (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:271:8)

here is my package.json file

{
  "name": "components",
  "version": "0.0.1",
  "description": "components",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {




  },
  "devDependencies": {
    "babel-core": "^5.8.9",
    "babel-loader": "^5.3.2",
    "css-loader": "^0.15.6",
    "jasmine-core": "^2.3.4",
    "karma": "^0.12.37",
    "karma-chrome-launcher": "^0.2.0",
    "karma-jasmine": "^0.3.6",
    "karma-sourcemap-loader": "^0.3.5",
    "karma-webpack": "^1.6.0",
    "less": "^2.5.1",
    "less-loader": "^2.2.0",
    "lodash": "^3.10.0",
    "style-loader": "^0.12.3",
    "webpack": "^1.10.5"
  }
}

I change karma version to ~0.12.37 and karma-webpack to ~1.6.0,it works;
But when karma-webpack is 1.7.0, it throw errors when I run karma start karma.config.js

Incorrect behavior in watch mode

On removing single (spec) file karma with webpack reports about lot of removed files that doesn't actually been removed. After that it compile all the specs again and again and can be stopped only with kill -9.

Here abstract_link_spec.jsx actually been removed:

PhantomJS 1.9.7 (Mac OS X): Executed 299 of 338 (skipped 39) SUCCESS (1.393 secs / 0.923 secs)
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/abstract_link_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/spec_helper.js".
INFO [karma]: Delaying execution, these browsers are not ready: PhantomJS 1.9.7 (Mac OS X)
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/factories/activities.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/factories/activities.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/factories/global_notifications.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/factories/global_notifications.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/factories/users.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/factories/users.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_gallery_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_gallery_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_group_offline_actions_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_group_offline_actions_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_group_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_group_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_groups_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_groups_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_preview_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activities_preview_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_header_properties_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_header_properties_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_header_property_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_header_property_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_header_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_header_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_preview_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/activity_preview_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/app_layout_overlay_page_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/app_layout_overlay_page_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/app_layout_overlay_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/app_layout_overlay_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/app_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/app_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/auth_form_user_notification_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/auth_form_user_notification_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/avatar_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/avatar_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/button_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/button_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/calendar_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/calendar_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/card_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/card_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_actions_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_actions_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_alt_action_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_alt_action_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_loading_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_loading_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_title_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_page_title_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/form_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/global_notification_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/global_notification_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/global_notifications_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/global_notifications_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/input_icon_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/input_icon_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/input_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/input_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/input_special_action_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/input_special_action_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/invitation_page_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/invitation_page_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/landing_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/landing_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/link_inner_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/link_inner_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/link_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/link_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/loading_screen_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/loading_screen_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/logotype_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/logotype_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/mixins/link_element_mixin_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/mixins/link_element_mixin_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/new_project_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/new_project_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/overlay_page_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/overlay_page_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/overlay_page_loading_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/overlay_page_loading_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/page_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/page_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/page_layout_wrapper_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/page_layout_wrapper_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/password_input_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/password_input_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/pending_project_invitation_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/pending_project_invitation_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/profile_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/profile_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/profile_worker_info_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/profile_worker_info_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/progress_line_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/progress_line_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_invitation_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_invitation_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_worker_header_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_worker_header_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_worker_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_worker_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_workers_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/project_workers_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/projects_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/projects_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/quick_stats_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/quick_stats_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/settings_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/settings_layout_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/side_navigation_link_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/side_navigation_link_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/side_navigation_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/side_navigation_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/sign_in_form_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/sign_in_form_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/sign_out_link_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/sign_out_link_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/sign_up_form_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/sign_up_form_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tab_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tab_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tabs_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tabs_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tape_calendar_date_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tape_calendar_date_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tape_calendar_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/tape_calendar_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/textarea_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/textarea_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/timeline_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/timeline_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/top_filter_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/top_filter_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/user_activities_preview_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/components/user_activities_preview_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/mixin_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/mixin_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/request_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/request_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/rrouter_context_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/rrouter_context_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/rrouter_webpack_chunk_context_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/rrouter_webpack_chunk_context_spec.jsx".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/schema_state_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/schema_state_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/schema_validator_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/schema_validator_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/utils_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/lib/utils_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/schemas/sign_up_schema_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/schemas/sign_up_schema_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/schemas/validators/email_validator_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/schemas/validators/email_validator_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/schemas/validators/emails_validator_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/schemas/validators/emails_validator_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/actions_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/actions_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/auth_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/auth_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/global_notifications_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/global_notifications_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/mixins/requests_mixin_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/mixins/requests_mixin_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/projects_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/projects_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/system_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/system_store_spec.js".
INFO [watcher]: Removed file "/Users/koss/src/project-front/spec/stores/user_store_spec.js".
I

Karma 0.13.0 - "Can not resolve circular dependency!"

After upgrading to Karma 0.13.0, I'm hitting the following issue:

16 07 2015 08:23:32.494:WARN [preprocess]: Can not load "webpack"!
  Error: Can not resolve circular dependency! (Resolving: preprocessor:webpack -> webpackPlugin -> preprocessor:webpack)
    at error (project/node_modules/karma/node_modules/di/lib/injector.js:22:68)
    at get (project/node_modules/karma/node_modules/di/lib/injector.js:44:15)
    at instantiatePreprocessor (project/node_modules/karma/lib/preprocessor.js:56:37)
    at Array.forEach (native)
    at null.<anonymous> (project/node_modules/karma/lib/preprocessor.js:77:31)
    at tryCatcher (project/node_modules/karma/node_modules/bluebird/js/main/util.js:26:23)
    at ret [as _preprocess] (eval at <anonymous> (project/node_modules/karma/node_modules/bluebird/js/main/promisify.js:163:12), <anonymous>:13:39)
    at project/node_modules/karma/lib/file-list.js:182:19
    at Array.map (native)
    atproject/node_modules/karma/lib/file-list.js:167:30
    at Array.map (native)
    at List._refresh (/project/node_modules/karma/lib/file-list.js:150:37)
    at List.refresh (/project/node_modules/karma/lib/file-list.js:249:27)
    at Plugin.notifyKarmaAboutChanges (/project/karma-webpack/index.js:109:16)
    at Plugin.<anonymous> (/project/node_modules/karma-webpack/index.js:73:9)
    at Tapable.applyPlugins (/project/node_modules/webpack/node_modules/tapable/lib/Tapable.js:26:37)

I'll keep investigating on my own, but I thought I'd report it in any case.

code coverage

Hello. Please help me to create code coverage report for my tests.
I'm trying to do this this way:

...
files: [
      'tests.webpack.js'
    ],

    preprocessors: {
      'scripts/**/*.js': ['webpack', 'sourcemap', 'coverage'],
      'tests.webpack.js': ['webpack', 'sourcemap', 'coverage']
    },

    reporters: ['progress', 'sourcemap', 'coverage'],

    webpack: {
      devtool: 'inline-source-map',
...    

but in /coverage folder i just see coverage of my tests.webpack.js file without sourcemaps!

So, what did I do wrong?

Producing a single test bundle

If I add preprocessors: {'**/*_test.js': ['webpack']} and I have 100s of tests, that produces 100s of large bundles - that's slow, reruns tests all the time since karma keeps detecting changes and rerunning all ests as each test bundle is produced by webpack and this sends many megabytes to the test browser to evaluate.

Instead, if I add preprocessors: {"test_index.js": ['webpack']} and require all my tests in that file (e.g. here then webpack produces 1 test bundle. However, now I have to manually maintain the full list of all my tests which doesn't scale.

I don't know enough about karma plugins or webpack yet, but do you reckon there's a way to configure webpack/karma/karma-webpack to produce ony 1 test bundle from a pattern such as **/*_test.js?

Perhaps something like dynamically, via the karma-webapck plugin, adding configuration about which modules to force include even if they're not required (is there such option?)

Build not getting cancelled when webpack fails to compile the file

I am not really sure if this is an error with our configuration, karma, karma-webpack or webpack 😄

We are compiling cjsx (coffee and jsx) files using webpack and then run our tests using jasmine. Everything is working fine as long as you do not have a syntax error in your coffee file. At that point the tests just run using an outdated version of our code, which often means they just stay green :).
With webpack being quieted this does not result in any output and even if you output the error it can easily be overlooked because of the test run afterwards (which scrolls the error out of my terminal).

I would expect the tests to not be run and an error output to the displayed in karma.

Is this an issue that should be fixed here in the plugin or should this work out of the box and I am just too stupid to configure karma-webpack.

I already tried implementing this using failed callback of webpack. Is this the way to go here? I will try some more after work.

Using CommonsChunkPlugin

Is there a way to use CommonsChunkPlugin with karma-webpack to exclude vendor libs from test bundles?

Possible to use relative imports in typescript tests?

Hey,
I don't know if this is typescript only or not.

I have the following layout in my app (removed the irrelevant files/folders):

├── app
│   ├── app.ts
│   ├── components
│   │   └── editor.ts
│   └──  utils
│        └── text.ts
├── tests
│   ├── app
│   │   └── utils
│   │       └── text_tests.ts
│   └── index.js

and the following karma.conf.js:

var path = require('path');

module.exports = function (config) {

    config.set({
        singleRun: true,
        frameworks: ['mocha', 'chai'],
        reporters: ['dots'],
        browsers: ['PhantomJS'],
        files: [
            'src/tests/index.js'
        ],
        preprocessors: {
            'src/tests/index.js': ['webpack']
        },
        webpack: {
            resolve: {
                alias: {
                    'utils': path.join(__dirname, 'src/app/utils')
                }
            },
            noInfo: true,
            module: {
                loaders: [
                    {
                        test: /\.ts$/,
                        loaders: ['awesome-typescript-loader']
                    }
                ]
            }
        },
        webpackMiddleware: {
            noInfo: true,
            stats: {
                color: true,
                chunkModules: false,
                modules: false
            }
        }
    });
};

And my test file looks like:

/// <reference path='../../../typings/tests.d.ts' />

import chai = require('chai');
var expect = chai.expect;

import { fromHTML, toHTML } from "../../../app/utils/text";


describe("Text utils tests:", () => {
    let text = "The quick brown fox jumps over the lazy dog";

    describe("toHTML", () => {
        it("should work a string with no markup", (done) => {
            expect(toHTML(text, [])).to.equals(text);
            done();
        });
    });
});

When running the tests, I get the following error:
Module not found: Error: Cannot resolve 'file' or 'directory' ../../../app/utils/text in /home/vincent/Code/project1/src/tests/app/utils
As you can see from the karma.config.js, I tried using aliases but then typescript complains about undefined external module when importing from "utils/text", which is fair enough

What am I missing? Webpack noob here

Tests don't run - 'bundle is now invalid' message

I've got a skeleton project with dummy tests in 14 files. It all builds in under four seconds. When I run my tests, PhantomJS times out (I've tried a timeout of up to a minute). I get the following output:

DEBUG [config]: autoWatch set to false, because of singleRun
DEBUG [plugin]: Loading karma-* from /usr/lib/node_modules
DEBUG [plugin]: Loading plugin /usr/lib/node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin /usr/lib/node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin /usr/lib/node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin /usr/lib/node_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin /usr/lib/node_modules/karma-script-launcher.
DEBUG [plugin]: Loading plugin /usr/lib/node_modules/karma-webpack-plugin.
INFO [karma]: Karma v0.12.16 server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-71473708
DEBUG [launcher]: /usr/lib/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-71473708/capture.js
Hash: 7b59d5bd58888f0c4037
Version: webpack 1.3.0-beta5
Time: 9ms
Asset  Size  Chunks       Chunk Names
webpack: bundle is now VALID.
webpack: bundle is now invalid.
DEBUG [web-server]: serving: /usr/lib/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /usr/lib/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/tltJALVffCGd34LjTcxd
DEBUG [karma]: A browser has connected on socket tltJALVffCGd34LjTcxd
INFO [PhantomJS 1.9.7 (Linux)]: Connected on socket tltJALVffCGd34LjTcxd with id 71473708
DEBUG [launcher]: PhantomJS (id 71473708) captured in 0.631 secs
WARN [PhantomJS 1.9.7 (Linux)]: Disconnected (1 times), because no message in 60000 ms.
DEBUG [karma]: Run complete, exitting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Process PhantomJS exited with code 0
DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-71473708

I've seen that issue #8 is similar and was solved by increasing the timeout, but it doesn't work for me.

Profiling

Any tips on how to get the profiling info out of the karma-webpack run?
Or otherwise inspect performance issues, the tests used to take 59 seconds to run with AMD, but 1 min 44 sec with webpack. It's ok for CI, but very unpleasant locally. Not sure how to speed it up.

Outside of testing, webpack takes 30seconds to build this project.

Slow rebuilds

I'm finding re-builds are taking much longer than I'd like. Right now it takes around 6-7s between me saving a file and the tests actually running. This is compared to ~500ms when WebPack is watching files. We saw some speed up with the suggested alternative usage but there's still an annoying delay.

Any thoughts on how to improve this? Or is this fundamental to Karma?

Can not load "webpack"

1.7.0 karma-webpack started breaking karma tests, 1.6.0 works as expected.
running on:

node v0.10.33
npm v2.12.0
karma v0.12.37
webpack v1.10.5

WARN [preprocess]: Can not load "webpack"!
  TypeError: Object [object Object] has no method 'refreshFiles'
    at Plugin.notifyKarmaAboutChanges (node_modules/karma-webpack/index.js:108:15)
    at Plugin.<anonymous> (node_modules/karma-webpack/index.js:72:9)
    at Tapable.applyPlugins (node_modules/webpack/node_modules/tapable/lib/Tapable.js:26:37)
    at Watching._done (node_modules/webpack/lib/Compiler.js:78:17)
    at Watching.<anonymous> (node_modules/webpack/lib/Compiler.js:61:18)
    at Tapable.emitRecords (node_modules/webpack/lib/Compiler.js:281:37)
    at Watching.<anonymous> (node_modules/webpack/lib/Compiler.js:58:19)
    at /home/ubuntu/gropius/resources/front-ends/application/node_modules/webpack/lib/Compiler.js:274:11
    at Tapable.applyPluginsAsync (node_modules/webpack/node_modules/tapable/lib/Tapable.js:60:69)
    at Tapable.afterEmit (node_modules/webpack/lib/Compiler.js:271:8)

webpack silent mode

Hi.

With this in config:

webpackServer: {
    progress: false,
    stats: false,
    debug: false
},

I'm still getting these messages:

webpack: bundle is now VALID.
webpack: bundle is now INVALID.
webpack: bundle is now VALID.
LOG: 'ok'

Is there an implemented way to completely turn it off?

Polling option not picked up by watchpack

Hi, I am reposting this here even though I'm not convinced it's actually a problem with karma-webpack. This is a direct copy+paste from the issue I posted in the webpack issue tracker...


Using webpack v1.9.11, I am trying to enable poll-based watching, in my karma configuration I have

    webpack: {
        watchOptions: {
          poll: true
        },
        devtool: 'inline-source-map',
        resolve: webpackConfig.resolve,
        module: {
          loaders: [buildConfig.loaders.babel]
        }
    }

It seems as if the watchOptions options are not being propagated to watchpack. My other options work. I can add a single line to node_modules/webpack/node_modules/watchpack/lib/DirectoryWatcher.js:

     options.poll = true;

in the DirectoryWatcher function and then polling works.

Any ideas?

Error: No template for dependency: TemplateArgumentDependency

I am currently using webpack version 1.5.0 and karma-webpack version 1.5.3 on a project. After release of webpack version 1.6.0, I am getting the error below when running tests.

It looks like having webpack ^1.4.0 as a peerDependencies causes npm to download the latest webpack under karma-webpack's node_modules even though webpack 1.5.3 satisfies peerDependencies requirement. Any thoughts on how to avoid these issues going further?

Error: No template for dependency: TemplateArgumentDependency
  at doDep (project/node_modules/karma-webpack/node_modules/webpack/lib/NormalModule.js:115:23)
  at Array.forEach (native)
  at doBlock (project/node_modules/karma-webpack/node_modules/webpack/lib/NormalModule.js:124:22)
  at DependenciesBlock.NormalModule.source (project/node_modules/karma-webpack/node_modules/webpack/lib/NormalModule.js:156:2)
  at Tapable.ModuleTemplate.render (project/node_modules/karma-webpack/node_modules/webpack/lib/ModuleTemplate.js:14:28)
  at Tapable.Template.renderChunkModules (project/node_modules/karma-webpack/node_modules/webpack/lib/Template.js:80:31)
  at Tapable.<anonymous> (project/node_modules/karma-webpack/node_modules/webpack/lib/MainTemplate.js:28:22)
  at Tapable.applyPlugins [as applyPluginsWaterfall] (project/node_modules/karma-webpack/node_modules/webpack/node_modules/tapable/lib/Tapable.js:37:47)
  at Tapable.MainTemplate.render (project/node_modules/karma-webpack/node_modules/webpack/lib/MainTemplate.js:112:20)
  at Tapable.createChunkAssets (project/node_modules/karma-webpack/node_modules/webpack/lib/Compilation.js:783:32)

Error when adding new file with watcher

I have karma running with watcher enabled.

It throws an error when I create new file (Product-view.jsx is new file itself)

webpack: bundle is now INVALID.
ERROR [karma]: [Error: Path doesn't exist '/_karma_webpack_/specs/components/Product-view.jsx']
Error: Path doesn't exist '/_karma_webpack_/specs/components/Product-view.jsx'
    at MemoryFileSystem.readFileSync (/srv/node_modules/karma-webpack/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:82:10)
    at MemoryFileSystem.readFile (/srv/node_modules/karma-webpack/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:201:21)
    at doRead (/srv/node_modules/karma-webpack/index.js:157:26)
    at Plugin.readFile (/srv/node_modules/karma-webpack/index.js:161:3)
    at /srv/node_modules/karma-webpack/index.js:177:17
    at nextPreprocessor (/srv/node_modules/karma/lib/preprocessor.js:59:28)
    at /srv/node_modules/karma/lib/preprocessor.js:97:7
    at fs.js:336:14
    at /srv/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/readdirp/node_modules/graceful-fs/graceful-fs.js:104:5
    at /srv/node_modules/karma/node_modules/graceful-fs/graceful-fs.js:104:5

Attaching my karma.conf.js also:

'use strict';

var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

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: ['mocha', 'sinon-chai'],

    // list of files / patterns to load in the browser
    files: [
      'specs/**/*.jsx'
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'specs/**/*.jsx': ["webpack"]
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    reporters: ['progress', 'coverage'],

    coverageReporter: {
        type : 'html',
        dir : 'coverage/'
    },

    // web server port
    port: 9876,

    // Timeout for capturing a browser (in ms).
    captureTimeout: 60 * 1e3,

    // to avoid DISCONNECTED messages
    browserDisconnectTimeout : 10000, // default 2000
    browserDisconnectTolerance : 1, // default 0
    browserNoActivityTimeout : 60 * 1e3, //default 10000

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

    // 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'],

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

    // Include timeout because of rsync
    autoWatchBatchDelay: 2 * 1e3,

    // webpack options
    webpack: {
      cache: true,
      devtool: 'inline-source-map',
      watchDelay: 3 * 1e3,
      resolve: {
        extensions: ['', ".webpack.js", '.js', '.jsx'],
        modulesDirectories: ["node_modules", "bower_components"],
        alias: {
          'flux': path.join(__dirname, 'src/scripts/flux'),
          'src': path.join(__dirname, 'src/'),
          'routes': path.join(__dirname, 'src/scripts/routes'),
          'components': path.join(__dirname, 'src/scripts/components'),
          'scripts': path.join(__dirname, 'src/scripts'),
          'styles': path.join(__dirname, 'src/styles'),
          "kendo": "kendo-ui-webpack"
        }
      },
      module: {
        preLoaders: [
            {test: /(\.jsx)|(\.js)$/, exclude: /(node_modules|bower_components|specs)/, loader: 'isparta-instrumenter'},
        ],
        loaders: [
          {test: /(react)|(react\/addons)$/, loader: 'expose?React!imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham'},
          {test: /\/jquery.js$/, loader: 'expose?jQuery'},
          {test: /react-tabs.*\.js$/, loader: '6to5-loader?experimental&runtime'},
          {test: /(\.jsx)|(\.js)$/, exclude: /node_modules/, loader: '6to5-loader?experimental&runtime'},
          {test: /\.css$/, loader:  'null'},
          {test: /\.(png|jpg|gif)$/, loader: 'null'},
          {test: /icon-.+\.(svg)$/, loader: 'null'},
          {test: /\.styl$/, loader: 'null'},
          {test: /\.woff.?$/, loader: "null" },
          {test: /fonts\/.*\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "null"},
          {test: /\.json$/, loader: "json-loader"},
          {test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery'},
          {test: /kendo\-ui\-core[\///].*\.js$/, loader: "imports?jQuery=jquery"},
        ]
      },
      plugins: [
        new webpack.PrefetchPlugin('react'),
        new webpack.PrefetchPlugin('jquery'),
        new webpack.PrefetchPlugin('lodash'),
        new webpack.PrefetchPlugin('fluxxor'),
        new webpack.PrefetchPlugin('react-router'),
        new webpack.ProvidePlugin({
          to5Runtime: "imports?global=>{}!exports?global.to5Runtime!6to5/runtime",
          React: 'react/addons',
          _: 'lodash',
          Router: 'react-router',
          Fluxxor: 'Fluxxor',
        }),
        new webpack.DefinePlugin({'global.BACKEND_HOST': '"http://localhost:8080/"'}),
        new webpack.DefinePlugin({'global.RESOURCE_PATH_PREFIX': '"http//localhost:8000"'}),
        new webpack.DefinePlugin({'process.env.NODE_ENV': '"development"', 'global.SIDE': '"frontend"'}),
        new webpack.ResolverPlugin(
          new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
        )
      ]
    },

    webpackMiddleware: {
      stats: {
        // With console colors
        colors: true,
        // add the hash of the compilation
        hash: false,
        // add webpack version information
        version: false,
        // add timing information
        timings: true,
        // add assets information
        assets: false,
        // add chunk information
        chunks: false,
        // add built modules information to chunk information
        chunkModules: false,
        // add built modules information
        modules: false,
        // add also information about cached (not built) modules
        cached: false,
        // add information about the reasons why modules are included
        reasons: false,
        // add the source code of modules
        source: true,
        // add details to errors (like resolving log)
        errorDetails: true,
        // add the origins of chunks and chunk merging info
        chunkOrigins: true,
        // Add messages from child loaders
        children: false
      }
    },

  });
};

Problems with regular expressions in karma.webpack configuration

I have a problem with karma-webpack configuration. It occurs when I use regular expressions in webpack.module.loaders[].test field.

Error message

[13:53:20] Starting Karma server...
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
ERROR [karma]: [Error: [object Object] is not a valid test]
Error: [object Object] is not a valid test
    at asMatcher (C:\Users\xxx\Development\yyy\node_modules\webpack\node_modules\webpack-core\lib\LoadersList.js:48:9)
    at LoadersList.matchPart (C:\Users\xxx\Development\yyy\node_modules\webpack\node_modules\webpack-core\lib\LoadersList.js:65:16)
    at LoadersList.matchObject (C:\Users\xxx\Development\yyy\node_modules\webpack\node_modules\webpack-core\lib\LoadersList.js:90:12)
    at LoadersList.<anonymous> (C:\Users\xxx\Development\yyy\node_modules\webpack\node_modules\webpack-core\lib\LoadersList.js:77:12)
    at Array.map (native)
    at LoadersList.match (C:\Users\xxx\Development\yyy\node_modules\webpack\node_modules\webpack-core\lib\LoadersList.js:70:19)
    at Tapable.<anonymous> (C:\Users\xxx\Development\yyy\node_modules\webpack\lib\NormalModuleFactory.js:81:64)
    at C:\Users\xxx\Development\yyy\node_modules\async\lib\async.js:254:17
    at done (C:\Users\xxx\Development\yyy\node_modules\async\lib\async.js:135:19)
    at C:\Users\xxx\Development\yyy\node_modules\async\lib\async.js:32:16

Additional log
When I do consoloe.log('>>>', test) in line webpack-core\lib\LoadersList.js:48 output shows: >>> {}.

Karma configuration

{
  /* ... some non important settings */

  /* ... webpack settings */
  webpack: {
    module: {
      loaders: [
        /* problematic regexes in test fields */
        { test: /\.html$/, loader: 'swig-loader?varControls[]={:&varControls[]=:}' },
        { test: /\.json$/, loader: 'json-loader' }
      ]
    }
  }
}

I am using:

  • karma-webpack v1.5.0
  • webpack v1.7.2
  • karma v0.12.31
  • gulp-karma v0.0.4

Question: Can I use *.coffee with `webpack` preprocessor?

I'm using CoffeeScript in my project for src and specs. How do I configure webpack preprocessor in karma to use *.coffee?

I've tried

preprocessors : [
    'spec/**/*_spec.coffee' : ['webpack']
]

but didn't manage to get any results.

ReferenceError: Can't find variable: webpackJsonp

keep on getting this error, where is webpackJsonp defined?

and i've tried with a clean test file with just this one line

describe('unit test', function(){})

and it still complains ReferenceError: Can't find variable: webpackJsonp at line 12

Im using phantomjs

Can't find framework:webpack

I've tried a bunch of different tweaks to my karma config file and nothing seems to work.
Here's the error: Error: No provider for "framework:webpack"! (Resolving: framework:webpack)

Any help is appreciated!

module.exports = function(config) {
  config.set({
    basePath: __dirname,
    plugins: [
      require("karma-webpack")
    ],
    frameworks: ['jasmine', 'sinon'],

    files: [
      'dist/styles/main.css',
      'test/**/*.js'
    ],

    preprocessors: {
      'test/**/*.js': ['webpack'],
    },

    webpack: require('./webpack.config.js'),

    reporters: ['spec'],

    port: 9876,

    colors: true,

    logLevel: config.LOG_INFO,

    autoWatch: false,

    browsers: ['Chrome'],

    browserNoActivityTimeout: 60000,

    singleRun: true
  });
};

Using ES5 getter syntax for output.filename make test fail with weird output

DEBUG [plugin]: Loading plugin karma-spec-reporter.
DEBUG [plugin]: Loading plugin karma-mocha.
DEBUG [plugin]: Loading plugin karma-chrome-launcher.
DEBUG [plugin]: Loading plugin karma-webpack.
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-16389635
DEBUG [launcher]: google-chrome --user-data-dir=/tmp/karma-16389635 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876
/?id=16389635
DEBUG [web-server]: serving: /home/jaylee/dodo/dodo/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /home/jaylee/dodo/dodo/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/Q06cJkWUBhAqkFhw9iaA
DEBUG [karma]: A browser has connected on socket Q06cJkWUBhAqkFhw9iaA
INFO [Chrome 39.0.2171 (Linux)]: Connected on socket Q06cJkWUBhAqkFhw9iaA with id 16389635
DEBUG [launcher]: Chrome (id 16389635) captured in 5.678 secs
DEBUG [karma]: All browsers are ready, executing
ERROR [karma]: [Error: Path doesn't exist '/_karma_webpack_/spec/api-base.spec.js']
Error: Path doesn't exist '/_karma_webpack_/spec/api-base.spec.js'
  at MemoryFileSystem.readFileSync (/home/jaylee/dodo/dodo/node_modules/karma-webpack/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:75:10)
  at MemoryFileSystem.readFile (/home/jaylee/dodo/dodo/node_modules/karma-webpack/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:201:21)
  at doRead (/home/jaylee/dodo/dodo/node_modules/karma-webpack/index.js:157:26)
  at Plugin.readFile (/home/jaylee/dodo/dodo/node_modules/karma-webpack/index.js:161:3)
  at process._tickCallback (node.js:419:13)

DEBUG [launcher]: Disconnecting all browsers
Hash: e18a7201bbbb0855359a
Version: webpack 1.4.14

webpack.config.js was like this:

module.exports = {
    devtool: 'eval',
    contentBase: STATIC_PATH,
    entry: [
        STATIC_PATH
    ],
    output: {
        path: STATIC_BUILT_PATH,
        get filename () {
            if (Prod)
                return 'bundle-' + (process.env.DEPLOY_ID || Math.floor(Math.random() * 1000000)) + '.js';
            else
                return 'bundle.js';
        },
    },

};

after changing getter syntax to string, there is no problem.

ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory'

When using 1.4.0 I get the error above, <1.4.0 works great. complaint is ./spec/index.js, I assume files is the culprit, not preprocessors:

files: [
    './spec/index.js'
],

or

preprocessors: {
    './spec/index.js': ['webpack']
},

Coincidentally, I see the new webpack-karma reporter is spec, however I can't imagine that causing a clash.

gulp task never exits on CI

This seems like issue 18 but since that has been closed it may be environment specific or regression.

karma.conf.js:

'use strict';

module.exports = function(config) {

  var configuration = {

    autoWatch: false,
    singleRun: true,

    frameworks: ['jasmine'],

    browsers : ['PhantomJS'],

    plugins : [
      'karma-phantomjs-launcher',
      'karma-jasmine',
      'karma-webpack'
    ],

    preprocessors: {
      'test-harness.js': [ 'webpack']
    },

    files: [
      'test-harness.js'
    ],

    webpack: {
      module: {
        //loaders: [          
        //  { test: /\.ts$/, loader: "awesome-typescript-loader" }
        //]
      },
      resolve: {
        modulesDirectories: ["node_modules", "bower_components"],
        extensions: ['', '.webpack.js', '.web.js', '.ts', '.js']
      },
      watch: false
    },

    browserNoActivityTimeout: 100000,

  };

  config.set(configuration);
};

gulp task:

gulp.task('test', function(done) {
    karma.server.start({
      configFile: __dirname + '/../../karma.conf.js'//,
    }, function(exitCode) {
      console.log('Karma has exited with ' + exitCode);
      done(exitCode);
    });
  });

Note: I've commented out the loader fully expecting to get errors but I wanted to prove the loader wasn't holding onto the process. In this scenario I get errors reported from phantomJS but the task completes so I'd expect gulp to exit - however, it never returns me to the command prompt.

Karma has exited with 1
[08:40:23] 'test' errored after 1.3 min

If I uncomment the loader the tests complete succesfully and I get this:

Karma has exited with 0
[08:53:16] Finished 'test' after 1.35 min

How to run tests with sinon?

Hi,
I am trying to run a test package and noticing that webpack still seems to bundle things in node_modules even though I am using the following karma/webpack config: https://gist.github.com/fb66622fa8284c76e6d9

An example test file:

'use strict';

var React = require('react/addons');
//var sinon = require('sinon');

React gets bundled, without issue even though I'd think that excludes would ignore it.
The issue is when I uncomment the sinon test, I get several critical issues:

WARNING in ./~/sinon/lib/sinon.js
Critical dependencies:
39:25-32 require function is used in a way, in which dependencies cannot be statically extracted
 @ ./~/sinon/lib/sinon.js 39:25-32

WARNING in ./~/sinon/lib/sinon/behavior.js
Critical dependencies:
353:25-32 require function is used in a way, in which dependencies cannot be statically extracted
 @ ./~/sinon/lib/sinon/behavior.js 353:25-32

Am I just doing things wrong by expecting mocha tests to run like they would on the server?

Source maps with karma's coffee-loader

I'm trying to use karma(/mocha/chai/phantomjs+chrome) and webpack's coffee-loader together, and my stack traces on test failures don't appear to be taking advantage of source maps. I can see coffee-loader returning the generated source map info, and there's a sourceMapUrl appended to the output file, but my test output looks like:

FAILED TESTS:
  Media
    when rendered with no image
      ✗ should be an img
        PhantomJS 1.9.7 (Mac OS X)
      AssertionError: expected 1 to equal 0
          at /Users/ggoodale/Projects/snip/client-root/test/spec/react_components/Media_spec.coffee:11122
          at assertEqual (/Users/ggoodale/Projects/snip/client-root/test/spec/react_components/Media_spec.coffee:18517)
          at /Users/ggoodale/Projects/snip/client-root/test/spec/react_components/Media_spec.coffee:29137
          at /Users/ggoodale/Projects/snip/client-root/test/spec/react_components/Media_spec.coffee:83
          at callFn (/Users/ggoodale/Projects/snip/client-root/node_modules/mocha/mocha.js:4338)
          at /Users/ggoodale/Projects/snip/client-root/node_modules/mocha/mocha.js:4331
          at /Users/ggoodale/Projects/snip/client-root/node_modules/mocha/mocha.js:4728
          at /Users/ggoodale/Projects/snip/client-root/node_modules/mocha/mocha.js:4819
          at next (/Users/ggoodale/Projects/snip/client-root/node_modules/mocha/mocha.js:4653)
          at /Users/ggoodale/Projects/snip/client-root/node_modules/mocha/mocha.js:4663

(note that the error claims to have occurred on line 11222 of Media.coffee, which is 43 lines long.)

The relevant part of my karma.conf.js:

    webpack: {
      cache: true,
      debug: true,
      devtool: '@inline-source-map',
      module: {
        preLoaders: [],
        loaders: [{
          test: /\.coffee$/,
          exclude: 'node_modules',
          loader: 'coffee-loader'
        }, {
          test: /\.css$/,
          loader: 'style!css'
        }, {
          test: /\.gif/,
          loader: 'url-loader?limit=10000&mimetype=image/gif'
        }, {
          test: /\.jpg/,
          loader: 'url-loader?limit=10000&mimetype=image/jpg'
        }, {
          test: /\.png/,
          loader: 'url-loader?limit=10000&mimetype=image/png'
        }]
      },
      resolve: {
        extensions: ["", ".web.coffee", ".web.js", ".js.coffee", ".coffee", ".js"],
        modulesDirectories: ["web_modules", "node_modules", "src/js/react_components", "test/spec"]
      }
    },

Support single run for CI

Currently this preprocessor works on watch mode only.
For running it in CI, it doesn't exits from karma as it should, and keeps watching forever.

For the record I have this task in gulp:

gulp.task('karma', function (done) {
  karma.start({
    configFile: __dirname + karmaConfig,
    singleRun: true
  }, done)
})

Webpack-dev-middleware semver broken AMD loading

The 1.2.0 release of webpack-dev-middleware has broken karma-webpack 1.5.1 and earlier when using AMD loading:

ReferenceError: Can't find variable: define

Since karma-webpack is using minor dependency upgrades rather than patch, it automatically upgrades to 1.2.0.

The simplest solution was to force downgrade webpack-dev-middleware to 1.0.11 in our root package.json (see https://github.com/rockabox/rbx_ui_components/pull/259), but perhaps karma-webpack should be using patch bumps rather than minor bumps (^1.0.11 -> ~1.0.11) or similar.

It could also be an issue in webpack-dev-middleware.

bail option does not exit the process

If I use the bail option I get this error

Hash: 8344a6c0a9b3c44a5636
Version: webpack 1.10.3
Time: 27501ms

ERROR in ./lib/forgot-password/client/view.coffee
Module not found: Error: Cannot resolve module 'component-eemitter' in /home/vagrant/lib/forgot-password/client
 @ ./lib/forgot-password/client/view.coffee 7:10-39
Hash: 8344a6c0a9b3c44a5636
Version: webpack 1.10.3
Time: 477ms

ERROR in ./lib/forgot-password/client/view.coffee
Module not found: Error: Cannot resolve module 'component-eemitter' in /home/vagrant/lib/forgot-password/client
 @ ./lib/forgot-password/client/view.coffee 7:10-39

and then nothing happens, but the process is still alive. After 5 minutes I stopped it.

If I run webpack only with --bail it works fine.

maybe related to #49

Faster spec bundle preprocessing?

It takes a painful 60 seconds to compile my project's 45 spec files. Are there recommended ways of speeding this up? Not doing anything fancy, just using the boilerplate config from the README (including cache: true).

Running tests alongside actual webpack build screws up output.

I am using Gulp with webpack-stream, and running the actual build of my app at the same time as my tests.

Doing so caused my bundled output file main.js to be named main without the .js extension.

I got around this by nulling the output property in my config for the tests.

var webpackConfig = Object.assign({}, require('./build/webpack-config'), {
  stats: false,
  output: null // Fixes a Webpack issue where running the tests alongside the actual build would screw up the output.
});

Not sure how this happened. If you need any other info from me let me know.

karma-webpack 1.7.0 causes error Can not load "webpack"! TypeError: undefined is not a function

Here is my Karma config

var Path = require('path');
var _ = require('underscore');
var args = BUILD_ARGS;

var filePatterns = [
  Path.join(process.cwd(), 'node_modules/angular/angular.js'),
  Path.join(process.cwd(), 'node_modules/angular-mocks/angular-mocks.js'),
  Path.join(process.cwd(), 'test/spec/setup.coffee'),
  Path.join(process.cwd(), 'test/spec/**/*.spec.coffee')
 ]

var filePreprocessors = _(filePatterns).reduce(function (memo, val) {
  var prep = ['webpack'];
  memo[val] = prep;
  return memo;
 }, {});

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

    singleRun: true,

     frameworks: [
       'mocha', 
      'chai', 
      'chai-as-promised',
     'sinon-chai'
    ],

    browsers: ['PhantomJS'],

    files: filePatterns,

   preprocessors: filePreprocessors,

   webpack: require('../webpack/test'),

   reporters: args.reporter.split(','),

    coverageReporter: {
      dir: '../../../test/reports/coverage',
      reporters: [
        // reporters not supporting the `file` property 
       { type: 'html', subdir: 'report-html' },
       { type: 'lcov', subdir: 'report-lcov' },
       // reporters supporting the `file` property, use `subdir` to directly 
       // output them in the `dir` directory 
       { type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
       { type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' },
       { type: 'teamcity', subdir: '.', file: 'teamcity.txt' },
       { type: 'text', subdir: '.', file: 'text.txt' },
       { type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
     ]
   },

   webpackMiddleware: { noInfo: true },

   colors: (args.color === false || args.colors === false) ? false : true,

   plugins: [
     'karma-webpack',
     'karma-chai-plugins',
     'karma-mocha',
     'karma-phantomjs-launcher',
     'karma-chrome-launcher',
     'karma-spec-reporter',
     'karma-nyan-reporter',
     'karma-notify-reporter',
     'karma-coverage',
    ]
  });
}

 WARN [preprocess]: Can not load "webpack"!
 TypeError: undefined is not a function
  at Plugin.notifyKarmaAboutChanges (C:\Users\dwaldo\Documents\endeavor-      storefront\WebClient\node_modules\karma-webpack\index.js:108:15)
  at Plugin.<anonymous> (C:\Users\dwaldo\Documents\endeavor-    storefront\WebClient\node_modules\karma-webpack\index.js:72:9)
  at Tapable.applyPlugins (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:26:37)
 at Watching._done (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:78:17)
 at Watching.<anonymous> (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:61:18)
 at Tapable.emitRecords (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:281:37)
 at Watching.<anonymous> (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:58:19)
 at C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:274:11
 at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:60:69)
  at Tapable.afterEmit (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:271:8)
  at Tapable.<anonymous> (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:266:14)
  at C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\async\lib\async.js:52:16
  at Object.async.forEachOf.async.eachOf (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\async\lib\async.js:231:20)
  at Object.async.forEach.async.each (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\async\lib\async.js:210:22)
  at Tapable.emitFiles (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:234:20)
  at MemoryFileSystem.(anonymous function) [as mkdirp] (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma-webpack\node_modules\webpack-dev-middleware\node_

modules\memory-fs\lib\MemoryFileSystem.js:197:10)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:228:25)
at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:60:69)
at Tapable.Compiler.emitAssets (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:225:7)
at Watching. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:54:18)
at C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:402:12
at Tapable.next (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:67:11)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\CachePlugin.js:40:4)
at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:71:13)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:399:9)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compilation.js:574:13)
at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:60:69)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compilation.js:569:10)
at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:60:69)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compilation.js:564:9)
at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:60:69)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compilation.js:560:8)
at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:60:69)
at Tapable.seal (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compilation.js:522:7)
at Tapable. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:396:15)
at C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:103:11
at Object.async.each (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma-webpack\node_modules\async\lib\async.js:118:20)
at Plugin.make (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma-webpack\index.js:118:8)
at Tapable.applyPluginsParallel (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:107:14)
at Tapable.Compiler.compile (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:393:7)
at Watching. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:46:17)
at Tapable.next (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:67:11)
at Tapable.invalidAsyncPlugin (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma-webpack\node_modules\webpack-dev-middleware\middleware.js:78:3)
at Tapable.applyPluginsAsync (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\node_modules\tapable\lib\Tapable.js:71:13)
at Watching._go (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:44:16)
at Watching. (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:36:8)
at Tapable.readRecords (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:301:10)
at new Watching (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:33:16)
at Tapable.Compiler.watch (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\webpack\lib\Compiler.js:160:17)
at new module.exports (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma-webpack\node_modules\webpack-dev-middleware\middleware.js:103:27)
at new Plugin (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma-webpack\index.js:88:37)
at invoke (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\node_modules\di\lib\injector.js:75:15)
at Array.instantiate (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\node_modules\di\lib\injector.js:59:20)
at get (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\node_modules\di\lib\injector.js:48:43)
at C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\node_modules\di\lib\injector.js:71:14
at Array.map (native)
at Array.invoke (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\node_modules\di\lib\injector.js:70:31)
at [object Object].get (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\node_modules\di\lib\injector.js:48:43)
at instantiatePreprocessor (C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\lib\preprocessor.js:56:37)
at Array.forEach (native)
at C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\lib\preprocessor.js:77:31
at C:\Users\dwaldo\Documents\endeavor-storefront\WebClient\node_modules\karma\lib\file_list.js:226:17
at FSReqWrap.oncomplete (fs.js:95:15)

karma-webpack seems to break angular unit tests

I have recently converted a project I am working on over to webpack, including my unit tests for the Angular front-end. I have some unit tests written for some directives with custom transclusion/jquery/jqlite functionality in the link functions which passes in a webpack-less testing environment, yet when tested with karma-webpack they do not pass. Allow me to demonstrate:

Standard karma.conf.js

// Reference: http://karma-runner.github.io/0.12/config/configuration-file.html
module.exports = function(config) {
  config.set({

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


    files : [

        'public/tests.bundle.js'
    ],


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


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {

        'public/tests.bundle.js' : ['webpack', 'sourcemap']
    },


    // . . .


    webpack: {

        // Just do inline source maps instead of the default
        devtool: 'inline-source-map',

        module: { 

            loaders: [
                {
                    test: /\.js$/,
                    exclude: /node_modules/,
                    loader: 'babel-loader'
                },
            ],
        }
    }
  });
};

Test bundle

// Doesn't work with or without this line
import 'jquery';

import 'angular';
import 'angular-mocks/angular-mocks';

var testsContext = require.context('.', true, /.+\.spec\.js$/);

testsContext.keys().forEach(testsContext);

Angular Directive in ES6

import directiveFactory from '../../directivefactory.js';

// ## Directive Definition
class pageHeader {

    constructor() {

        this.template =
        `
            <div class="d5-page-header-wrapper">

                <div class="d5-page-header">

                    <!-- Main page header text -->
                    <!-- component user content insertion point 1 -->
                    <span class="text-main" transclude-id="header"></span>

                    <!-- Small page header text -->
                    <!-- component user content insertion point 2 -->
                    <span class="text-small" transclude-id="small"></span>

                    <hr class="break">

                    <!-- Page header text lead -->
                    <!-- component user content insertion point 3 -->
                    <span class="text-lead" transclude-id="lead"></span>

                    <!-- Custom navigation button -->
                    <button class="btn btn-custom btn-block btn-lg">

                        Jump to Collections <span class="glyphicon
                            glyphicon-arrow-down"></span>

                    </button>

                </div>

            </div>
        `;
        this.restrict = 'E';
        this.scope = {};
        this.bindToController = {

        };
        this.transclude = true;
        this.controller = PageHeaderController;
        this.controllerAs = 'vm';
    }

    // ###Optional Link Function
    link (scope, elem, attrs, ctrl, transclude) {

        transclude ((clone) => {

            angular.forEach(clone, (cloneEl, value) => {

                // If the clone element has attributes...
                if(cloneEl.attributes) {

                    // Get desired target ID...
                    var tId = cloneEl.attributes["transclude-to"].value;

                    // Find target element with that ID...
                    var target = elem.find('[transclude-id="' + tId + '"]');

                    // Append element to target
                    target.append(cloneEl);
                }
            });
        });
    }
}

export default ['pageHeader', directiveFactory(pageHeader)];

Unit Test

describe('page header directive', () => {

    let elem, scope;

    // Mock our page-header directive
    beforeEach(angular.mock.module(pageHeader));

    beforeEach(angular.mock.inject(($rootScope, $compile) => {

        // Define the directive markup to test with
        elem = angular.element(
            `
            <div>

                <page-header>

                    <span transclude-to="header">

                        Test Header

                    </span>

                    <span transclude-to="small">

                        Test Small Header

                    </span>

                    <span transclude-to="lead">

                        Test Lead Content

                    </span>

                </page-header>

            </div>
            `
        );

        scope = $rootScope.$new();

        $compile(elem)(scope);

        scope.$digest();
    }));

    describe('link transclusion function', () => {

        it("should create a main header element containing the component " +
            "user's markup", () => {

            let items = elem.find('.text-main');

            console.log(items);

            // FAIL
            expect(items.eq(0).text()).toContain('Test Header');
        });
    });
});

I am not sure if this is the right place to post this or not, but it seems the problem lies in my implementation or karma-webpack as the code works in the browser as it should. In any case, I'd appreciate the help with the matter.

Using file-based sourcemap instead of inline

For some reason inline sourcemaps make tests start up and run incredibly slow in current versions of Chrome and PhantomJS2. It would be nice to be able to use external sourcemaps (which run much quicker). The easiest way I can think to do this is to simply change the URL on the bottom of the bundle to reference "karma_webpack/path/to/bundle.js.map". Is there any way to configure this? Alternatively, it might be interesting to register a customFileHandler for each [entry].js.map that then pulls the map from the middleware.

code coverage with karma-coverage

Having some trouble configuring karma coverage with webpack. The testing itself is working great. Here's my attempted config:

// Karma configuration
// Generated on Sat Apr 19 2014 15:17:46 GMT-0500 (CDT)

var path = require('path'),
webpack = require('webpack');

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: ['mocha', 'sinon-chai'],


    // list of files / patterns to load in the browser
    files: [
        {
            pattern: 'test/client/**/*Test.js'
        }
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
        'test/client/**/*Test.js': ['webpack'],
        'public/js/**/*.js': ['coverage']
    },

    webpack: {
        resolve: {
            root: [
                path.resolve('public'),
                path.resolve('public/js'),
                path.resolve('public/components')
            ],
            modulesDirectories: [
                'components',
                'node_modules',
                'templates'
            ],
            alias: {
                jquery: 'jquery/dist/jquery.js',
                backbone: 'backbone/backbone.js',
                underscore: 'lodash/dist/lodash.compat.js',
                'backbone.marionette': 'marionette/lib/core/backbone.marionette.js',
                'backbone.hammerjs': 'backbone.hammer.js/backbone.hammer.js',
                'hammerjs' : 'jquery-hammerjs/jquery.hammer-full.js',
                'dustjs-linkedin': 'dustjs-linkedin/dist/dust-core.js',
                'dustjs-helpers': 'dustjs-helpers/dist/dust-helpers.js',
                velocity: 'velocity/jquery.velocity.js',
                transition: 'bootstrap/js/transition',
                collapse: 'bootstrap/js/collapse'
            },
            extensions: ['', '.js', '.json']
        },
        module: {
            loaders: [
                {
                    test: /jquery\.js$/,
                    loader: "expose?jQuery!expose?$"
                },
                {
                    test: /\.less$/,
                    loader: "style-loader!css-loader!less-loader"
                }
            ]
        },
        plugins: [
            new webpack.ProvidePlugin({
                $: 'jquery',
                jQuery: 'jquery',
                dust: 'dustjs-linkedin',
                _: 'underscore',
                Backbone: 'backbone',
                Marionette: 'backbone.marionette'
            })
        ],
        debug: false,
        stats: {
            colors: true,
            reasons: true
        },
        progress: true
    },

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

    coverageReporter: {
        dir : './coverage-client-unit',
        reporters: [
            {type: 'lcov'},
            {type: 'cobertura', file: 'client-coverage.xml'}
        ]
    },

    junitReporter: {
        outputFile: './test-results.xml'
    },

    // 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: true,

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

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

};

Any ideas?

AssertionError mapping with single test bundle

I'm using the single test bundle configuration of Karma-Webpack:

// test-runner.js
var testsContext = require.context(".", true, /-spec.js$/);
testsContext.keys().forEach(testsContext);

but my test output looks like this:

AssertionError: expected '' to equal '1'
        at Context.<anonymous> (base/test-runner.js?bed4b6cf687e5c4dbab5add3f34895fc0ed1e74a:51435:24)

Is there a way to get this to point to the actual spec that failed?

Runner hangs when there is more than one test modules

I can my tests to run, so long as there is only one test module (one js file). As soon as I add a second module, the runner hangs.

I am able to reproduce this even with the example included with karma-webpack, by adding a second test file.

I am currently looking at webpack's docs and the source to understand what is going on, but maybe it's an easy fix that someone knows about.

Example doesn't work

--- karma-webpack/example ‹master* M› » karma start
DEBUG [plugin]: Loading inlined plugin (defining framework:mocha).
DEBUG [plugin]: Loading inlined plugin (defining launcher:Chrome, launcher:ChromeCanary).
DEBUG [plugin]: Loading inlined plugin (defining launcher:Chrome, launcher:ChromeCanary).
DEBUG [plugin]: Loading inlined plugin (defining webpackPlugin, preprocessor:webpack).
INFO [karma]: Karma v0.12.1 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at /var/folders/y0/8wln1fl90sggrb91q4x_kr140000gn/T/karma-85450105
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/y0/8wln1fl90sggrb91q4x_kr140000gn/T/karma-85450105 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --start-maximized http://localhost:9876/?id=85450105
Hash: 4dd3bd2abd74c54b99cb
Version: webpack 1.1.0
Time: 4ms
Asset  Size  Chunks       Chunk Names
webpack: bundle is now VALID.
webpack: bundle is now invalid.
DEBUG [watcher]: Resolved files:
    /Users/okonet/Projects/OSS/karma-webpack/node_modules/mocha/mocha.js
    /Users/okonet/Projects/OSS/karma-webpack/node_modules/karma-mocha/lib/adapter.js
    /Users/okonet/Projects/OSS/karma-webpack/example/test/aTest.js
    /Users/okonet/Projects/OSS/karma-webpack/example/test/bTest.js
DEBUG [watcher]: Watching "/Users/okonet/Projects/OSS/karma-webpack/example/test"
Hash: d59756c6ce093b710e87
Version: webpack 1.1.0
Time: 34ms
            Asset  Size  Chunks             Chunk Names  
_js/test/aTest.js  4546       0  [emitted]  test/aTest.js
   _js/1.chunk.js   117       1  [emitted]               
_js/test/bTest.js  4054       2  [emitted]  test/bTest.js
chunk    {0} _js/test/aTest.js (test/aTest.js) 679 [rendered]
    [0] ./test/aTest.js 627 {0} [built]
    [1] ./fixtures/file.js 18 {0} [built]
    [3] ./fixtures/file.coffee 34 {0} [built]
chunk    {1} _js/1.chunk.js 18 {0} {2}
    [2] ./fixtures/file.js?1 18 {1} [built]
chunk    {2} _js/test/bTest.js (test/bTest.js) 324 [rendered]
    [0] ./test/bTest.js 324 {2} [built]
webpack: bundle is now VALID.
DEBUG [web-server]: serving: /Users/okonet/Projects/OSS/karma-webpack/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /Users/okonet/Projects/OSS/karma-webpack/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/F0rX6We5eIQZcuygVsFZ
DEBUG [karma]: A browser has connected on socket F0rX6We5eIQZcuygVsFZ
INFO [Chrome 33.0.1750 (Mac OS X 10.9.2)]: Connected on socket F0rX6We5eIQZcuygVsFZ with id 85450105
DEBUG [launcher]: Chrome (id 85450105) captured in 2.393 secs
DEBUG [karma]: All browsers are ready, executing
DEBUG [web-server]: serving: /Users/okonet/Projects/OSS/karma-webpack/node_modules/karma/static/context.html
Chrome 33.0.1750 (Mac OS X 10.9.2) ERROR
  TEST RUN WAS CANCELLED because these files contain some errors:
    /Users/okonet/Projects/OSS/karma-webpack/example/test/aTest.js
    /Users/okonet/Projects/OSS/karma-webpack/example/test/bTest.js

Is this related to #5?

Web-server always serve cached files to karma runners

It looks like the webpack-dev-server always serve a cached versions of my specs when running with grunt-watch and karma:unit:run mode. I've already tried to set cache: false in karma's webpack config but it didn't help.

Is there something I'm missing here?

When karma is auto-watching files, karma-webpack causes tests to occasionally run twice, possibly OS X-only

I have a larger project set up using gulp with karma's watch to run tests on the fly.

I noticed that frequently when making updates to test files karma is watching, the tests get fired twice. After paring down my configurations, it looks like karma-webpack is the culprit.

I'm on OS X, so hopefully the repro works on whatever platform. Here are instructions/a barebones repo to isolate the issue and reproduce:

https://github.com/alanctkc/karma-webpack-watch-bug-repro#readme

Here's a comparison of the output I get simulating changes with and without the ['webpack'] preprocessor:

https://gist.github.com/alanctkc/79c2c4586f13f22bd8e6

Unfortunately, it doesn't seem to be super deterministic, so you might have to simulate changes a few times before seeing any duplicates. But, when the preprocessor is removed, there never seem to be any duplicate runs at all.

Any ideas?

ReferenceError: Can't find variable require

I have webpack working great to build my app, but am having some issues with setting up testing.

here's what I have for my karma.conf.js

// Karma configuration

var path = require('path'),
webpack = require('webpack');

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: ['mocha', 'sinon-chai'],

    // list of files / patterns to load in the browser
    files: [
        {
            pattern: 'test/**/*Test*'
        }
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
        'test/*Test*': ['webpack']
    },

    webpack: {
        resolve: {
            root: [
                path.resolve('public'),
                path.resolve('public/js'),
                path.resolve('public/components')
            ],
            modulesDirectories: [
                'components',
                'node_modules',
                'templates'
            ],
            alias: {
                jquery: 'jquery/dist/jquery.js',
                backbone: 'backbone/backbone.js',
                underscore: 'lodash/dist/lodash.compat.js',
                'backbone.marionette': 'marionette/lib/core/backbone.marionette.js',
                'backbone.hammerjs': 'backbone.hammer.js/backbone.hammer.js',
                'hammerjs' : 'jquery-hammerjs/jquery.hammer-full.js',
                'dustjs-linkedin': 'dustjs-linkedin/dist/dust-core.js',
                'dustjs-helpers': 'dustjs-helpers/dist/dust-helpers.js',
                velocity: 'velocity/jquery.velocity.js',
                transition: 'bootstrap/js/transition',
                collapse: 'bootstrap/js/collapse'
            },
            extensions: ['', '.js', '.json']
        },
        module: {
            loaders: [
                {
                    test: /jquery\.js$/,
                    loader: "expose?jQuery!expose?$"
                }
            ]
        },
        stats: {
            colors: true,
            reasons: true
        },
        progress: true,
        plugins: [
            new webpack.ProvidePlugin({
                $: 'jquery',
                jQuery: 'jquery',
                dust: 'dustjs-linkedin',
                _: 'underscore',
                Backbone: 'backbone',
                Marionette: 'backbone.marionette'
            })
        ]
    },
    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['mocha'],

    // 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_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'],

    captureTimeout: 60000,

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

});

};

I'm getting Can't find variable: require when I try to place a test in a sub directory.

This is happening on the example in the repo as well.

any ideas?

1.4.0 causes ... has no method 'split' in karma-sourcemaps

Hi, I just upgraded to 1.4.0 and now I get the following error:

You need to include some adapter that implements karma.start method!

If I use the plugin with the karma sourcemaps plugin I get a huge dump which at the end says that
`Fatal error: Object /******/ (function(modules) { // webpackBootstrap
...
]) has no method 'split'

Downgrading to 1.3.1 works. Any ideas why?

I can provide a full list of my NPM dependencies if that is needed, but here are the main deps:

karma: 0.12.31
├── [email protected]
├─┬ [email protected]
├─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
└─┬ [email protected]
  └─┬ [email protected]
├── [email protected]
├─┬ [email protected]
├─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
└─┬ [email protected]
  └─┬ [email protected]

CPU load > 50% after tests are finished

I have a problem with updated webpack & karma-webpack. Everything is alright on single test run, but after first tests run in watch mode, karma with webpack loads CPU > 50% (up to 70%).

window

--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
     "karma-junit-reporter": "^0.2.2",
     "karma-mocha": "^0.1.3",
     "karma-phantomjs-launcher": "^0.1.4",
-    "karma-webpack": "git://github.com/Lendar/karma-webpack#e96ae8a",
+    "karma-webpack": "1.2.1",
     "kexec": "^0.2.0",
     "mocha": "^1.18.2",
     "phantomjs": "^1.9.7-14",
@@ -55,8 +55,8 @@
     "sugar": "^1.4.1",
     "tiny-lr": "0.0.7",
     "url-loader": "^0.5.5",
-    "webpack": "^1.1.8",
-    "webpack-dev-middleware": "git://github.com/kossnocorp/webpack-dev-middleware.git#0904c6e97a",
+    "webpack": "1.3.2-beta3",
+    "webpack-dev-middleware": "1.0.10",
     "yo": "^1.1.2"
   }
 }

Pass stats options to stats.toJson

In my excitement for this to be officially released, I attempted to use it with karma, but it looks like karma-webpack isn't passing the stats options properly. I tried to implement it myself, but I think that for some reason I have two items in that stats array (stats are getting printed twice? not sure why).

Really looking forward to getting webpack/webpack#1191 closed :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.