wWhen merging options, take precedence over the current array - fixes #2648

This commit is contained in:
Sebastian McKenzie
2015-11-02 19:21:24 +00:00
parent 72f384bb29
commit 2bdc222c0b
2 changed files with 16 additions and 5 deletions

View File

@@ -24,6 +24,15 @@ function transformAsync(code, opts) {
}
suite("api", function () {
test("options merge backwards", function () {
return transformAsync("", {
presets: [__dirname + "/../../babel-preset-es2015"],
plugins: [__dirname + "/../../babel-plugin-syntax-jsx"]
}).then(function (result) {
assert.ok(result.options.plugins[0][0].manipulateOptions.toString().indexOf("jsx") >= 0);
});
});
test("code option false", function () {
return transformAsync("foo('bar');", { code: false }).then(function (result) {
assert.ok(!result.code);