|
1 |
| -karma-browserify |
| 1 | +[deprecated] karma-browserify |
2 | 2 | ================
|
3 | 3 |
|
4 |
| -[Browserify](http://browserify.org) for [Karma](http://karma-runner.github.io) |
5 |
| - |
6 |
| -[](http://badge.fury.io/js/karma-browserify) [](https://david-dm.org/xdissent/karma-browserify) [](https://david-dm.org/xdissent/karma-browserify#info=devDependencies) |
7 |
| - |
8 |
| -Browserify is an awesome tool for managing front-end module dependencies with |
9 |
| -`require`, just like you would in Node. Karma is a killer JS test runner that's |
10 |
| -super fast and easy. But put them together and you're entering a world of pain. |
11 |
| -This plugin aims to make them play nice. |
12 |
| - |
13 |
| -Under most circumstances, Browserify attempts to give you a single monolithic |
14 |
| -bundle of all of your JS files and their dependencies. That's perfect for fast |
15 |
| -delivery with minimal requests in a browser environment, but sucks hard if |
16 |
| -you're just trying to run your tests (over and over). This plugin hijacks the |
17 |
| -Browserify pipeline to produce a single bundle of *all* dependencies found in |
18 |
| -your tests (and their dependencies) which is transferred to the browser under |
19 |
| -test only once (unless it changes). A separate, minimal bundle is generated for |
20 |
| -each test which, aside from the test code, only contains references to |
21 |
| -external dependencies in the main bundle. That way dependencies are updated in |
22 |
| -the browser only when necessary (watching for changes is supported) and your |
23 |
| -tests remain lightning fast. |
24 |
| - |
25 |
| - |
26 |
| -Installation |
27 |
| ------------- |
28 |
| - |
29 |
| -Install the plugin from npm: |
30 |
| - |
31 |
| -```sh |
32 |
| -$ npm install karma-browserify --save-dev |
33 |
| -``` |
34 |
| - |
35 |
| -Or from Github: |
36 |
| - |
37 |
| -```sh |
38 |
| -$ npm install 'git+https://github.com/xdissent/karma-browserify.git' --save-dev |
39 |
| -``` |
40 |
| - |
41 |
| -Add `browserify` to the `frameworks` and `preprocessor` keys in your |
42 |
| -Karma configuration: |
43 |
| - |
44 |
| -```coffee |
45 |
| -module.exports = (config) -> |
46 |
| - config.set |
47 |
| - |
48 |
| - # frameworks to use |
49 |
| - frameworks: ['mocha', 'browserify'] |
50 |
| - |
51 |
| - preprocessors: |
52 |
| - '**/*.coffee': ['coffee'] |
53 |
| - 'my/test/files/*': ['browserify'] |
54 |
| - |
55 |
| - # ... |
56 |
| -``` |
57 |
| - |
58 |
| - |
59 |
| -Options |
60 |
| -------- |
61 |
| - |
62 |
| -The plugin may be configured using the `browserify` key in your Karma config: |
63 |
| - |
64 |
| -```coffee |
65 |
| -module.exports = (config) -> |
66 |
| - config.set |
67 |
| - |
68 |
| - browserify: |
69 |
| - extensions: ['.coffee'] |
70 |
| - ignore: [path.join __dirname, 'components/angular-unstable/angular.js'] |
71 |
| - transform: ['coffeeify'] |
72 |
| - watch: true # Watches dependencies only (Karma watches the tests) |
73 |
| - debug: true # Adds source maps to bundle |
74 |
| - noParse: ['jquery'] # Don't parse some modules |
75 |
| - |
76 |
| - # ... |
77 |
| -``` |
78 |
| - |
79 |
| - |
80 |
| -Usage |
81 |
| ------ |
82 |
| - |
83 |
| -Just `require` modules from within tests as you normally would in Node: |
84 |
| - |
85 |
| -```coffee |
86 |
| -something = require '../some/module' |
87 |
| - |
88 |
| -describe 'karma tests with browserify', -> |
89 |
| - |
90 |
| - it 'should gimme dat module', -> |
91 |
| - something.should.exist() |
92 |
| -``` |
93 |
| - |
94 |
| -See the [example](https://github.com/xdissent/karma-browserify/tree/master/example) |
95 |
| -for a simple working setup. |
96 |
| - |
97 |
| -License |
98 |
| -------- |
99 |
| - |
100 |
| -The MIT License (MIT) |
| 4 | +This repo was superseded by another project, formerly karma-bro, as of 1.0. [karma-browserify on npm](https://www.npmjs.org/package/karma-browserify) is now published from [nikku/karma-browserify](https://github.com/Nikku/karma-browserify). This repo will no longer be updated or published. |
0 commit comments