Skip to content

Commit 366e5d3

Browse files
Jack Zhaoiansu
Jack Zhao
authored andcommitted
[internal] Separate out kitchensink test into two (facebook#4767)
* support scoped packages for cra --scripts-version option * seperate out kitchensink test * add eject to node 6 testing * travis node 6 eject * fix CI warnings
1 parent 706b319 commit 366e5d3

File tree

8 files changed

+249
-75
lines changed

8 files changed

+249
-75
lines changed

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,21 @@ script:
1414
- 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi'
1515
- 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi'
1616
- 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi'
17+
- 'if [ $TEST_SUITE = "kitchensink-eject" ]; then tasks/e2e-kitchensink-eject.sh; fi'
1718
- 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi'
1819
- 'if [ $TEST_SUITE = "monorepos" ]; then tasks/e2e-monorepos.sh; fi'
1920
env:
2021
matrix:
2122
- TEST_SUITE=simple
2223
- TEST_SUITE=installs
2324
- TEST_SUITE=kitchensink
25+
- TEST_SUITE=kitchensink-eject
2426
- TEST_SUITE=monorepos
2527
matrix:
2628
include:
2729
- node_js: 0.10
2830
env: TEST_SUITE=old-node
2931
- node_js: 6
3032
env: TEST_SUITE=kitchensink
33+
- node_js: 6
34+
env: TEST_SUITE=kitchensink-eject

appveyor.yml

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ environment:
88
test_suite: "installs"
99
- nodejs_version: 8
1010
test_suite: "kitchensink"
11+
- nodejs_version: 8
12+
test_suite: "kitchensink-eject"
1113
- nodejs_version: 8
1214
test_suite: "monorepos"
1315
- nodejs_version: 6
@@ -16,6 +18,8 @@ environment:
1618
test_suite: "installs"
1719
- nodejs_version: 6
1820
test_suite: "kitchensink"
21+
- nodejs_version: 6
22+
test_suite: "kitchensink-eject"
1923
- nodejs_version: 6
2024
test_suite: "monorepos"
2125
cache:

packages/react-scripts/fixtures/kitchensink/integration/env.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ describe('Integration', () => {
3535
'x-from-development-env'
3636
);
3737
}
38+
doc.defaultView.close();
3839
});
3940

