Testing/Removal of throw on console error (#29983)

* Use hosts instead of url for elasticsearch.

* Adds jest integration tests to run in xpack intake.

* Reverting the exclusion of throwing errors in tests.

* Strange test that seems to fail without console error exception being thrown.

* Fix issues with wrong props for EuiInMemoryTable.

* Removes the masking of console errors in tests.
This commit is contained in:
nicknak 2019-03-07 14:21:11 -05:00 committed by GitHub
parent 44bf9490ed
commit bb437d62e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 129 additions and 35 deletions

View file

@ -53,7 +53,6 @@ export default {
'<rootDir>/src/dev/jest/setup/babel_polyfill.js',
'<rootDir>/src/dev/jest/setup/polyfills.js',
'<rootDir>/src/dev/jest/setup/enzyme.js',
'<rootDir>/src/dev/jest/setup/throw_on_console_error.js',
],
coverageDirectory: '<rootDir>/target/jest-coverage',
coverageReporters: [

View file

@ -1,24 +0,0 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// Fail if a test ends up `console.error`-ing, e.g. if React logs because of a
// failed prop types check.
console.error = message => {
throw new Error(message);
};

View file

@ -70,7 +70,7 @@ exports[`Relationships should render dashboards normally 1`] = `
Array [
Object {
"render": [Function],
"width": 24,
"width": "24px",
},
Object {
"field": "title",
@ -191,9 +191,129 @@ exports[`Relationships should render index patterns normally 1`] = `
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiLoadingKibana
size="xl"
/>
<EuiDescriptionList
align="left"
compressed={false}
textStyle="normal"
type="row"
>
<EuiDescriptionListTitle
style={
Object {
"marginBottom": "1rem",
}
}
>
<EuiCallOut
color="warning"
size="m"
title={
<FormattedMessage
defaultMessage="Warning"
id="kbn.management.objects.objectsTable.relationships.warningTitle"
values={Object {}}
/>
}
>
<p />
</EuiCallOut>
</EuiDescriptionListTitle>
<EuiInMemoryTable
columns={
Array [
Object {
"render": [Function],
"width": "24px",
},
Object {
"field": "title",
"name": "Title",
"render": [Function],
},
Object {
"actions": Array [
Object {
"description": "View this saved object within Kibana",
"icon": "eye",
"name": "In app",
"onClick": [Function],
},
],
"name": "Actions",
},
]
}
executeQueryOptions={Object {}}
items={
Array [
Object {
"id": "1",
},
]
}
pagination={true}
responsive={true}
sorting={false}
/>
<EuiDescriptionListTitle
style={
Object {
"marginBottom": "1rem",
}
}
>
<EuiCallOut
color="warning"
size="m"
title={
<FormattedMessage
defaultMessage="Warning"
id="kbn.management.objects.objectsTable.relationships.warningTitle"
values={Object {}}
/>
}
>
<p />
</EuiCallOut>
</EuiDescriptionListTitle>
<EuiInMemoryTable
columns={
Array [
Object {
"render": [Function],
"width": "24px",
},
Object {
"field": "title",
"name": "Title",
"render": [Function],
},
Object {
"actions": Array [
Object {
"description": "View this saved object within Kibana",
"icon": "eye",
"name": "In app",
"onClick": [Function],
},
],
"name": "Actions",
},
]
}
executeQueryOptions={Object {}}
items={
Array [
Object {
"id": "2",
},
]
}
pagination={true}
responsive={true}
sorting={false}
/>
</EuiDescriptionList>
</EuiFlyoutBody>
</EuiFlyout>
`;
@ -268,7 +388,7 @@ exports[`Relationships should render searches normally 1`] = `
Array [
Object {
"render": [Function],
"width": 24,
"width": "24px",
},
Object {
"field": "title",
@ -332,7 +452,7 @@ exports[`Relationships should render searches normally 1`] = `
Array [
Object {
"render": [Function],
"width": 24,
"width": "24px",
},
Object {
"field": "title",
@ -439,7 +559,7 @@ exports[`Relationships should render visualizations normally 1`] = `
Array [
Object {
"render": [Function],
"width": 24,
"width": "24px",
},
Object {
"field": "title",

View file

@ -227,7 +227,7 @@ class RelationshipsUI extends Component {
items={list}
columns={[
{
width: 24,
width: '24px',
render: () => (
<EuiToolTip
position="top"

View file

@ -34,4 +34,4 @@ echo " -> Running jest integration tests"
cd "$XPACK_DIR"
node scripts/jest_integration --ci --no-cache --verbose
echo ""
echo ""
echo ""

View file

@ -26,7 +26,6 @@ export default {
'<rootDir>/../src/dev/jest/setup/babel_polyfill.js',
'<rootDir>/../src/dev/jest/setup/polyfills.js',
'<rootDir>/../src/dev/jest/setup/enzyme.js',
'<rootDir>/../src/dev/jest/setup/throw_on_console_error.js',
],
coverageDirectory: '<rootDir>/../target/jest-coverage',
coverageReporters: [