Skip to content

Commit

Permalink
[internal] Separate out kitchensink test into two (#4767)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Jack Zhao authored and iansu committed Jul 15, 2018
1 parent 706b319 commit 366e5d3
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 75 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@ script:
- 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi'
- 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi'
- 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi'
- 'if [ $TEST_SUITE = "kitchensink-eject" ]; then tasks/e2e-kitchensink-eject.sh; fi'
- 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi'
- 'if [ $TEST_SUITE = "monorepos" ]; then tasks/e2e-monorepos.sh; fi'
env:
matrix:
- TEST_SUITE=simple
- TEST_SUITE=installs
- TEST_SUITE=kitchensink
- TEST_SUITE=kitchensink-eject
- TEST_SUITE=monorepos
matrix:
include:
- node_js: 0.10
env: TEST_SUITE=old-node
- node_js: 6
env: TEST_SUITE=kitchensink
- node_js: 6
env: TEST_SUITE=kitchensink-eject
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ environment:
test_suite: "installs"
- nodejs_version: 8
test_suite: "kitchensink"
- nodejs_version: 8
test_suite: "kitchensink-eject"
- nodejs_version: 8
test_suite: "monorepos"
- nodejs_version: 6
Expand All @@ -16,6 +18,8 @@ environment:
test_suite: "installs"
- nodejs_version: 6
test_suite: "kitchensink"
- nodejs_version: 6
test_suite: "kitchensink-eject"
- nodejs_version: 6
test_suite: "monorepos"
cache:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ describe('Integration', () => {
'x-from-development-env'
);
}
doc.defaultView.close();
});

it('NODE_PATH', async () => {
Expand All @@ -43,6 +44,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-node-path').childElementCount
).to.equal(4);
doc.defaultView.close();
});

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

it('shell env variables', async () => {
Expand All @@ -66,6 +69,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-shell-env-variables').textContent
).to.equal('fromtheshell.');
doc.defaultView.close();
});

it('expand .env variables', async () => {
Expand All @@ -83,6 +87,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-expand-env-existing').textContent
).to.equal('fromtheshell');
doc.defaultView.close();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default feature =>
created: (_, win) =>
win.addEventListener('ReactFeatureDidMount', () => resolve(doc), true),
deferClose: true,
pretendToBeVisual: true,
resourceLoader,
url: `${host}#${feature}`,
virtualConsole: jsdom.createVirtualConsole().sendTo(console),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-array-destructuring').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('array spread', async () => {
Expand All @@ -24,6 +25,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-array-spread').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('async/await', async () => {
Expand All @@ -32,6 +34,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-async-await').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('class properties', async () => {
Expand All @@ -40,6 +43,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-class-properties').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('computed properties', async () => {
Expand All @@ -48,6 +52,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-computed-properties').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('custom interpolation', async () => {
Expand All @@ -56,6 +61,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-custom-interpolation').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('default parameters', async () => {
Expand All @@ -64,6 +70,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-default-parameters').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('destructuring and await', async () => {
Expand All @@ -72,6 +79,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-destructuring-and-await').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('generators', async () => {
Expand All @@ -80,6 +88,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-generators').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('object destructuring', async () => {
Expand All @@ -88,6 +97,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-object-destructuring').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('object spread', async () => {
Expand All @@ -96,6 +106,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-object-spread').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('promises', async () => {
Expand All @@ -104,6 +115,7 @@ describe('Integration', () => {
expect(doc.getElementById('feature-promises').childElementCount).to.equal(
4
);
doc.defaultView.close();
});

it('rest + default', async () => {
Expand All @@ -112,6 +124,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-rest-and-default').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('rest parameters', async () => {
Expand All @@ -120,6 +133,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-rest-parameters').childElementCount
).to.equal(4);
doc.defaultView.close();
});