4041
it('NODE_PATH', async () => {
@@ -43,6 +44,7 @@ describe('Integration', () => {
4344
expect(
4445
doc.getElementById('feature-node-path').childElementCount
4546
).to.equal(4);
47+
doc.defaultView.close();
4648
});
4749

4850
it('PUBLIC_URL', async () => {
@@ -58,6 +60,7 @@ describe('Integration', () => {
5860
expect(
5961
doc.querySelector('head link[rel="shortcut icon"]').getAttribute('href')
6062
).to.equal(`${prefix}/favicon.ico`);
63+
doc.defaultView.close();
6164
});
6265

6366
it('shell env variables', async () => {
@@ -66,6 +69,7 @@ describe('Integration', () => {
6669
expect(
6770
doc.getElementById('feature-shell-env-variables').textContent
6871
).to.equal('fromtheshell.');
72+
doc.defaultView.close();
6973
});
7074

7175
it('expand .env variables', async () => {
@@ -83,6 +87,7 @@ describe('Integration', () => {
8387
expect(
8488
doc.getElementById('feature-expand-env-existing').textContent
8589
).to.equal('fromtheshell');
90+
doc.defaultView.close();
8691
});
8792
});
8893
});

packages/react-scripts/fixtures/kitchensink/integration/initDOM.js

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default feature =>
6262
created: (_, win) =>
6363
win.addEventListener('ReactFeatureDidMount', () => resolve(doc), true),
6464
deferClose: true,
65+
pretendToBeVisual: true,
6566
resourceLoader,
6667
url: `${host}#${feature}`,
6768
virtualConsole: jsdom.createVirtualConsole().sendTo(console),

packages/react-scripts/fixtures/kitchensink/integration/syntax.test.js

+15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('Integration', () => {
1616
expect(
1717
doc.getElementById('feature-array-destructuring').childElementCount
1818
).to.equal(4);
19+
doc.defaultView.close();
1920
});
2021

2122
it('array spread', async () => {
@@ -24,6 +25,7 @@ describe('Integration', () => {
2425
expect(
2526
doc.getElementById('feature-array-spread').childElementCount
2627
).to.equal(4);
28+
doc.defaultView.close();
2729
});
2830

2931
it('async/await', async () => {
@@ -32,6 +34,7 @@ describe('Integration', () => {
3234
expect(
3335
doc.getElementById('feature-async-await').childElementCount
3436
).to.equal(4);
37+
doc.defaultView.close();
3538
});
3639

3740
it('class properties', async () => {
@@ -40,6 +43,7 @@ describe('Integration', () => {
4043
expect(
4144
doc.getElementById('feature-class-properties').childElementCount
4245
).to.equal(4);
46+
doc.defaultView.close();
4347
});
4448

4549
it('computed properties', async () => {
@@ -48,6 +52,7 @@ describe('Integration', () => {
4852
expect(
4953
doc.getElementById('feature-computed-properties').childElementCount
5054
).to.equal(4);
55+
doc.defaultView.close();
5156
});
5257

5358
it('custom interpolation', async () => {
@@ -56,6 +61,7 @@ describe('Integration', () => {
5661
expect(
5762
doc.getElementById('feature-custom-interpolation').childElementCount
5863
).to.equal(4);
64+
doc.defaultView.close();
5965
});
6066

6167
it('default parameters', async () => {
@@ -64,6 +70,7 @@ describe('Integration', () => {
6470
expect(
6571
doc.getElementById('feature-default-parameters').childElementCount
6672
).to.equal(4);
73+
doc.defaultView.close();
6774
});
6875

6976
it('destructuring and await', async () => {
@@ -72,6 +79,7 @@ describe('Integration', () => {
7279
expect(
7380
doc.getElementById('feature-destructuring-and-await').childElementCount
7481
).to.equal(4);
82+
doc.defaultView.close();
7583
});
7684

7785
it('generators', async () => {
@@ -80,6 +88,7 @@ describe('Integration', () => {
8088
expect(
8189
doc.getElementById('feature-generators').childElementCount
8290
).to.equal(4);
91+
doc.defaultView.close();
8392
});
8493

8594
it('object destructuring', async () => {
@@ -88,6 +97,7 @@ describe('Integration', () => {
8897
expect(
8998
doc.getElementById('feature-object-destructuring').childElementCount
9099
).to.equal(4);
100+
doc.defaultView.close();
91101
});
92102

93103
it('object spread', async () => {
@@ -96,6 +106,7 @@ describe('Integration', () => {
96106
expect(
97107
doc.getElementById('feature-object-spread').childElementCount
98108
).to.equal(4);
109+
doc.defaultView.close();
99110
});
100111

101112
it('promises', async () => {
@@ -104,6 +115,7 @@ describe('Integration', () => {
104115
expect(doc.getElementById('feature-promises').childElementCount).to.equal(
105116
4
106117
);
118+
doc.defaultView.close();
107119
});
108120

109121
it('rest + default', async () => {
@@ -112,6 +124,7 @@ describe('Integration', () => {
112124
expect(
113125
doc.getElementById('feature-rest-and-default').childElementCount
114126
).to.equal(4);
127+
doc.defaultView.close();
115128
});
116129

117130
it('rest parameters', async () => {
@@ -120,6 +133,7 @@ describe('Integration', () => {
120133
expect(
121134
doc.getElementById('feature-rest-parameters').childElementCount
122135
).to.equal(4);
136+
doc.defaultView.close();
123137
});
124138

125139
it('template interpolation', async () => {
@@ -128,6 +142,7 @@ describe('Integration', () => {
128142
expect(
129143
doc.getElementById('feature-template-interpolation').childElementCount
130144
).to.equal(4);
145+
doc.defaultView.close();
131146
});
132147
});
133148
});

packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js

+46-25
Original file line numberDiff line numberDiff line change
@@ -11,63 +11,75 @@ import url from 'url';
1111

1212
const matchCSS = (doc, regexes) => {
1313
if (process.env.E2E_FILE) {
14-
const elements = doc.getElementsByTagName('link');
15-
let href = "";
16-
for (const elem of elements) {
17-
if (elem.rel === 'stylesheet') {
18-
href = elem.href;
19-
}
14+
const elements = doc.getElementsByTagName('link');
15+
let href = '';
16+
for (const elem of elements) {
17+
if (elem.rel === 'stylesheet') {
18+
href = elem.href;
2019
}
21-
resourceLoader(
22-
{ url: url.parse(href) },
23-
(_, textContent) => {
24-
for (const regex of regexes) {
25-
expect(textContent).to.match(regex);
26-
}
27-
}
28-
);
29-
20+
}
21+
resourceLoader({ url: url.parse(href) }, (_, textContent) => {
22+
for (const regex of regexes) {
23+
expect(textContent).to.match(regex);
24+
}
25+
});
3026
} else {
3127
for (let i = 0; i < regexes.length; ++i) {
32-
expect(doc.getElementsByTagName('style')[i].textContent.replace(/\s/g, '')).to.match(regexes[i]);
28+
expect(
29+
doc.getElementsByTagName('style')[i].textContent.replace(/\s/g, '')
30+
).to.match(regexes[i]);
3331
}
3432
}
35-
}
33+
};
3634

3735
describe('Integration', () => {
3836
describe('Webpack plugins', () => {
3937
it('css inclusion', async () => {
4038
const doc = await initDOM('css-inclusion');
41-
matchCSS(doc, [/html\{/, /#feature-css-inclusion\{background:.+;color:.+}/]);
39+
matchCSS(doc, [
40+
/html\{/,
41+
/#feature-css-inclusion\{background:.+;color:.+}/,
42+
]);
43+
doc.defaultView.close();
4244
});
4345

4446
it('css modules inclusion', async () => {
4547
const doc = await initDOM('css-modules-inclusion');
46-
matchCSS(doc, [/.+style_cssModulesInclusion__.+\{background:.+;color:.+}/,
47-
/.+assets_cssModulesIndexInclusion__.+\{background:.+;color:.+}/]);
48+
matchCSS(doc, [
49+
/.+style_cssModulesInclusion__.+\{background:.+;color:.+}/,
50+
/.+assets_cssModulesIndexInclusion__.+\{background:.+;color:.+}/,
51+
]);
52+
doc.defaultView.close();
4853
});
4954

5055
it('scss inclusion', async () => {
5156
const doc = await initDOM('scss-inclusion');
5257
matchCSS(doc, [/#feature-scss-inclusion\{background:.+;color:.+}/]);
58+
doc.defaultView.close();
5359
});
5460

5561
it('scss modules inclusion', async () => {
5662
const doc = await initDOM('scss-modules-inclusion');
57-
matchCSS(doc, [/.+scss-styles_scssModulesInclusion.+\{background:.+;color:.+}/,
58-
/.+assets_scssModulesIndexInclusion.+\{background:.+;color:.+}/]);
59-
63+
matchCSS(doc, [
64+
/.+scss-styles_scssModulesInclusion.+\{background:.+;color:.+}/,
65+
/.+assets_scssModulesIndexInclusion.+\{background:.+;color:.+}/,
66+
]);
67+
doc.defaultView.close();
6068
});
6169

6270
it('sass inclusion', async () => {
6371
const doc = await initDOM('sass-inclusion');
6472
matchCSS(doc, [/#feature-sass-inclusion\{background:.+;color:.+}/]);
73+
doc.defaultView.close();
6574
});
6675

6776
it('sass modules inclusion', async () => {
6877
const doc = await initDOM('sass-modules-inclusion');
69-
matchCSS(doc, [/.+sass-styles_sassModulesInclusion.+\{background:.+;color:.+}/,
70-
/.+assets_sassModulesIndexInclusion.+\{background:.+;color:.+}/]);
78+
matchCSS(doc, [
79+
/.+sass-styles_sassModulesInclusion.+\{background:.+;color:.+}/,
80+
/.+assets_sassModulesIndexInclusion.+\{background:.+;color:.+}/,
81+
]);
82+
doc.defaultView.close();
7183
});
7284

7385
it('graphql files inclusion', async () => {
@@ -78,6 +90,7 @@ describe('Integration', () => {
7890
expect(children[0].textContent.replace(/\s/g, '')).to.equal(
7991
'{"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","variableDefinitions":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"test"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"test"},"value":{"kind":"StringValue","value":"test","block":false}}],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"test"},"arguments":[],"directives":[]}]}}]}}],"loc":{"start":0,"end":40,"source":{"body":"{\\ntest(test:\\"test\\"){\\ntest\\n}\\n}\\n","name":"GraphQLrequest","locationOffset":{"line":1,"column":1}}}}'
8092
);
93+
doc.defaultView.close();
8194
});
8295

8396
it('image inclusion', async () => {
@@ -86,6 +99,7 @@ describe('Integration', () => {
8699
expect(doc.getElementById('feature-image-inclusion').src).to.match(
87100
/^data:image\/jpeg;base64.+==$/
88101
);
102+
doc.defaultView.close();
89103
});
90104

91105
it('no ext inclusion', async () => {
@@ -94,6 +108,7 @@ describe('Integration', () => {
94108
expect(doc.getElementById('feature-no-ext-inclusion').href).to.match(
95109
/\/static\/media\/aFileWithoutExt\.[a-f0-9]{8}\.bin$/
96110
);
111+
doc.defaultView.close();
97112
});
98113

99114
it('json inclusion', async () => {
@@ -102,6 +117,7 @@ describe('Integration', () => {
102117
expect(doc.getElementById('feature-json-inclusion').textContent).to.equal(
103118
'This is an abstract.'
104119
);
120+
doc.defaultView.close();
105121
});
106122

107123
it('linked modules', async () => {
@@ -110,13 +126,15 @@ describe('Integration', () => {
110126
expect(doc.getElementById('feature-linked-modules').textContent).to.equal(
111127
'2.0.0'
112128
);
129+
doc.defaultView.close();
113130
});
114131

115132
it('svg inclusion', async () => {
116133
const doc = await initDOM('svg-inclusion');
117134
expect(doc.getElementById('feature-svg-inclusion').src).to.match(
118135
/\/static\/media\/logo\..+\.svg$/
119136
);
137+
doc.defaultView.close();
120138
});
121139

122140
it('svg component', async () => {
@@ -125,11 +143,13 @@ describe('Integration', () => {
125143
expect(doc.getElementById('feature-svg-component').textContent).to.equal(
126144
''
127145
);
146+
doc.defaultView.close();
128147
});
129148

130149
it('svg in css', async () => {
131150
const doc = await initDOM('svg-in-css');
132151
matchCSS(doc, [/\/static\/media\/logo\..+\.svg/]);
152+
doc.defaultView.close();
133153
});
134154

135155
it('unknown ext inclusion', async () => {
@@ -138,6 +158,7 @@ describe('Integration', () => {
138158
expect(doc.getElementById('feature-unknown-ext-inclusion').href).to.match(
139159
/\/static\/media\/aFileWithExt\.[a-f0-9]{8}\.unknown$/
140160
);
161+
doc.defaultView.close();
141162
});
142163
});
143164
});

0 commit comments

Comments
 (0)