Comments (8)
You'd have to supply that yourself since there isn't a way to make prebundle
async. The ideal way to do it is to drop the Karma CLI entirely and compose a gulp task (karma-as-promised should be helpful there). Generate the external bundle there, perhaps even to a tmp folder, and then load it in your Karma files array.
from karma-browserify.
Ah, so multiple builds, each with its own set of files, is not really from within karma. Instead I would just do:
files : [
'test/unit/**/*Spec.js',
'app/dist/vendor.js'
],
preprocessors: {
'test/unit/**/*Spec.js' : ['browserify']
},
and build my app/dist/vendor.js
(or whatever other path I want) as part of a separate gulp/grunt/npm task. Since it changes so infrequently, updating that one manually (without watchify) is not the end of the world... and gulp.watch
could probably watch it for me anyways?
from karma-browserify.
It would be cool if Karma had an async interface for adding files, but unfortunately it doesn't. That essentially means that all the files need to exist before Karma runs. By the way, I use browserify-shim
to use Angular as a window
global with a plain old concatenated vendor file. Makes it a whole lot easier since you can just add your vendor files directly to the Karma files array.
from karma-browserify.
Yeah, I used to have my own "angular-cjs.js" and "jquery-cjs.js" files to shim, but now I use browserify-shim. Much easier.
I do like browserify, but in an angular world, you almost wish the two were merged, so it could read the angular modules and find the relevant files.
I will close this out. Thanks for the assistance.
from karma-browserify.
Well Angular modules don't actually specify file structure relations like CommonJS, nor are they intended to. Angular's modules are design for dependency injection and have no opinion about how they load them. That said, I'm with you that it's a mess. Angular is supposed to ship with CommonJS support on npm in 1.3. Then there will be a transition process where everyone who wrote their modules to expect window.angular
has to go fix them. I generally find the average quality of popular (50+ stars) Angular modules to be extremely low. The best way to prepare is to write everything with browserify-shim
. Then it's a one line fix to your package when Angular can be require
d.
from karma-browserify.
I haven't delved too deeply into most of the modules, but I have seen a lot of junk.
Yeah, I like the cleanliness of it. The less I have to do inside individual files for maintenance, the better.
Is it supposed to finally ship with npm support? I would very much like to do npm install angular
and be done with it. Then I can require('angular')
or maybe require('angular/angular-resource')
natively.
from karma-browserify.
You +1'd it 3 days ago! 😄
Slated for rc5 which I'm guessing will land in 2 weeks.
from karma-browserify.
I know I +1'd it... but I didn't realize they had agreed.
Oh, now I see the "added to 1.3.0 milestone". That will be nice.
from karma-browserify.
Related Issues (20)
- intellij karma runner doesn't use watchify for bundle rebuild HOT 3
- Cannot read property 'bundleFile' of undefined HOT 2
- Error: Cannot find module HOT 2
- Use global transforms HOT 4
- ERROR [framework.browserify]: Error: Cannot find module HOT 2
- attempting to use node-underscorify with karma-browserify fails HOT 2
- Missing repo nikku/node-browserify breaks older versions (<4.0) HOT 1
- Karma not working with Firefox(FirefoxHeadless) when loading with html page. HOT 1
- Unable to browserify file HOT 1
- Install issues due to browserify peerDependecy condition HOT 1
- karma-browserify HOT 1
- lodash vulnerability reported by "npm audit" HOT 1
- When packaged, my test coverage is always 100% HOT 4
- release with PhantomJS removed? HOT 1
- promisify is not a function HOT 2
- Using karma-browserify with WASM HOT 2
- Cannot use import statement outside a module only on karma-browserify HOT 3
- Support for Browserify v17 HOT 2
- Breaking change coming for karma-browserify/lib/preprocessor.js HOT 4
- Support watchify <= 4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-browserify.