[7.2] [failureReporting] fix Karma support (#40210) (#40321)

This commit is contained in:
Spencer 2019-07-03 20:07:43 -07:00 committed by GitHub
parent 6447425375
commit b4fc52a6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 83 additions and 2 deletions

View file

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<testsuite name="Chrome 75.0.3770 (Mac OS X 10.14.5)" package="" timestamp="2019-07-02T19:53:21" id="0" hostname="spalger.lan" tests="648" errors="0" failures="4" time="1.759">
<properties>
<property name="browser.fullName" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"/>
</properties>
<testcase name="collectBranch() should return an array with bucket objects" time="0.014" classname="Browser Unit Tests.collectBranch()"/>
<testcase name="Vis-Editor-Agg-Params plugin directive should hide custom label parameter" time="0" classname="Browser Unit Tests.Vis-Editor-Agg-Params plugin directive">
<skipped/>
</testcase>
<testcase name="CoordinateMapsVisualizationTest CoordinateMapsVisualization - basics should initialize OK" time="0.265" classname="Browser Unit Tests.CoordinateMapsVisualizationTest">
<failure type="">Error: expected 7069 to be below 64
at Assertion.__kbnBundles__.tests../packages/kbn-expect/expect.js.Assertion.assert (http://localhost:5610/bundles/tests.bundle.js?shards=4&amp;shard_num=1:13671:11)
at Assertion.__kbnBundles__.tests../packages/kbn-expect/expect.js.Assertion.lessThan.Assertion.below (http://localhost:5610/bundles/tests.bundle.js?shards=4&amp;shard_num=1:13891:8)
at Function.lessThan (http://localhost:5610/bundles/tests.bundle.js?shards=4&amp;shard_num=1:14078:15)
at _callee3$ (http://localhost:5610/bundles/tests.bundle.js?shards=4&amp;shard_num=1:158985:60)
at tryCatch (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:62:40)
at Generator.invoke [as _invoke] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:288:22)
at Generator.prototype.&lt;computed&gt; [as next] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:114:21)
at asyncGeneratorStep (http://localhost:5610/bundles/tests.bundle.js?shards=4&amp;shard_num=1:158772:103)
at _next (http://localhost:5610/bundles/tests.bundle.js?shards=4&amp;shard_num=1:158774:194)
</failure>
</testcase>
<testcase name="CoordinateMapsVisualizationTest CoordinateMapsVisualization - basics should toggle to Heatmap OK" time="0.055" classname="Browser Unit Tests.CoordinateMapsVisualizationTest"/>
<testcase name="VegaParser._parseSchema should warn on vega-lite version too new to be supported" time="0.001" classname="Browser Unit Tests.VegaParser·_parseSchema"/>
<system-out>
<![CDATA[Chrome 75.0.3770 (Mac OS X 10.14.5) LOG: 'ready to load tests for shard 1 of 4'
,Chrome 75.0.3770 (Mac OS X 10.14.5) WARN: 'Unmatched GET to http://localhost:9876/api/interpreter/fns'
...
]]>
</system-out>
<system-err/>
</testsuite>

View file

@ -33,6 +33,16 @@ const indent = text => (
` ${text.split('\n').map(l => ` ${l}`).join('\n')}`
);
const getFailureText = (testCase) => {
const [failureNode] = testCase.failure;
if (failureNode && typeof failureNode === 'object' && typeof failureNode._ === 'string') {
return stripAnsi(failureNode._);
}
return stripAnsi(String(failureNode));
};
const isLikelyIrrelevant = ({ name, failure }) => {
if (failure.includes('NoSuchSessionError: This driver instance does not have a valid session ID')) {
return true;
@ -87,10 +97,9 @@ export const filterFailures = () => createMapStream((testSuite) => {
const failureCase = {
...testCase.$,
// Strip ANSI color characters
failure: stripAnsi(testCase.failure[0])
failure: getFailureText(testCase)
};
if (isLikelyIrrelevant(failureCase)) {
console.log(`Ignoring likely irrelevant failure: ${failureCase.classname} - ${failureCase.name}\n${indent(failureCase.failure)}`);
continue;

View file

@ -151,4 +151,43 @@ Array [
expect(failures).toMatchInlineSnapshot(`Array []`);
});
});
describe('karma report', () => {
it('allows relevant tests', async () => {
const failures = await createPromiseFromStreams([
vfs.src([resolve(__dirname, '__fixtures__/karma_report.xml')]),
mapXml(),
filterFailures(),
createConcatStream(),
]);
expect(console.log.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
"Found 1 test failures",
],
]
`);
expect(failures).toMatchInlineSnapshot(`
Array [
Object {
"classname": "Browser Unit Tests.CoordinateMapsVisualizationTest",
"failure": "Error: expected 7069 to be below 64
at Assertion.__kbnBundles__.tests../packages/kbn-expect/expect.js.Assertion.assert (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:13671:11)
at Assertion.__kbnBundles__.tests../packages/kbn-expect/expect.js.Assertion.lessThan.Assertion.below (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:13891:8)
at Function.lessThan (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:14078:15)
at _callee3$ (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158985:60)
at tryCatch (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:62:40)
at Generator.invoke [as _invoke] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:288:22)
at Generator.prototype.<computed> [as next] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:114:21)
at asyncGeneratorStep (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158772:103)
at _next (http://localhost:5610/bundles/tests.bundle.js?shards=4&shard_num=1:158774:194)
",
"name": "CoordinateMapsVisualizationTest CoordinateMapsVisualization - basics should initialize OK",
"time": "0.265",
},
]
`);
});
});
});