
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
jest-wake-lock-mock
Advanced tools
Mock Screen Wake Lock API `navigator.wakeLock` with ease and run your tests using Jest
Mock Screen Wake Lock API (
navigator.wakeLock) with ease and run your tests using Jest
npm i -D jest-wake-lock-mock
# or
yarn add -D jest-wake-lock-mock
In your jest.config.js or package.json under jest section create a setupFiles array and add jest-wake-lock-mock to it.
{
setupFiles: ['jest-wake-lock-mock'],
// jest config...
}
Write your tests with confidence using the same Screen Wake Lock API api as in the browser.
Example (More):
const requestWakeLock = async () => {
try {
const wakeLock = await navigator.wakeLock.request('screen');
return { wakeLock };
} catch (error) {
return { error };
}
};
test('wakeLock request with success', async () => {
const { wakeLock, error } = await requestWakeLock(handleRelease);
expect(error).not.toBeDefined();
expect(wakeLock).toBeDefined();
expect(wakeLock?.type).toEqual('screen');
expect(wakeLock?.released).toBe(false);
});
👤 Joris
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2020 Joris.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator
FAQs
Mock Screen Wake Lock API `navigator.wakeLock` with ease and run your tests using Jest
The npm package jest-wake-lock-mock receives a total of 700 weekly downloads. As such, jest-wake-lock-mock popularity was classified as not popular.
We found that jest-wake-lock-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.