Add test cases for bad options in babel-preset-es2015 (#5720)

* Added testcases for bad 'spec' or 'module' option

* Corrected typo in test description
This commit is contained in:
Mauro Bringolf
2017-05-14 16:21:37 +02:00
committed by Henry Zhu
parent 486563152c
commit ce6f67216e

View File

@@ -18,6 +18,14 @@ describe("es2015 preset", function () {
});
});
describe("spec", function () {
it("throws on non-boolean value", function () {
expect(function () {
es2015(null, { spec: 1 });
}).to.throw(/must be a boolean/);
});
});
describe("modules", function () {
it("doesn't throw when passing one false", function () {
expect(function () {
@@ -42,6 +50,12 @@ describe("es2015 preset", function () {
es2015(null, { modules: "systemjs" });
}).not.to.throw();
});
it("throws when passing neither false nor one of: 'commonjs', 'amd', 'umd', 'systemjs'", function () {
expect(function () {
es2015(null, { modules: 1 });
}).to.throw();
});
});
});
});