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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): support async function in insomnia.test #8243

Merged
merged 8 commits into from
Dec 23, 2024
Merged

Conversation

ihexxa
Copy link
Contributor

@ihexxa ihexxa commented Dec 11, 2024

Changes

  • Monitor all tests in the script and suspending the script execution until all sync tests or async tests are finished or rejected
  • Test it

image

Ref: INS-4765

@ihexxa ihexxa self-assigned this Dec 11, 2024
@ihexxa ihexxa marked this pull request as draft December 12, 2024 11:30
@ihexxa ihexxa force-pushed the fix/sdk/async-test branch from 7c88059 to 790d51a Compare December 17, 2024 07:14
@ihexxa ihexxa requested a review from a team December 17, 2024 07:47
@ihexxa ihexxa marked this pull request as ready for review December 17, 2024 07:48
@cwangsmv cwangsmv self-requested a review December 20, 2024 02:17
Copy link
Contributor

@cwangsmv cwangsmv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only a minor issue which could fix in later releases

function translateTestHandlers(script: string): string {
const replacedTests = script.replace(/insomnia\.test\(/g, 'await insomnia.test(');
return replacedTests.replace(/insomnia\.test\.skip\(/g, 'await insomnia.test.skip(');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor issue here:
If user has already input await, it will translate the script to

await await insomnia.test('xxx', () => {})

It's fine for me since double await could execute as expected, maybe we can enhance in the future

@ihexxa ihexxa enabled auto-merge (squash) December 23, 2024 03:26
@ihexxa ihexxa force-pushed the fix/sdk/async-test branch from b0f06e1 to 3e9aceb Compare December 23, 2024 03:26
@ihexxa ihexxa merged commit de29164 into develop Dec 23, 2024
8 checks passed
@ihexxa ihexxa deleted the fix/sdk/async-test branch December 23, 2024 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants