Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Breaks when browserify --standalone bundle included via karma files #12

Open
beckyconning opened this issue Nov 13, 2014 · 9 comments
Open

Comments

@beckyconning
Copy link

As a karma-cucumber-js user
I want to include a bundle built with Browserify
So that I can use its functionality inside my feature testing DSL

Given a bundle that has been built with Browserify as follows browserify src/some-module.js --standalone some-module > bundle.js
When I include this module in karma.conf.js's file section as follows { pattern: "./node_modules/some-module/bundle.js", watched: false, included: true, served: false }
I should not be presented with the error Error: Mismatched anonymous define() module

The error originates from here https://github.com/s9tpepper/karma-cucumberjs/blob/master/lib/adapter.js#L1220

@beckyconning
Copy link
Author

Seems this has been fixed in a newer RequireJS

requirejs/requirejs#883

Could you possibly update RequireJS in this package?

@beckyconning
Copy link
Author

It would be really useful if you could include the build config or even an package.json build script.

@beckyconning
Copy link
Author

@justinware
Copy link

Yes I think I tend to agree with you @beckyconning. I am also using a bundled JS file and getting the exact same error. Would be great to get an updated RequireJS in a new build. Have you managed to now get it working ?

@beckyconning
Copy link
Author

No I haven't, I ran out of time before I could work it out. I added an npm build script to my local fork which I should probably commit though.

After the project I'm currently working on I'm going to put together the start of another Cucumber.js Karma adapter using the promises version of Cucumber.js and Browserify.

This isn't because this one is bad. This one is awesome but I think @s9tpepper is too busy to maintain it. We depend on this a lot so we're happy to maintain a Cucumber.js Karma adapter and manage PRs etc.

Let me know if you work it out though.

@beckyconning
Copy link
Author

I don't think its as simple as updating RequireJS and rebuilding though. I think files are being manually loaded in some fashion that breaks RequireJS when combined with Browserify.

@justinware
Copy link

Yeah I was thinking the exact same thing, in that at some point I would write my own Karma adapter utilising the existing CucumberJS and Browserify node packages (as I think the raw CucumberJS package works quite well as it is). Was toying with calling it karma-chameleon :) Why...? because it hasn't been done yet, because it's funny, and because I am child of the 80s and just love that song :)

Pretty busy though, have deliverables and need an immediate solution, so in the interim we are going to look at using Yadda (https://github.com/acuminous/yadda) which seems to be very similar to what CucumberJS offers, Gherkin-like feature specs, supports a plethora of other test framework integration (Jasmine, Mocha, etc), utilises RequiresJS, has documented Karma examples and seems to be pretty progressive, active & well-maintained. Am doing a Spike on it today, and so hopefully is fit for purpose.

@justinware
Copy link

Meant utilises browserify...

@cmdln
Copy link

cmdln commented Jun 11, 2015

I am running afoul of the same issue but would definitely prefer to continue to use something that works with karma since we have approaching 500 unit tests in our existing karma setup.

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

No branches or pull requests

3 participants