Browse Source

don't load .babelrc on tests (#33)

add-plugins-support
Naoyuki Kanezawa 8 years ago
committed by Guillermo Rauch
parent
commit
0777c36439
  1. 22
      test/fixtures/absent.out.js
  2. 58
      test/fixtures/class.out.js
  3. 22
      test/fixtures/global.out.js
  4. 52
      test/fixtures/stateless.out.js
  5. 52
      test/fixtures/whitespace.out.js
  6. 9
      test/index.js

22
test/fixtures/absent.out.js

@ -1,18 +1,4 @@
'use strict';
var a = function a() {
return React.createElement(
'div',
null,
React.createElement(
'p',
null,
'hi'
),
React.createElement(
'style',
null,
'woot'
)
);
};
const a = () => <div>
<p>hi</p>
<style>{'woot'}</style>
</div>;

58
test/fixtures/class.out.js

@ -1,51 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require("babel-runtime/helpers/createClass");
var _createClass3 = _interopRequireDefault(_createClass2);
var _style = require("styled-jsx/style");
var _style2 = _interopRequireDefault(_style);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _class = function () {
function _class() {
(0, _classCallCheck3.default)(this, _class);
import _JSXStyle from "styled-jsx/style";
export default class {
render() {
return <div data-jsx={"1891769468"}>
<p data-jsx={"1891769468"}>test</p>
<_JSXStyle css={"p[data-jsx=\"1891769468\"] {color: red;}"} data-jsx={"1891769468"} />
</div>;
}
(0, _createClass3.default)(_class, [{
key: "render",
value: function render() {
return React.createElement(
"div",
{
"data-jsx": "1891769468"
},
React.createElement(
"p",
{
"data-jsx": "1891769468"
},
"test"
),
React.createElement(_style2.default, {
css: "p[data-jsx=\"1891769468\"] {color: red;}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNsYXNzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1vQixBQUNQLDBCQUNVLFdBQ1oiLCJmaWxlIjoiY2xhc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBjbGFzcyB7XG5cbiAgcmVuZGVyICgpIHtcbiAgICByZXR1cm4gKFxuICAgICAgPGRpdj5cbiAgICAgICAgPHA+dGVzdDwvcD5cbiAgICAgICAgPHN0eWxlIGpzeD57YFxuICAgICAgICAgIHAge1xuICAgICAgICAgICAgY29sb3I6IHJlZDtcbiAgICAgICAgICB9XG4gICAgICAgIGB9PC9zdHlsZT5cbiAgICAgIDwvZGl2PlxuICAgIClcbiAgfVxuXG59XG4iXX0= */\n/*@ sourceURL=class.js */",
"data-jsx": "1891769468"
})
);
}
}]);
return _class;
}();
exports.default = _class;
}

22
test/fixtures/global.out.js

@ -1,18 +1,4 @@
"use strict";
var _style = require("styled-jsx/style");
var _style2 = _interopRequireDefault(_style);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
React.createElement(
"div",
{
"data-jsx": "3367785191"
},
React.createElement(_style2.default, {
css: "\n body {\n color: red\n }\n ",
"data-jsx": "3367785191"
})
);
import _JSXStyle from "styled-jsx/style";
<div data-jsx={"3367785191"}>
<_JSXStyle css={"\n body {\n color: red\n }\n "} data-jsx={"3367785191"} />
</div>;

52
test/fixtures/stateless.out.js

@ -1,45 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _style = require('styled-jsx/style');
var _style2 = _interopRequireDefault(_style);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function () {
return React.createElement(
'div',
{
'data-jsx': '188072295'
},
React.createElement(
'p',
{
'data-jsx': '188072295'
},
'test'
),
React.createElement(
'p',
{
'data-jsx': '188072295'
},
'woot'
),
React.createElement(
'p',
{
'data-jsx': '188072295'
},
'woot'
),
React.createElement(_style2.default, {
css: 'p[data-jsx="188072295"] {color: red }\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0YXRlbGVzcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLZ0IsQUFBRSx5QkFBYSIsImZpbGUiOiJzdGF0ZWxlc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCAoKSA9PiAoXG4gIDxkaXY+XG4gICAgPHA+dGVzdDwvcD5cbiAgICA8cD53b290PC9wPlxuICAgIDxwPndvb3Q8L3A+XG4gICAgPHN0eWxlIGpzeD57J3AgeyBjb2xvcjogcmVkIH0nfTwvc3R5bGU+XG4gIDwvZGl2PlxuKVxuIl19 */\n/*@ sourceURL=stateless.js */',
'data-jsx': '188072295'
})
);
};
import _JSXStyle from 'styled-jsx/style';
export default (() => <div data-jsx={"188072295"}>
<p data-jsx={"188072295"}>test</p>
<p data-jsx={"188072295"}>woot</p>
<p data-jsx={"188072295"}>woot</p>
<_JSXStyle css={"p[data-jsx=\"188072295\"] {color: red }"} data-jsx={"188072295"} />
</div>);

52
test/fixtures/whitespace.out.js

@ -1,45 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _style = require('styled-jsx/style');
var _style2 = _interopRequireDefault(_style);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function () {
return React.createElement(
'div',
{
'data-jsx': '188072295'
},
React.createElement(
'p',
{
'data-jsx': '188072295'
},
'test'
),
React.createElement(
'p',
{
'data-jsx': '188072295'
},
'woot'
),
React.createElement(
'p',
{
'data-jsx': '188072295'
},
'woot'
),
React.createElement(_style2.default, {
css: 'p[data-jsx="188072295"] {color: red }\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndoaXRlc3BhY2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT1EsQUFBRSx5QkFBYSIsImZpbGUiOiJ3aGl0ZXNwYWNlLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgKCkgPT4gKFxuICA8ZGl2PlxuICAgIDxwPnRlc3Q8L3A+XG4gICAgPHA+d29vdDwvcD5cbiAgICA8cD53b290PC9wPlxuICAgIDxzdHlsZSBqc3g+XG4gICAgICB7XG4gICAgICAgICdwIHsgY29sb3I6IHJlZCB9J1xuICAgICAgfVxuICAgIDwvc3R5bGU+XG4gIDwvZGl2PlxuKVxuXG4iXX0= */\n/*@ sourceURL=whitespace.js */',
'data-jsx': '188072295'
})
);
};
import _JSXStyle from 'styled-jsx/style';
export default (() => <div data-jsx={"188072295"}>
<p data-jsx={"188072295"}>test</p>
<p data-jsx={"188072295"}>woot</p>
<p data-jsx={"188072295"}>woot</p>
<_JSXStyle css={"p[data-jsx=\"188072295\"] {color: red }"} data-jsx={"188072295"} />
</div>);

9
test/index.js

@ -4,6 +4,7 @@ import path from 'path'
// Packages
import test from 'ava'
import {transformFile} from 'babel-core'
import {writeFile} from 'mz/fs'
// Ours
import plugin from '../src/babel'
@ -12,11 +13,9 @@ import read from './_read'
const transform = file => (
new Promise((resolve, reject) => {
transformFile(path.resolve(__dirname, file), {
sourceMap: true,
plugins: [
'transform-runtime',
plugin
]
babelrc: false,
plugins: [plugin],
sourceMaps: false
}, (err, data) => {
if (err) {
return reject(err)

Loading…
Cancel
Save