it('template interpolation', async () => {
Expand All @@ -128,6 +142,7 @@ describe('Integration', () => {
expect(
doc.getElementById('feature-template-interpolation').childElementCount
).to.equal(4);
doc.defaultView.close();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,63 +11,75 @@ import url from 'url';

const matchCSS = (doc, regexes) => {
if (process.env.E2E_FILE) {
const elements = doc.getElementsByTagName('link');
let href = "";
for (const elem of elements) {
if (elem.rel === 'stylesheet') {
href = elem.href;
}
const elements = doc.getElementsByTagName('link');
let href = '';
for (const elem of elements) {
if (elem.rel === 'stylesheet') {
href = elem.href;
}
resourceLoader(
{ url: url.parse(href) },
(_, textContent) => {
for (const regex of regexes) {
expect(textContent).to.match(regex);
}
}
);

}
resourceLoader({ url: url.parse(href) }, (_, textContent) => {
for (const regex of regexes) {
expect(textContent).to.match(regex);
}
});
} else {
for (let i = 0; i < regexes.length; ++i) {
expect(doc.getElementsByTagName('style')[i].textContent.replace(/\s/g, '')).to.match(regexes[i]);
expect(
doc.getElementsByTagName('style')[i].textContent.replace(/\s/g, '')
).to.match(regexes[i]);
}
}
}
};

describe('Integration', () => {
describe('Webpack plugins', () => {
it('css inclusion', async () => {
const doc = await initDOM('css-inclusion');
matchCSS(doc, [/html\{/, /#feature-css-inclusion\{background:.+;color:.+}/]);
matchCSS(doc, [
/html\{/,
/#feature-css-inclusion\{background:.+;color:.+}/,
]);
doc.defaultView.close();
});

it('css modules inclusion', async () => {
const doc = await initDOM('css-modules-inclusion');
matchCSS(doc, [/.+style_cssModulesInclusion__.+\{background:.+;color:.+}/,
/.+assets_cssModulesIndexInclusion__.+\{background:.+;color:.+}/]);
matchCSS(doc, [
/.+style_cssModulesInclusion__.+\{background:.+;color:.+}/,
/.+assets_cssModulesIndexInclusion__.+\{background:.+;color:.+}/,
]);
doc.defaultView.close();
});

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

it('scss modules inclusion', async () => {
const doc = await initDOM('scss-modules-inclusion');
matchCSS(doc, [/.+scss-styles_scssModulesInclusion.+\{background:.+;color:.+}/,
/.+assets_scssModulesIndexInclusion.+\{background:.+;color:.+}/]);

matchCSS(doc, [
/.+scss-styles_scssModulesInclusion.+\{background:.+;color:.+}/,
/.+assets_scssModulesIndexInclusion.+\{background:.+;color:.+}/,
]);
doc.defaultView.close();
});

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

it('sass modules inclusion', async () => {
const doc = await initDOM('sass-modules-inclusion');
matchCSS(doc, [/.+sass-styles_sassModulesInclusion.+\{background:.+;color:.+}/,
/.+assets_sassModulesIndexInclusion.+\{background:.+;color:.+}/]);
matchCSS(doc, [
/.+sass-styles_sassModulesInclusion.+\{background:.+;color:.+}/,
/.+assets_sassModulesIndexInclusion.+\{background:.+;color:.+}/,
]);
doc.defaultView.close();
});

it('graphql files inclusion', async () => {
Expand All @@ -78,6 +90,7 @@ describe('Integration', () => {
expect(children[0].textContent.replace(/\s/g, '')).to.equal(
'{"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}}}}'
);
doc.defaultView.close();
});

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

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

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

it('linked modules', async () => {
Expand All @@ -110,13 +126,15 @@ describe('Integration', () => {
expect(doc.getElementById('feature-linked-modules').textContent).to.equal(
'2.0.0'
);
doc.defaultView.close();
});

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

it('svg component', async () => {
Expand All @@ -125,11 +143,13 @@ describe('Integration', () => {
expect(doc.getElementById('feature-svg-component').textContent).to.equal(
''
);
doc.defaultView.close();
});

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

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

0 comments on commit 366e5d3

Please sign in to comment.