update tests to reflect new whitelist by default model

This commit is contained in:
Sebastian McKenzie
2015-09-05 20:02:36 +01:00
parent 3b301c88da
commit 3720174a32
511 changed files with 293 additions and 1227 deletions

View File

@@ -1,3 +1 @@
{
"breakConfig": true
}
{}

View File

@@ -16,6 +16,13 @@ exports.fixtures = getFixtures(__dirname + "/fixtures", function () {
require("babel-polyfill");
require("../register")({
ignore: [
path.resolve(__dirname + "/../.."),
"node_modules"
]
});
eval(buildExernalHelpers());
global.assertNoOwnProperties = function (obj) {
@@ -56,11 +63,17 @@ var run = function (task, done) {
var opts = task.options;
var getOpts = function (self) {
return _.merge({
var newOpts = _.merge({
suppressDeprecationMessages: true,
filename: self.loc,
sourceMap: !!(task.sourceMappings || task.sourceMap)
}, opts);
newOpts.plugins = (newOpts.plugins || []).map(function (str) {
return __dirname + "/../../babel-plugin-" + str;
});
return newOpts;
};
var execCode = exec.code;

View File

@@ -1,8 +1,6 @@
require("../lib/api/node");
var buildExternalHelpers = require("../lib/tools/build-external-helpers");
var PluginManager = require("../lib/transformation/file/plugin-manager");
var Transformer = require("../lib/transformation/transformer");
var transform = require("../lib/transformation");
var Pipeline = require("../lib/transformation/pipeline");
var assert = require("assert");
@@ -447,40 +445,4 @@ suite("api", function () {
assert.ok(script.indexOf("inherits") === -1);
});
});
suite("plugins", function () {
test("unknown plugin", function () {
assert.throws(function () {
new PluginManager().subnormaliseString("foo bar");
}, /Unknown plugin/);
});
test("key collision", function () {
assert.throws(function () {
new PluginManager({
transformers: { "es6.arrowFunctions": true }
}).validate("foobar", { key: "es6.arrowFunctions" });
}, /collides with another/);
});
test("not transformer", function () {
assert.throws(function () {
new PluginManager().validate("foobar", {});
}, /didn't export a Plugin instance/);
assert.throws(function () {
new PluginManager().validate("foobar", "");
}, /didn't export a Plugin instance/);
assert.throws(function () {
new PluginManager().validate("foobar", []);
}, /didn't export a Plugin instance/);
});
test("object request");
test("string request");
test("transformer request");
});
});

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-es2015-arrow-functions"]
}

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-es2015-computed-properties"]
}

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-es2015-template-literals"]
}

View File

@@ -1,9 +1,7 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Test = function Test() {
_classCallCheck(this, Test);
arr.map(x => x * x);
};
};

View File

@@ -1,3 +0,0 @@
{
"blacklist": ["es6.arrowFunctions"]
}

View File

@@ -1,4 +0,0 @@
{
"throws": "Unknown transformer arrowFunctions2 specified in whitelist",
"whitelist": ["arrowFunctions2"]
}

View File

@@ -1,3 +0,0 @@
{
"whitelist": ["es6.arrowFunctions"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);

View File

@@ -1,5 +1,3 @@
"use strict";
var foo = babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
});
});

View File

