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

Fix karma-browserify prebundle #469

Merged
merged 2 commits into from
Dec 12, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"jshint": "~2.5.0",
"jwt-simple": "~0.1.0",
"karma": "^0.12.24",
"karma-bro": "^0.8.0",
"karma-browserify": "^1.0.0",
"karma-cli": "0.0.4",
"karma-mocha": "^0.1.9",
"karma-phantomjs-launcher": "^0.1.4",
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/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