Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tests to use babel 6 #1

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
},
"homepage": "https://github.com/gaearon/babel-plugin-react-transform#readme",
"devDependencies": {
"babel": "^5.8.23",
"babel-cli": "^6.1.1",
"babel-core": "^6.0.0",
"babel-preset-es2015": "^6.0.15",
"mocha": "^2.2.5",
"rimraf": "^2.4.3"
},
"scripts": {
"clean": "rimraf lib",
"build": "babel-plugin build",
"test": "mocha --compilers js:babel/register",
"build": "babel src --out-dir lib --copy-files",
"test": "mocha --compilers js:babel-core/register",
"test:watch": "npm run test -- --watch",
"prepublish": "npm run clean && npm run build"
},
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default function ({ types: t }) {
const wrapReactComponentId = this.state[wrapComponentIdKey];
const uniqueId = addComponentRecord(node, scope, file, this.state);

return t.callExpression(
t.callExpression(
t.callExpression(wrapReactComponentId, [t.stringLiteral(uniqueId)]),
[node]
);
Expand Down Expand Up @@ -278,7 +278,7 @@ export default function ({ types: t }) {
// Create one uber function calling each transformation
const wrapComponentId = this.state[wrapComponentIdKey];
const wrapComponent = defineWrapComponent(wrapComponentId, initTransformIds);
return t.program([
t.program([
recordsVar,
...initTransformVars,
wrapComponent,
Expand Down
10 changes: 5 additions & 5 deletions test/fixtures/classic/.babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"plugins": ["../../../src"],
"extra": {
"react-transform": {
"presets": ["es2015"],
"plugins": [
["../../../src", {
"transforms": [{
"transform": "my-custom-module/wrap",
"locals": ["module"],
"imports": ["react"]
}, {
"transform": "my-other-custom-module/wrap"
}]
}
}
}]
]
}
10 changes: 5 additions & 5 deletions test/fixtures/customFactoryMethod/.babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"plugins": ["../../../src"],
"extra": {
"react-transform": {
"presets": ["es2015"],
"plugins": [
["../../../src", {
"transforms": [{
"transform": "my-custom-module/wrap",
"locals": ["module"],
Expand All @@ -14,6 +14,6 @@
"createClass",
"myComponentFactory"
]
}
}
}]
]
}
10 changes: 5 additions & 5 deletions test/fixtures/modern/.babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"plugins": ["../../../src"],
"extra": {
"react-transform": {
"presets": ["es2015"],
"plugins": [
["../../../src", {
"transforms": [{
"transform": "my-custom-module/wrap",
"locals": ["module"],
"imports": ["react"]
}, {
"transform": "my-other-custom-module/wrap"
}]
}
}
}]
]
}
11 changes: 6 additions & 5 deletions test/fixtures/vanilla/.babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"plugins": ["../../../src"],
"extra": {
"react-transform": {
"presets": ["es2015"],
"plugins": [
["../../../src", {
"transforms": [{
"transform": "my-custom-module/wrap",
"locals": ["module"],
"imports": ["react"]
}, {
"transform": "my-other-custom-module/wrap"
}]
}
}

}]
]
}
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';
import fs from 'fs';
import assert from 'assert';
import { transformFileSync } from 'babel';
import { transformFileSync } from 'babel-core';
import plugin from '../src';

function trim(str) {
Expand Down