@@ -1,5 +1,3 @@
"use strict";
var _bar;
var foo = _bar = babelHelpers.asyncToGenerator(function* () {

View File

@@ -1,4 +1,3 @@
{
"externalHelpers": true,
"optional": ["asyncToGenerator"]
"plugins": ["external-helpers", "transform-async-to-generator"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var foo = babelHelpers.asyncToGenerator(function* () {
var wat = yield bar();
});
});

View File

@@ -1,5 +1,3 @@
"use strict";
var _bluebird = require("bluebird");
var Foo = (function () {

View File

@@ -1,3 +1,3 @@
{
"externalHelpers": true
"plugins": ["external-helpers"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var _bluebird = require("bluebird");
var foo = _bluebird.coroutine(function* () {

View File

@@ -1,5 +1,3 @@
"use strict";
var _bluebird = require("bluebird");
var _bar;

View File

@@ -1,3 +1,3 @@
{
"optional": ["bluebirdCoroutines"]
"plugins": ["transform-bluebird-coroutines"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var _bluebird = require("bluebird");
var foo = _bluebird.coroutine(function* () {

View File

@@ -1,5 +1,3 @@
"use strict";
test["catch"];
test["catch"].foo;
test["catch"];

View File

@@ -1,5 +1,3 @@
"use strict";
var obj = {
"test": "foob",
"!@#$": "foob",

View File

@@ -1,5 +1,3 @@
"use strict";
var obj = Object.defineProperties({}, {
foo: {
get: function get() {
@@ -11,4 +9,4 @@ var obj = Object.defineProperties({}, {
configurable: true,
enumerable: true
}
});
});

View File

@@ -1,5 +1,3 @@
"use strict";
var obj = Object.defineProperties({}, {
foo: {
get: function get() {
@@ -8,4 +6,4 @@ var obj = Object.defineProperties({}, {
configurable: true,
enumerable: true
}
});
});

View File

@@ -1,5 +1,3 @@
"use strict";
var obj = Object.defineProperties({}, {
foo: {
set: function set(value) {
@@ -8,4 +6,4 @@ var obj = Object.defineProperties({}, {
configurable: true,
enumerable: true
}
});
});

View File

@@ -1,9 +1,7 @@
"use strict";
function one() {
var _arguments = arguments;
var inner = function inner() {
var inner = function () {
return _arguments;
};
return [].slice.call(inner());
@@ -13,14 +11,14 @@ one(1, 2);
function two() {
var _arguments2 = arguments;
var inner = function inner() {
var inner = function () {
return _arguments2;
};
var another = function another() {
var another = function () {
var _arguments3 = arguments;
var inner2 = function inner2() {
var inner2 = function () {
return _arguments3;
};
};
@@ -32,7 +30,7 @@ two(1, 2);
function three() {
var _arguments4 = arguments;
var fn = function fn() {
var fn = function () {
return _arguments4[0] + "bar";
};
return fn();
@@ -42,7 +40,7 @@ three("foo");
function four() {
var _arguments5 = arguments;
var fn = function fn() {
var fn = function () {
return _arguments5[0].foo + "bar";
};
return fn();
@@ -50,7 +48,7 @@ function four() {
four({ foo: "foo" });
function five(obj) {
var fn = function fn() {
var fn = function () {
return obj.arguments[0].foo + "bar";
};
return fn();
@@ -58,8 +56,8 @@ function five(obj) {
five({ arguments: ["foo"] });
function six(obj) {
var fn = function fn() {
var fn2 = function fn2() {
var fn = function () {
var fn2 = function () {
return arguments[0];
};
return fn2("foobar");

View File

@@ -1,9 +1,7 @@
"use strict";
var some = function some() {
var count = arguments.length <= 0 || arguments[0] === undefined ? "30" : arguments[0];
console.log("count", count);
};
some();
some();

View File

@@ -1,7 +1,5 @@
"use strict";
var a = function a(_ref) {
var target = _ref.target;
var a = function (_ref) {
let target = _ref.target;
return console.log(target);
};
a({ target: "I am a target" });

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-es2015-destructuring", "transform-es2015-arrow-functions"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var t = function t() {
var t = function () {
return 5 + 5;
};

View File

@@ -1,3 +1 @@
"use strict";
var t = function t() {};
var t = function () {};

View File

@@ -1,5 +1,3 @@
"use strict";
arr.map(function (x) {
return x * x;
});

View File

@@ -1,5 +1,3 @@
"use strict";
arr.map(function (i) {
return i + 1;
});

View File

@@ -1,5 +1,3 @@
"use strict";
var t = function t(i, x) {
var t = function (i, x) {
return i * x;
};

View File

@@ -1,7 +1,5 @@
"use strict";
module.exports = {
init: function init() {
init: function () {
var _this = this;
return new Promise(function (resolve, reject) {

View File

@@ -1,3 +1,3 @@
{
"blacklist": ["es6.tailCall"]
}
{
"plugins": ["transform-es2015-arrow-functions"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var t = function t(i) {
var t = function (i) {
return i * 5;
};

View File

@@ -1,5 +1,3 @@
"use strict";
var t = function t(i) {
var t = function (i) {
return i * 5;
};

View File

@@ -1,5 +1,3 @@
"use strict";
function foo() {
var _this = this;

View File

@@ -1,4 +1,4 @@
{
"externalHelpers": true,
"plugins": ["external-helpers"],
"optional": ["es6.spec.arrowFunctions"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
nums.forEach(function (v) {
if (v % 5 === 0) {
fives.push(v);

View File

@@ -1,9 +1,7 @@
"use strict";
function b() {
var _this = this;
var t = function t(x) {
var t = function (x) {
return _this.x + x;
};
}

View File

@@ -1,5 +1,3 @@
"use strict";
var foo = "foo";
function foobar() {

View File

@@ -1,5 +1,3 @@
"use strict";
(function () {
var _loop = function (i) {
fns.push(function () {
@@ -30,4 +28,4 @@
if (typeof _ret === "object") return _ret.v;
}
}
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var _loop = function (i) {
fns.push(function () {
return i;
@@ -11,4 +9,4 @@ for (var i in nums) {
var _ret = _loop(i);
if (_ret === "break") break;
}
}

View File

@@ -1,5 +1,3 @@
"use strict";
var _loop = function (_i) {
(function () {
_i;
@@ -11,4 +9,4 @@ var _loop = function (_i) {
for (var i = 0; i < 2; i++) {
_loop(i);
}
}

View File

@@ -1,5 +1,3 @@
"use strict";
var _loop = function (i) {
fns.push(function () {
return i;
@@ -11,4 +9,4 @@ for (var i in nums) {
var _ret = _loop(i);
if (_ret === "continue") continue;
}
}

View File

@@ -1,5 +1,3 @@
"use strict";
(function () {
var _loop = function (i) {
fns.push(function () {
@@ -15,4 +13,4 @@
if (typeof _ret === "object") return _ret.v;
}
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
(function () {
var _loop = function (i) {
fns.push(function () {
@@ -15,4 +13,4 @@
if (typeof _ret === "object") return _ret.v;
}
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
function test() {
var foo = "bar";
}

View File

@@ -1,5 +1,3 @@
"use strict";
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;

View File

@@ -1,5 +1,3 @@
"use strict";
foo.func1 = function () {
if (cond1) {
for (;;) {
@@ -19,4 +17,4 @@ foo.func1 = function () {
}
}
}
};
};

View File

@@ -1,5 +1,3 @@
"use strict";
if (true) {
var x;

View File

@@ -1,5 +1,3 @@
"use strict";
var arr = [];
for (var i = 0; i < 10; i++) {
var _loop = function (_i) {
@@ -11,4 +9,4 @@ for (var i = 0; i < 10; i++) {
for (var _i = 0; _i < 10; _i++) {
_loop(_i);
}
}
}

View File

@@ -1,7 +1,5 @@
// #1683
"use strict";
var arr = [];
for (var i = 0; i < 4; ++i) {
arr.push(React.createElement("i", null));

View File

@@ -1,5 +1,3 @@
"use strict";
while (value) {
var foo = undefined;

View File

@@ -1,3 +1 @@
"use strict";
var test = "foo";

View File

@@ -1,5 +1,3 @@
"use strict";
var a = true;
var b = false;

View File

@@ -1,5 +1,3 @@
"use strict";
var a = 1;
var _loop = function (_a) {
@@ -11,4 +9,4 @@ var _loop = function (_a) {
for (var _a = 1; _a < 100; _a++) {
_loop(_a);
}
console.log(a);
console.log(a);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,5 +1,3 @@
"use strict";
var x = (function () {
x.prototype.f = function f() {
1;

View File

@@ -1,5 +1,3 @@
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);

View File

@@ -1,5 +1,3 @@
{
"externalHelpers": true,
"loose": ["es6.classes"],
"blacklist": ["es6.tailCall"]
"plugins": ["external-helpers", ["transform-es2015-classes", { "loose": true }]]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var BaseController = (function (_Chaplin$Controller) {
babelHelpers.inherits(BaseController, _Chaplin$Controller);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,7 +1,5 @@
"use strict";
var Test = function Test() {
babelHelpers.classCallCheck(this, Test);
Function.prototype.hasOwnProperty.call(this, "test");
};
};

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,3 +0,0 @@
{
"blacklist": ["es6.tailCall"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
@@ -19,4 +17,4 @@ var Foo = (function () {
value: function value() {}
}]);
return Foo;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var Example = function Example() {
babelHelpers.classCallCheck(this, Example);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = function Test() {
babelHelpers.classCallCheck(this, Test);

View File

@@ -1,5 +1,3 @@
"use strict";
var Foo = (function (_Bar) {
babelHelpers.inherits(Foo, _Bar);

View File

@@ -1,5 +1,3 @@
"use strict";
var Foo = (function (_Bar) {
babelHelpers.inherits(Foo, _Bar);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
@@ -15,4 +13,4 @@ var Test = (function () {
}
}]);
return Test;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
@@ -12,4 +10,4 @@ var Test = (function () {
}
}]);
return Test;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function () {
function Test() {
babelHelpers.classCallCheck(this, Test);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function () {
function Test() {
babelHelpers.classCallCheck(this, Test);
@@ -12,4 +10,4 @@ var Test = (function () {
}
}]);
return Test;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var _a2 = require("./a");
var Foo = (function () {

View File

@@ -1,3 +1,3 @@
{
"externalHelpers": true
"plugins": ["external-helpers", "transform-es2015-classes"]
}

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = function Test() {
babelHelpers.classCallCheck(this, Test);
};
};

View File

@@ -1,5 +1,3 @@
"use strict";
var MyCtrl = function MyCtrl(a) {
"any directive prologue";
babelHelpers.classCallCheck(this, MyCtrl);

View File

@@ -1,7 +1,5 @@
// #1649
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
@@ -15,4 +13,4 @@ var Foo = (function () {
value: function value() {}
}]);
return Foo;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var BaseView = function BaseView() {
babelHelpers.classCallCheck(this, BaseView);
@@ -24,4 +22,4 @@ var BaseView = (function () {
}
}]);
return BaseView;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var A = (function () {
function A() {
babelHelpers.classCallCheck(this, A);
@@ -14,4 +12,4 @@ var A = (function () {
set: function set(b) {}
}]);
return A;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
@@ -8,4 +6,4 @@ var Foo = (function () {
}
return Foo;
})();
})();

View File

@@ -1,5 +1,3 @@
"use strict";
var TestEmpty = (function (_ref) {
babelHelpers.inherits(TestEmpty, _ref);

View File

@@ -1,5 +1,3 @@
"use strict";
var BaseController = (function (_Chaplin$Controller) {
babelHelpers.inherits(BaseController, _Chaplin$Controller);

View File

@@ -1,5 +1,3 @@
"use strict";
var Test = (function (_Foo) {
babelHelpers.inherits(Test, _Foo);

View File

@@ -1,7 +1,5 @@
"use strict";
var Test = function Test() {
babelHelpers.classCallCheck(this, Test);
babelHelpers.get(Object.getPrototypeOf(Test.prototype), "hasOwnProperty", this).call(this, "test");
};
};

View File

@@ -1,5 +1,3 @@
"use strict";
for (var i in arr) {
var MULTIPLIER = 5;
console.log(arr[i] * MULTIPLIER);

View File

@@ -1,5 +1,3 @@
"use strict";
var a = 1;
var b = 2;
var c = 3;

View File

@@ -1,4 +1,2 @@
"use strict";
var x = {};
x.key = "value";

View File

@@ -1,5 +1,3 @@
"use strict";
var MULTIPLIER = 5;
for (var i in arr) {

View File

@@ -0,0 +1,4 @@
var foo = 1;
(function () {
throw new TypeError("\"foo\" is read-only");
})();

Some files were not shown because too many files have changed in this diff Show More