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

test: helper to expect deprecation warnings #39405

Merged
merged 1 commit into from
Aug 9, 2023
Merged

Conversation

dsanders11
Copy link
Member

Description of Change

Adds a helper to be used in tests to check for deprecation warnings. Intended to be used in #39343 and #39356. Intended usage:

     it('can get printer list', async () => {
       const w = new BrowserWindow({ show: false, webPreferences: { sandbox: true } });
       await w.loadURL('about:blank');
-      const printers = w.webContents.getPrinters();
+
+      const printers = await expectDeprecationMessages(
+        () => w.webContents.getPrinters(),
+        'Deprecation Warning: getPrinters() is deprecated. Use the asynchronous and non-blocking version, getPrintersAsync(), instead.'
+      );
       expect(printers).to.be.an('array');
     });

Checklist

  • PR description included and stakeholders cc'd

Release Notes

Notes: none

@dsanders11 dsanders11 added the target/26-x-y PR should also be added to the "26-x-y" branch. label Aug 8, 2023
@dsanders11 dsanders11 marked this pull request as ready for review August 8, 2023 02:49
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

LGTM, this is a nice helper 👍

@codebytere codebytere merged commit 0425454 into main Aug 9, 2023
16 checks passed
@codebytere codebytere deleted the test-deprecate-helper branch August 9, 2023 09:01
@release-clerk
Copy link

release-clerk bot commented Aug 9, 2023

No Release Notes

@trop
Copy link
Contributor

trop bot commented Aug 9, 2023

I have automatically backported this PR to "26-x-y", please check out #39429

@trop trop bot added in-flight/26-x-y merged/26-x-y PR was merged to the "26-x-y" branch. and removed target/26-x-y PR should also be added to the "26-x-y" branch. in-flight/26-x-y labels Aug 9, 2023
win32ss pushed a commit to win32ss/supermium-electron that referenced this pull request Sep 24, 2023
MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/26-x-y PR was merged to the "26-x-y" branch. semver/none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants