Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(testlab): rework itSkippedOnTravis to support Jest framework #3013

Merged
merged 1 commit into from May 31, 2019

Conversation

bajtos
Copy link
Member

@bajtos bajtos commented May 31, 2019

Describe referenced Mocha types directly in testlab to avoid compile-time dependency on Mocha types, some of which are not compatible with Jest -- fix #2452

Contents of packages/testlab/dist/skip-travis.d.ts:

BEFORE

/// <reference types="mocha" />
export declare type TestCallbackRetval = void | PromiseLike<any>;
/**
 * Helper function for skipping tests on Travis env
 * @param expectation
 * @param callback
 */
export declare function itSkippedOnTravis(expectation: string, callback?: (this: Mocha.ITestCallbackContext, done: MochaDone) => TestCallbackRetval): void;

Notice /// <reference types="mocha" /> which is the root cause of the problem reported in #2452

AFTER

export interface TestFn {
    (this: TestContext): PromiseLike<unknown>;
    (this: TestContext, done: Function): void;
}
export interface TestContext {
    skip(): this;
    timeout(ms: number | string): this;
    retries(n: number): this;
    slow(ms: number): this;
    [index: string]: any;
}
/**
 * Helper function for skipping tests on Travis env
 * @param expectation
 * @param callback
 */
export declare function itSkippedOnTravis(expectation: string, callback?: TestFn): void;

Checklist

馃憠 Read and sign the CLA (Contributor License Agreement) 馃憟

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

馃憠 Check out how to submit a PR 馃憟

@bajtos bajtos added feature Testlab @loopback/testlab labels May 31, 2019
@bajtos bajtos self-assigned this May 31, 2019
@bajtos

This comment has been minimized.

@bajtos

This comment has been minimized.

Describe referenced Mocha types directly in testlab to avoid
compile-time dependency on Mocha types, some of which are not
compatible with Jest.

Signed-off-by: Miroslav Bajto拧 <mbajtoss@gmail.com>
@bajtos bajtos merged commit c7e14ca into master May 31, 2019
@bajtos bajtos deleted the fix/testlab-in-jest branch May 31, 2019 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Testlab @loopback/testlab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@loopback/testlab requires mocha, conflicts with @types/jest if @types/mocha is brought in
2 participants