move all plugin tests out of babel-core and into their appropriate folders
This commit is contained in:
@@ -12,5 +12,8 @@
|
||||
"babel-helper-function-name": "^6.0.14",
|
||||
"babel-types": "^6.0.14",
|
||||
"babel-runtime": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/.smoke/exec.js
vendored
Normal file
23
packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/.smoke/exec.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var foo = function () {};
|
||||
assert.equal(foo.name, "foo");
|
||||
|
||||
var obj = { foo: function () {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
var obj = { "foo": function () {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
var obj = { foo() {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
var obj = { "foo"() {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
function noop() {}
|
||||
|
||||
var obj = { @noop foo() {} };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
|
||||
|
||||
var obj = { @noop foo: function () { return "foo"; } };
|
||||
assert.equal(obj.foo.name, "foo");
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-decorators"]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
var i = function () {
|
||||
i = 5;
|
||||
};
|
||||
|
||||
var j = function () {
|
||||
({ j } = 5);
|
||||
({ y: j } = 5);
|
||||
;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
var _i = function i() {
|
||||
_i = 5;
|
||||
};
|
||||
|
||||
var _j = function j() {
|
||||
({ j: _j } = 5);
|
||||
({ y: _j } = 5);
|
||||
;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
var g = function () {
|
||||
doSmth();
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
var g = function g() {
|
||||
doSmth();
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
t(t) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
let Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "t",
|
||||
value: function t(_t) {
|
||||
return _t;
|
||||
}
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
@@ -0,0 +1,9 @@
|
||||
var obj = {
|
||||
search: function({search}) {
|
||||
console.log(search);
|
||||
}
|
||||
};
|
||||
|
||||
function search({search}) {
|
||||
console.log(search);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
var obj = {
|
||||
search: function search({ search: _search }) {
|
||||
console.log(_search);
|
||||
}
|
||||
};
|
||||
|
||||
function search({ search }) {
|
||||
console.log(search);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var a = {
|
||||
eval: function () {
|
||||
return eval;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var a = {
|
||||
eval: function _eval() {
|
||||
return eval;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
export var foo = "yes", foob = "no";
|
||||
|
||||
export function whatever() {}
|
||||
|
||||
export default function wowzers() {}
|
||||
|
||||
var bar = {
|
||||
foo: function () {
|
||||
foo;
|
||||
},
|
||||
|
||||
whatever: function () {
|
||||
whatever;
|
||||
},
|
||||
|
||||
wowzers: function () {
|
||||
wowzers;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
export { _whatever as whatever };
|
||||
export { _wowzers as default };
|
||||
var _foo = "yes",
|
||||
foob = "no";
|
||||
|
||||
export { _foo as foo, foob };
|
||||
function _whatever() {}
|
||||
|
||||
function _wowzers() {}
|
||||
|
||||
var bar = {
|
||||
foo: function foo() {
|
||||
_foo;
|
||||
},
|
||||
|
||||
whatever: function whatever() {
|
||||
_whatever;
|
||||
},
|
||||
|
||||
wowzers: function wowzers() {
|
||||
_wowzers;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
function f() {
|
||||
f;
|
||||
}
|
||||
|
||||
{
|
||||
let obj = {
|
||||
f: function () {
|
||||
f;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
(function b() {
|
||||
var obj = {
|
||||
b: function () {
|
||||
b;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
function _f() {
|
||||
_f;
|
||||
}
|
||||
|
||||
{
|
||||
let obj = {
|
||||
f: function f() {
|
||||
_f;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
(function _b() {
|
||||
var obj = {
|
||||
b: function b() {
|
||||
_b;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
var test = {
|
||||
setInterval: function(fn, ms) {
|
||||
setInterval(fn, ms);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
var test = {
|
||||
setInterval: (function (_setInterval) {
|
||||
function setInterval(_x, _x2) {
|
||||
return _setInterval.apply(this, arguments);
|
||||
}
|
||||
|
||||
setInterval.toString = function () {
|
||||
return _setInterval.toString();
|
||||
};
|
||||
|
||||
return setInterval;
|
||||
})(function (fn, ms) {
|
||||
setInterval(fn, ms);
|
||||
})
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import last from "lodash/array/last"
|
||||
|
||||
export default class Container {
|
||||
last(key) {
|
||||
if (!this.has(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return last(this.tokens.get(key))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _last2 = require("lodash/array/last");
|
||||
|
||||
var _last3 = babelHelpers.interopRequireDefault(_last2);
|
||||
|
||||
let Container = (function () {
|
||||
function Container() {
|
||||
babelHelpers.classCallCheck(this, Container);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Container, [{
|
||||
key: "last",
|
||||
value: function last(key) {
|
||||
if (!this.has(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return (0, _last3.default)(this.tokens.get(key));
|
||||
}
|
||||
}]);
|
||||
return Container;
|
||||
})();
|
||||
|
||||
exports.default = Container;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-classes", "transform-decorators", "transform-es2015-modules-commonjs"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import {getForm} from "./store"
|
||||
|
||||
export default class Login extends React.Component {
|
||||
getForm() {
|
||||
return getForm().toJS()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _store = require("./store");
|
||||
|
||||
let Login = (function (_React$Component) {
|
||||
babelHelpers.inherits(Login, _React$Component);
|
||||
|
||||
function Login() {
|
||||
babelHelpers.classCallCheck(this, Login);
|
||||
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Login).apply(this, arguments));
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Login, [{
|
||||
key: "getForm",
|
||||
value: function getForm() {
|
||||
return (0, _store.getForm)().toJS();
|
||||
}
|
||||
}]);
|
||||
return Login;
|
||||
})(React.Component);
|
||||
|
||||
exports.default = Login;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-modules-commonjs", "transform-es2015-classes", "transform-decorators"]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export function foo(bar) {
|
||||
|
||||
}
|
||||
|
||||
var bar = {
|
||||
foo: function () {
|
||||
foo;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export { _foo as foo };
|
||||
function _foo(bar) {}
|
||||
|
||||
var bar = {
|
||||
foo: function foo() {
|
||||
_foo;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import events from "events";
|
||||
|
||||
class Template {
|
||||
events() {
|
||||
return events;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Template().events());
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
var _events2 = require("events");
|
||||
|
||||
var _events3 = babelHelpers.interopRequireDefault(_events2);
|
||||
|
||||
let Template = (function () {
|
||||
function Template() {
|
||||
babelHelpers.classCallCheck(this, Template);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Template, [{
|
||||
key: "events",
|
||||
value: function events() {
|
||||
return _events3.default;
|
||||
}
|
||||
}]);
|
||||
return Template;
|
||||
})();
|
||||
|
||||
console.log(new Template().events());
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-modules-commonjs", "transform-es2015-classes", "transform-decorators"]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
var obj = {
|
||||
f: function () {
|
||||
(function f() {
|
||||
console.log(f);
|
||||
})();
|
||||
},
|
||||
|
||||
h: function () {
|
||||
console.log(h);
|
||||
},
|
||||
|
||||
m: function () {
|
||||
doSmth();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
var obj = {
|
||||
f: function f() {
|
||||
(function f() {
|
||||
console.log(f);
|
||||
})();
|
||||
},
|
||||
|
||||
h: (function (_h) {
|
||||
function h() {
|
||||
return _h.apply(this, arguments);
|
||||
}
|
||||
|
||||
h.toString = function () {
|
||||
return _h.toString();
|
||||
};
|
||||
|
||||
return h;
|
||||
})(function () {
|
||||
console.log(h);
|
||||
}),
|
||||
|
||||
m: function m() {
|
||||
doSmth();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers-2", "transform-es2015-function-name", "transform-es2015-classes", "transform-decorators"]
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
var f = function () {
|
||||
var f = 2;
|
||||
};
|
||||
|
||||
var g = function (g) {
|
||||
g;
|
||||
};
|
||||
|
||||
var obj = {
|
||||
f: function (f) {
|
||||
f;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
var f = function f() {
|
||||
var f = 2;
|
||||
};
|
||||
|
||||
var g = function g(_g) {
|
||||
_g;
|
||||
};
|
||||
|
||||
var obj = {
|
||||
f: function f(_f) {
|
||||
_f;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
var f = function () {
|
||||
console.log(f, g);
|
||||
};
|
||||
|
||||
f = null;
|
||||
@@ -0,0 +1,5 @@
|
||||
var _f = function f() {
|
||||
console.log(_f, g);
|
||||
};
|
||||
|
||||
_f = null;
|
||||
@@ -0,0 +1,20 @@
|
||||
var Utils = {
|
||||
get: function() {}
|
||||
};
|
||||
|
||||
var { get } = Utils;
|
||||
|
||||
var bar = {
|
||||
get: function(arg) {
|
||||
get(arg, "baz");
|
||||
}
|
||||
};
|
||||
|
||||
var f = function ({ foo = "bar" }) {
|
||||
var obj = {
|
||||
// same name as parameter
|
||||
foo: function () {
|
||||
foo;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
var Utils = {
|
||||
get: function get() {}
|
||||
};
|
||||
|
||||
var { get: _get } = Utils;
|
||||
|
||||
var bar = {
|
||||
get: function get(arg) {
|
||||
_get(arg, "baz");
|
||||
}
|
||||
};
|
||||
|
||||
var f = function f({ foo: _foo = "bar" }) {
|
||||
var obj = {
|
||||
// same name as parameter
|
||||
foo: function foo() {
|
||||
_foo;
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
Reference in New Issue
Block a user