Skip to content

Commit

Permalink
Implement fix for Karma prebundle
Browse files Browse the repository at this point in the history
As described in the GitHub issue[1]. Unfortunately now we fail further
down the stack...

[1]: nikku/karma-browserify#63 (comment)
  • Loading branch information
aron committed Dec 11, 2014
1 parent 49d35ed commit 6c9b71b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
13 changes: 6 additions & 7 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ module.exports = function (karma) {
browserify: {
debug: true,
prebundle: function (bundle) {
// This allows annotator-plugintools to require annotator as
// 'annotator' in the test environment.
bundle.require('./src/annotator', {expose: 'annotator'});
// This, for reasons that remain entirely unclear, fixes an
// issue where the above require doesn't seem to work, and the
// karma build dies saying "Cannot find module 'annotator' ..."
bundle.bundle();
// This is event is fired each time the bundle is built.
bundle.on('reset', function () {
// This allows annotator-plugintools to require annotator
// as 'annotator' in the test environment.
bundle.require('./src/annotator', {expose: 'annotator'});
});
}
},

Expand Down
2 changes: 1 addition & 1 deletion test/spec/annotator_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('assertive-chai').assert;

var Annotator = require('../../src/annotator');
var Annotator = require('annotator');

describe("Annotator.noConflict()", function () {
var _Annotator = null;
Expand Down
2 changes: 1 addition & 1 deletion test/spec/bootstrap_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('assertive-chai').assert;

var Annotator = require('../../src/annotator'),
var Annotator = require('annotator'),
$ = require('../../src/util').$;

require('../../src/bootstrap');
Expand Down
2 changes: 1 addition & 1 deletion test/spec/plugin/markdown_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('assertive-chai').assert;

var Annotator = require('../../../src/annotator'),
var Annotator = require('annotator'),
Markdown = require('../../../src/plugin/markdown');

var $ = Annotator.Util.$;
Expand Down
2 changes: 1 addition & 1 deletion test/spec/plugin/tags_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('assertive-chai').assert;

var Annotator = require('../../../src/annotator'),
var Annotator = require('annotator'),
Tags = require('../../../src/plugin/tags');

var $ = Annotator.Util.$;
Expand Down
2 changes: 1 addition & 1 deletion test/spec/plugin/unsupported_spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var Annotator = require('../../../src/annotator'),
var Annotator = require('annotator'),
Unsupported = require('../../../src/plugin/unsupported').Unsupported;

describe('Unsupported plugin', function () {
Expand Down

0 comments on commit 6c9b71b

Please sign in to comment.