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

Projects
None yet
2 participants
@bajtos
Copy link
Member

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 requested review from raymondfeng and hacksparrow May 31, 2019

@bajtos bajtos self-assigned this May 31, 2019

@bajtos

This comment was marked as resolved.

Copy link
Member Author

commented May 31, 2019

@raymondfeng I am seeing test failures in the recently modified greeter-extension example, any idea what's wrong?

  1) greeter-extension-pont
       greets by language:

      AssertionError: expected 'Hello, Raymond!' to equal 'Hello, Raymond'
      + expected - actual

      -Hello, Raymond!
      +Hello, Raymond

      at Assertion.fail (packages/testlab/node_modules/should/as-function.js:275:17)
      at Assertion.value (packages/testlab/node_modules/should/as-function.js:356:19)
      at Context.<anonymous> (examples/greeter-extension/src/__tests__/greeter-extension.acceptance.ts:21:20)
      at processTicksAndRejections (internal/process/task_queues.js:89:5)

  2) greeter-extension-pont
       supports options for the extension point:
     AssertionError: expected undefined to equal Object { color: 'blue' }
      at Assertion.fail (packages/testlab/node_modules/should/as-function.js:275:17)
      at Assertion.value (packages/testlab/node_modules/should/as-function.js:356:19)
      at Context.<anonymous> (examples/greeter-extension/src/__tests__/greeter-extension.acceptance.ts:30:40)

  3) greeter-extension-pont
       supports options for extensions:

      AssertionError: expected 'Raymond锛屼綘濂斤紒' to equal '浣犲ソ锛孯aymond锛'
      + expected - actual

      -Raymond锛屼綘濂斤紒
      +浣犲ソ锛孯aymond锛

      at Assertion.fail (packages/testlab/node_modules/should/as-function.js:275:17)
      at Assertion.value (packages/testlab/node_modules/should/as-function.js:356:19)
      at Context.<anonymous> (examples/greeter-extension/src/__tests__/greeter-extension.acceptance.ts:39:20)
      at processTicksAndRejections (internal/process/task_queues.js:89:5)

  4) greeter-extension-pont
       honors a newly added/removed greeter binding:

      AssertionError: expected 'Hello, Raymond!' to equal 'Hello, Raymond'
      + expected - actual

      -Hello, Raymond!
      +Hello, Raymond

      at Assertion.fail (packages/testlab/node_modules/should/as-function.js:275:17)
      at Assertion.value (packages/testlab/node_modules/should/as-function.js:356:19)
      at Context.<anonymous> (examples/greeter-extension/src/__tests__/greeter-extension.acceptance.ts:65:20)
@bajtos

This comment was marked as resolved.

Copy link
Member Author

commented May 31, 2019

I am seeing test failures in the recently modified greeter-extension example, any idea what's wrong?

Never mind. I did a full reinstall of all dependencies and the problem went away.

feat(testlab): rework itSkippedOnTravis to support Jest framework
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 force-pushed the fix/testlab-in-jest branch from 607e92b to c5949e2 May 31, 2019

@bajtos bajtos merged commit c7e14ca into master May 31, 2019

4 checks passed

clahub All contributors have signed the Contributor License Agreement.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 91.939%
Details

@bajtos bajtos deleted the fix/testlab-in-jest branch May 31, 2019

@bajtos bajtos referenced this pull request Jun 4, 2019

Merged

feat(testlab): add generic helper `skipOnTravis` #3040

4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.