fix: convert library to module#431
Merged
kanadgupta merged 3 commits intomainfrom Sep 27, 2023
Merged
Conversation
kanadgupta
commented
Sep 27, 2023
| } | ||
|
|
||
| export default function fetchHAR(har: Har, opts: FetchHAROptions = {}) { | ||
| export default async function fetchHAR(har: Har, opts: FetchHAROptions = {}): Promise<Response> { |
Contributor
Author
There was a problem hiding this comment.
this function is now async since we're doing dynamic imports, but it has always returned a Promise so I think this should be a patch change?
| expect(fetchHAR).rejects.toThrow('Missing HAR definition'); | ||
| // @ts-expect-error deliberately bad data | ||
| expect(fetchHAR.bind(null, { log: {} })).toThrow('Missing log.entries array'); | ||
| expect(fetchHAR.bind(null, { log: {} })).rejects.toThrow('Missing log.entries array'); |
Contributor
Author
There was a problem hiding this comment.
these tests needed to be refactored slightly in order to work again, but honestly I'm a little confused on why they were passing in the first place 🤔
Member
There was a problem hiding this comment.
believe they were passing before because fetcHAR wasn't async at that point that that invalid HAR error is thrown.
darrenyong
approved these changes
Sep 27, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧰 Changes
Turns out that I got so lost in the sauce in #427 that this commit ended up breaking things for the Node ESM usage 😭 I for some reason assumed that
tsupproperly transpiles therequirestatements but evidently not...Here's the stack trace of the error you see when running
node example.mjson themainbranch:The main function is now async since we're doing dynamic imports, but it has always returned a
Promise<Response>so I think this should be a patch change?🧬 QA & Testing
Check out this branch and try running the following commands to ensure they succeed: