Skip to content
This repository was archived by the owner on Apr 9, 2020. It is now read-only.

Commit ad8fb28

Browse files
committed
Use separate babelrc for each fixture
1 parent 016e412 commit ad8fb28

File tree

5 files changed

+75
-19
lines changed

5 files changed

+75
-19
lines changed

test/fixtures/classic/.babelrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"plugins": ["../../../src"],
3+
"extra": {
4+
"react-transform": {
5+
"transforms": [
6+
{
7+
"transform": "my-custom-module/wrap",
8+
"locals": ["module"],
9+
"imports": ["react"]
10+
},
11+
{
12+
"transform": "my-other-custom-module/wrap"
13+
}
14+
]
15+
}
16+
}
17+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"plugins": ["../../../src"],
3+
"extra": {
4+
"react-transform": {
5+
"transforms": [
6+
{
7+
"transform": "my-custom-module/wrap",
8+
"locals": ["module"],
9+
"imports": ["react"]
10+
},
11+
{
12+
"transform": "my-other-custom-module/wrap"
13+
}
14+
],
15+
"factoryMethods": [
16+
"React.createClass",
17+
"createClass",
18+
"myComponentFactory"
19+
]
20+
}
21+
}
22+
}

test/fixtures/modern/.babelrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"plugins": ["../../../src"],
3+
"extra": {
4+
"react-transform": {
5+
"transforms": [
6+
{
7+
"transform": "my-custom-module/wrap",
8+
"locals": ["module"],
9+
"imports": ["react"]
10+
},
11+
{
12+
"transform": "my-other-custom-module/wrap"
13+
}
14+
]
15+
}
16+
}
17+
}

test/fixtures/vanilla/.babelrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"plugins": ["../../../src"],
3+
"extra": {
4+
"react-transform": {
5+
"transforms": [
6+
{
7+
"transform": "my-custom-module/wrap",
8+
"locals": ["module"],
9+
"imports": ["react"]
10+
},
11+
{
12+
"transform": "my-other-custom-module/wrap"
13+
}
14+
]
15+
}
16+
}
17+
}

test/index.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,8 @@ describe('finds React components', () => {
1414
it(`should ${caseName.split('-').join(' ')}`, () => {
1515
const fixtureDir = path.join(fixturesDir, caseName);
1616
const actualPath = path.join(fixtureDir, 'actual.js');
17-
const actual = transformFileSync(actualPath, {
18-
plugins: [plugin],
19-
extra: {
20-
'react-transform': {
21-
transforms: [{
22-
transform: 'my-custom-module/wrap',
23-
locals: ['module'],
24-
imports: ['react']
25-
}, {
26-
transform: 'my-other-custom-module/wrap'
27-
}],
28-
factoryMethods: [
29-
'React.createClass',
30-
'createClass',
31-
'myComponentFactory'
32-
]
33-
}
34-
}
35-
}).code;
17+
const actual = transformFileSync(actualPath).code;
18+
3619
const expected = fs.readFileSync(
3720
path.join(fixtureDir, 'expected.js')
3821
).toString().replace(/%FIXTURE_PATH%/g, actualPath);

0 commit comments

Comments
 (0)