diff --git a/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx b/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.test.tsx
similarity index 82%
rename from x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.test.tsx
index 589b2dd27fbc4..58652b40b7084 100644
--- a/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/Stackframe.test.tsx
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/Stackframe.test.tsx
@@ -6,10 +6,10 @@
import React from 'react';
import { ReactWrapper, shallow } from 'enzyme';
-import { Stackframe } from '../../../../../typings/es_schemas/raw/fields/stackframe';
-import { mountWithTheme } from '../../../../utils/testHelpers';
-import { Stackframe as StackframeComponent } from '../Stackframe';
-import stacktracesMock from './stacktraces.json';
+import { Stackframe } from '../../../../typings/es_schemas/raw/fields/stackframe';
+import { mountWithTheme } from '../../../utils/testHelpers';
+import { Stackframe as StackframeComponent } from './Stackframe';
+import stacktracesMock from './__fixtures__/stacktraces.json';
jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => {
return {
@@ -27,8 +27,12 @@ describe('Stackframe', () => {
);
});
- it('should render correctly', () => {
- expect(wrapper).toMatchSnapshot();
+ it('renders', () => {
+ expect(() =>
+ mountWithTheme(
+
+ )
+ ).not.toThrowError();
});
it('should render FrameHeading, Context and Variables', () => {
diff --git a/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/stacktraces.json b/x-pack/plugins/apm/public/components/shared/Stacktrace/__fixtures__/stacktraces.json
similarity index 100%
rename from x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/stacktraces.json
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/__fixtures__/stacktraces.json
diff --git a/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/index.test.ts.snap b/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/index.test.ts.snap
deleted file mode 100644
index 6384253cb62a1..0000000000000
--- a/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/__snapshots__/index.test.ts.snap
+++ /dev/null
@@ -1,468 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Stacktrace/index getGroupedStackframes should collapse the library frames into a set of grouped stackframes 1`] = `
-Array [
- Object {
- "excludeFromGrouping": false,
- "isLibraryFrame": false,
- "stackframes": Array [
- Object {
- "abs_path": "/app/server/routes.js",
- "context": Object {
- "post": Array [
- " req.body.lines.forEach(function (line) {",
- " client.query('SELECT id FROM products WHERE id=$1', [line.id], next())",
- ],
- "pre": Array [
- " })",
- "",
- ],
- },
- "exclude_from_grouping": false,
- "filename": "server/routes.js",
- "function": "",
- "library_frame": false,
- "line": Object {
- "context": " client.query('SELECT id FROM customers WHERE id=$1', [req.body.customer_id], next())",
- "number": 307,
- },
- },
- ],
- },
- Object {
- "excludeFromGrouping": false,
- "isLibraryFrame": true,
- "stackframes": Array [
- Object {
- "abs_path": "/app/node_modules/pg-pool/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/pg-pool/index.js",
- "function": "BoundPool.",
- "library_frame": true,
- "line": Object {
- "number": 137,
- },
- },
- Object {
- "abs_path": "/app/node_modules/generic-pool/lib/generic-pool.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/generic-pool/lib/generic-pool.js",
- "function": "dispense",
- "library_frame": true,
- "line": Object {
- "number": 310,
- },
- },
- Object {
- "abs_path": "/app/node_modules/generic-pool/lib/generic-pool.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/generic-pool/lib/generic-pool.js",
- "function": "acquire",
- "library_frame": true,
- "line": Object {
- "number": 391,
- },
- },
- Object {
- "abs_path": "/app/node_modules/pg-pool/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/pg-pool/index.js",
- "function": "BoundPool.",
- "library_frame": true,
- "line": Object {
- "number": 111,
- },
- },
- Object {
- "abs_path": "/app/node_modules/pg-pool/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/pg-pool/index.js",
- "function": "Pool._promiseNoCallback",
- "library_frame": true,
- "line": Object {
- "number": 75,
- },
- },
- Object {
- "abs_path": "/app/node_modules/pg-pool/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/pg-pool/index.js",
- "function": "Pool.connect",
- "library_frame": true,
- "line": Object {
- "number": 109,
- },
- },
- ],
- },
- Object {
- "excludeFromGrouping": false,
- "isLibraryFrame": false,
- "stackframes": Array [
- Object {
- "abs_path": "/app/server/db.js",
- "context": Object {
- "post": Array [
- "}",
- "",
- ],
- "pre": Array [
- "",
- "exports.client = function (cb) {",
- ],
- },
- "exclude_from_grouping": false,
- "filename": "server/db.js",
- "function": "exports.client",
- "library_frame": false,
- "line": Object {
- "context": " pool.connect(cb)",
- "number": 11,
- },
- },
- Object {
- "abs_path": "/app/server/routes.js",
- "context": Object {
- "post": Array [
- " if (err) return error(err, res)",
- "",
- ],
- "pre": Array [
- " }",
- "",
- ],
- },
- "exclude_from_grouping": false,
- "filename": "server/routes.js",
- "function": "",
- "library_frame": false,
- "line": Object {
- "context": " db.client(function (err, client, done) {",
- "number": 248,
- },
- },
- ],
- },
- Object {
- "excludeFromGrouping": false,
- "isLibraryFrame": true,
- "stackframes": Array [
- Object {
- "abs_path": "/app/node_modules/express/lib/router/layer.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/layer.js",
- "function": "handle",
- "library_frame": true,
- "line": Object {
- "number": 95,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/route.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/route.js",
- "function": "next",
- "library_frame": true,
- "line": Object {
- "number": 137,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/route.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/route.js",
- "function": "dispatch",
- "library_frame": true,
- "line": Object {
- "number": 112,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/layer.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/layer.js",
- "function": "handle",
- "library_frame": true,
- "line": Object {
- "number": 95,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "",
- "library_frame": true,
- "line": Object {
- "number": 281,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "process_params",
- "library_frame": true,
- "line": Object {
- "number": 335,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "next",
- "library_frame": true,
- "line": Object {
- "number": 275,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "handle",
- "library_frame": true,
- "line": Object {
- "number": 174,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "router",
- "library_frame": true,
- "line": Object {
- "number": 47,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/layer.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/layer.js",
- "function": "handle",
- "library_frame": true,
- "line": Object {
- "number": 95,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "trim_prefix",
- "library_frame": true,
- "line": Object {
- "number": 317,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "",
- "library_frame": true,
- "line": Object {
- "number": 284,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "process_params",
- "library_frame": true,
- "line": Object {
- "number": 335,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "next",
- "library_frame": true,
- "line": Object {
- "number": 275,
- },
- },
- ],
- },
- Object {
- "excludeFromGrouping": false,
- "isLibraryFrame": false,
- "stackframes": Array [
- Object {
- "abs_path": "/app/server.js",
- "context": Object {
- "post": Array [
- " }",
- "",
- ],
- "pre": Array [
- "app.use('/api', function (req, res, next) {",
- " if (Math.random() > opbeansRedirectProbability) {",
- ],
- },
- "exclude_from_grouping": false,
- "filename": "server.js",
- "function": "",
- "library_frame": false,
- "line": Object {
- "context": " return next()",
- "number": 88,
- },
- },
- ],
- },
- Object {
- "excludeFromGrouping": false,
- "isLibraryFrame": true,
- "stackframes": Array [
- Object {
- "abs_path": "/app/node_modules/express/lib/router/layer.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/layer.js",
- "function": "handle",
- "library_frame": true,
- "line": Object {
- "number": 95,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "trim_prefix",
- "library_frame": true,
- "line": Object {
- "number": 317,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "",
- "library_frame": true,
- "line": Object {
- "number": 284,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "process_params",
- "library_frame": true,
- "line": Object {
- "number": 335,
- },
- },
- ],
- },
- Object {
- "excludeFromGrouping": true,
- "isLibraryFrame": true,
- "stackframes": Array [
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": true,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "next",
- "library_frame": true,
- "line": Object {
- "number": 275,
- },
- },
- ],
- },
- Object {
- "excludeFromGrouping": false,
- "isLibraryFrame": true,
- "stackframes": Array [
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "",
- "library_frame": true,
- "line": Object {
- "number": 635,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "next",
- "library_frame": true,
- "line": Object {
- "number": 260,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "handle",
- "library_frame": true,
- "line": Object {
- "number": 174,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "router",
- "library_frame": true,
- "line": Object {
- "number": 47,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/layer.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/layer.js",
- "function": "handle",
- "library_frame": true,
- "line": Object {
- "number": 95,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "trim_prefix",
- "library_frame": true,
- "line": Object {
- "number": 317,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "",
- "library_frame": true,
- "line": Object {
- "number": 284,
- },
- },
- Object {
- "abs_path": "/app/node_modules/express/lib/router/index.js",
- "exclude_from_grouping": false,
- "filename": "node_modules/express/lib/router/index.js",
- "function": "process_params",
- "library_frame": true,
- "line": Object {
- "number": 335,
- },
- },
- ],
- },
-]
-`;
diff --git a/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts b/x-pack/plugins/apm/public/components/shared/Stacktrace/stacktrace.test.ts
similarity index 90%
rename from x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts
rename to x-pack/plugins/apm/public/components/shared/Stacktrace/stacktrace.test.ts
index cd8bf90301836..9c76dad16d679 100644
--- a/x-pack/plugins/apm/public/components/shared/Stacktrace/__test__/index.test.ts
+++ b/x-pack/plugins/apm/public/components/shared/Stacktrace/stacktrace.test.ts
@@ -4,15 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { Stackframe } from '../../../../../typings/es_schemas/raw/fields/stackframe';
-import { getGroupedStackframes } from '../index';
-import stacktracesMock from './stacktraces.json';
+import { Stackframe } from '../../../../typings/es_schemas/raw/fields/stackframe';
+import { getGroupedStackframes } from './';
+import stacktracesMock from './__fixtures__/stacktraces.json';
-describe('Stacktrace/index', () => {
+describe('Stacktrace', () => {
describe('getGroupedStackframes', () => {
- it('should collapse the library frames into a set of grouped stackframes', () => {
- const result = getGroupedStackframes(stacktracesMock as Stackframe[]);
- expect(result).toMatchSnapshot();
+ it('collapses the library frames into a set of grouped stackframes', () => {
+ expect(
+ getGroupedStackframes(stacktracesMock as Stackframe[]).every(
+ (group) => group.stackframes.length > 0
+ )
+ ).toEqual(true);
});
it('should group stackframes when `library_frame` is identical and `exclude_from_grouping` is false', () => {