Merge pull request #3362 from hzoo/err-babel-5-plugin

Show a better error when trying to use a babel 5 plugin
This commit is contained in:
Henry Zhu 2016-02-22 19:40:52 -05:00
commit 54a064b970
2 changed files with 24 additions and 0 deletions

View File

@ -26,6 +26,10 @@ export { traverse };
import OptionManager from "../transformation/file/options/option-manager";
export { OptionManager };
export function Plugin(alias) {
throw new Error(`The (${alias}) Babel 5 plugin is being run with Babel 6.`);
}
//
import Pipeline from "../transformation/pipeline";

View File

@ -0,0 +1,20 @@
var assert = require("assert");
var OptionManager = require("../lib/transformation/file/options/option-manager");
suite("option-manager", function () {
suite("memoisePluginContainer", function () {
test("throws for babel 5 plugin", function() {
return assert.throws(
function () {
OptionManager.memoisePluginContainer(
function (ref) {
var Plugin = ref.Plugin;
return new Plugin("object-assign", {});
}
);
},
/Babel 5 plugin is being run with Babel 6/
);
})
});
});