nikku / karma-browserify

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

attempting to use node-underscorify with karma-browserify fails #212

Closed sspickle closed 6 years ago

sspickle commented 6 years ago

Hi Folks,

I'm not sure this is the best place to ask such a question, or to report a problem. If you have an idea of a better forum, please let me know. I'm not at all certain this is a problem with karma-browserify, more likely it's pilot error, but I don't know where else to ask.

I'm working on a Backbone OPA. I'm using browserify to manage dependencies, and it's going pretty well so far. I'm using underscore templates.

The browserify command line looks like so:

browserify client/index.js -t node-underscorify -o static/js/app.js

where I'm using node-underscorify to transform the underscore templates.

When I try to use node-underscorify to within karma like so:

browserify: { debug: true, transform: ['node-underscorify', {extensions: ['.html'], minify: false}] },

I get:

07 10 2017 21:30:42.692:INFO [framework.browserify]: registering rebuild (autoWatch=true) 07 10 2017 21:30:43.507:ERROR [framework.browserify]: bundle error 07 10 2017 21:30:43.508:ERROR [framework.browserify]: TypeError: Path must be a string.

Is it documented somewhere how to translate a working browserify command line into a working karma-browserify transform specification?

thanks, -steve

sspickle commented 6 years ago

OK, I found this https://github.com/nikku/karma-browserify/issues/163 and it points out that I have a nesting error in the transform syntax, fixed that, but now have:

08 10 2017 00:17:34.286:INFO [framework.browserify]: registering rebuild (autoWatch=true) 08 10 2017 00:17:35.402:ERROR [framework.browserify]: bundle error 08 10 2017 00:17:35.402:ERROR [framework.browserify]: /app/client/templates/bikeView.html:1

<div class="view">
^

ParseError: Unexpected token 08 10 2017 00:17:35.405:WARN [karma]: No captured browser, open http://localhost:9876/ 08 10 2017 00:17:35.412:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/

Ugh. The transformation is evidently not happening.

sspickle commented 6 years ago

OK, I got it to work by removing the extension option and moving the browserify transform setting to package.json. Never mind. ;-)