nikku / karma-browserify

A fast Browserify integration for Karma that handles large projects with ease
MIT License
321 stars 49 forks source link

bundle not being built on windows #153

Closed Hypercubed closed 8 years ago

Hypercubed commented 8 years ago

I tested the example (unmodified) on both windows and Mac. On the mac it is working but fails on the windows machine with the output as I posted in this comment (https://github.com/nikku/karma-browserify/issues/84#issuecomment-159465375).

As far as I can tell the bundlePreprocessor return function (https://github.com/nikku/karma-browserify/blob/master/lib/bro.js#L364) is never being called on windows. Could be the race condition described here https://github.com/nikku/karma-browserify/issues/57 but changing the debounce time doesn't help. I never see bundle built on windows.

nikku commented 8 years ago

Can you give me your details on which versions of browserify, watchify and karma-browserify you are using (i.e. snippet in your package.json)?

Hypercubed commented 8 years ago

I'm using the example in this repo so:

  "devDependencies": {
    "brfs": "^1.4.0",
    "browserify-shim": "~3.8.0",
    "karma": "^0.13.0",
    "karma-browserify": "^4.2.0",
    "karma-jasmine": "^0.1.5",
    "karma-phantomjs-launcher": "^0.1.4"
  },

npm ls reports the same versions on both mac and windows:

> npm ls brfs browserify-shim karma  karma-browserify karma-jasmine karma-phantomjs-launcher
karma-browserify-example@0.0.0 C:\Users\myusername\workspace\components\karma-browserify\example
├── brfs@1.4.1
├── browserify-shim@3.8.11
├── karma@0.13.15
├── karma-browserify@4.4.0
├── karma-jasmine@0.1.6
└── karma-phantomjs-launcher@0.1.4
Hypercubed commented 8 years ago

At first I believed it was because the 'bundled' listener (https://github.com/nikku/karma-browserify/blob/master/lib/bro.js#L239) was moved into the if (config.autoWatch) block in v4.4. But after digging deeper I noticed that bundlePreprocessor return function (https://github.com/nikku/karma-browserify/blob/master/lib/bro.js#L364) is never being called on windows.

Hypercubed commented 8 years ago

Got it!!!

The browserify-bundle preprocessor is never called because because the bundle doesn't match the '**/*.browserify' glob. The reason it doesn't match is that my TEMP path contains a dot in the path (C:\Users\myusername\.babun\cygwin\tmp\karma-19378513).

I can fix this on my end by exporting different path. Perhaps a change to the glob would prevent this issue in the future?

bendrucker commented 8 years ago

Applied fix from #154