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

chore(tests): use vitest #376

Merged
merged 2 commits into from Jun 2, 2023
Merged

chore(tests): use vitest #376

merged 2 commits into from Jun 2, 2023

Conversation

gregjopa
Copy link
Contributor

@gregjopa gregjopa commented Jun 1, 2023

This PR replaces Jest with vitest.

I stuck with jsdom since happy-dom executes <script> tags by default and was difficult to switch out. There are also some differences in type definitions for the DOM. Sticking with jsdom made this upgrade pretty easy.

@gregjopa gregjopa marked this pull request as ready for review June 1, 2023 21:30
@gregjopa gregjopa requested a review from a team as a code owner June 1, 2023 21:30
@@ -319,17 +319,4 @@ describe("loadCustomScript()", () => {
);
expect(PromisePonyfill).toHaveBeenCalledTimes(1);
});

test("should throw an error when the Promise implementation is undefined", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Admittedly, this is a bad test that had to delete the global Promise object. I ended up removing this test since I was unable to get it working with vitest.

I'm thinking we can actually get rid of this custom error message and just let the browser throw a standard error message in IE11 when window.Promise is undefined. https://github.com/paypal/paypal-js/blob/main/src/load-script.ts#L117-L119

@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f73df41) 100.00% compared to head (5fbb961) 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #376    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            2         2            
  Lines          128       299   +171     
  Branches        36        56    +20     
==========================================
+ Hits           128       299   +171     
Impacted Files Coverage Δ
src/load-script.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

package.json Show resolved Hide resolved
@gregjopa gregjopa merged commit 4365e49 into main Jun 2, 2023
4 checks passed
@gregjopa gregjopa deleted the vitest branch June 2, 2023 16:13
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.

None yet

2 participants