Skip to content

Commit

Permalink
Set file of suite in registry
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Jan 23, 2021
1 parent ce156c8 commit 5e16d65
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion x-pack/test/apm_api_integration/common/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { castArray, groupBy } from 'lodash';
import callsites from 'callsites';
import { maybe } from '../../../plugins/apm/common/utils/maybe';
import { joinByKey } from '../../../plugins/apm/common/utils/join_by_key';
import { APMFtrConfigName } from '../configs';
import { FtrProviderContext } from './ftr_provider_context';
Expand Down Expand Up @@ -55,15 +57,28 @@ export const registry = {
throw new Error("Can't add tests when running");
}

const frame = maybe(callsites()[1]);

const file = frame?.getFileName();

if (!file) {
throw new Error('Could not infer file for suite');
}

allConditions.forEach((matchedCondition) => {
callbacks.push({
...matchedCondition,
runs: [
{
cb: () => {
describe(title, () => {
const suite = describe(title, () => {
callback(matchedCondition);
});

suite.file = file;
suite.eachTest((test) => {
test.file = file;
});
},
},
],
Expand Down

0 comments on commit 5e16d65

Please sign in to comment.