Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into sessions/save…
Browse files Browse the repository at this point in the history
…-all-sessions
  • Loading branch information
Liza K committed Feb 3, 2021
2 parents 4b89dbf + a839889 commit c890574
Show file tree
Hide file tree
Showing 75 changed files with 1,302 additions and 300 deletions.
2 changes: 1 addition & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ the infrastructure monitoring use-case within Kibana.
|{kib-repo}blob/{branch}/x-pack/plugins/lens/readme.md[lens]
|Run all tests from the x-pack root directory
|Visualization editor allowing to quickly and easily configure compelling visualizations to use on dashboards and canvas workpads.
|{kib-repo}blob/{branch}/x-pack/plugins/license_management/README.md[licenseManagement]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ export interface Suite {
suites: Suite[];
tests: Test[];
title: string;
file?: string;
file: string;
parent?: Suite;
eachTest: (cb: (test: Test) => void) => void;
root: boolean;
suiteTag: string;
}

export interface Test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class FunctionalTestRunner {
}

const mocha = await setupMocha(this.lifecycle, this.log, config, providers);
await this.lifecycle.beforeTests.trigger();
await this.lifecycle.beforeTests.trigger(mocha.suite);
this.log.info('Starting tests');

return await runTests(this.lifecycle, mocha);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

import { Lifecycle } from './lifecycle';
import { FailureMetadata } from './failure_metadata';
import { Test } from '../fake_mocha_types';

it('collects metadata for the current test', async () => {
const lifecycle = new Lifecycle();
const failureMetadata = new FailureMetadata(lifecycle);

const test1 = {};
const test1 = {} as Test;
await lifecycle.beforeEachRunnable.trigger(test1);
failureMetadata.add({ foo: 'bar' });

Expand All @@ -23,7 +24,7 @@ it('collects metadata for the current test', async () => {
}
`);

const test2 = {};
const test2 = {} as Test;
await lifecycle.beforeEachRunnable.trigger(test2);
failureMetadata.add({ test: 2 });

Expand All @@ -43,7 +44,7 @@ it('adds messages to the messages state', () => {
const lifecycle = new Lifecycle();
const failureMetadata = new FailureMetadata(lifecycle);

const test1 = {};
const test1 = {} as Test;
lifecycle.beforeEachRunnable.trigger(test1);
failureMetadata.addMessages(['foo', 'bar']);
failureMetadata.addMessages(['baz']);
Expand Down
19 changes: 8 additions & 11 deletions packages/kbn-test/src/functional_test_runner/lib/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@

import { LifecyclePhase } from './lifecycle_phase';

// mocha's global types mean we can't import Mocha or it will override the global jest types..............
type ItsASuite = any;
type ItsATest = any;
type ItsARunnable = any;
import { Suite, Test } from '../fake_mocha_types';

export class Lifecycle {
public readonly beforeTests = new LifecyclePhase<[]>({
public readonly beforeTests = new LifecyclePhase<[Suite]>({
singular: true,
});
public readonly beforeEachRunnable = new LifecyclePhase<[ItsARunnable]>();
public readonly beforeTestSuite = new LifecyclePhase<[ItsASuite]>();
public readonly beforeEachTest = new LifecyclePhase<[ItsATest]>();
public readonly afterTestSuite = new LifecyclePhase<[ItsASuite]>();
public readonly testFailure = new LifecyclePhase<[Error, ItsATest]>();
public readonly testHookFailure = new LifecyclePhase<[Error, ItsATest]>();
public readonly beforeEachRunnable = new LifecyclePhase<[Test]>();
public readonly beforeTestSuite = new LifecyclePhase<[Suite]>();
public readonly beforeEachTest = new LifecyclePhase<[Test]>();
public readonly afterTestSuite = new LifecyclePhase<[Suite]>();
public readonly testFailure = new LifecyclePhase<[Error, Test]>();
public readonly testHookFailure = new LifecyclePhase<[Error, Test]>();
public readonly cleanup = new LifecyclePhase<[]>({
singular: true,
});
Expand Down
Loading

0 comments on commit c890574

Please sign in to comment.