
Research
Namastex.ai npm Packages Hit with TeamPCP-Style CanisterWorm Malware
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.
vitest-location-mock
Advanced tools
(Fork of jest-location-mock, but for vitest)
Vitest hooks for JSDOM location mock
Ever gotten the following error when using window.location.assign, reload, or replace?
Error: Not implemented: navigation (except hash changes)
This Vitest plugin fixes this error and mocks out window.location so it behaves similar to how does in the browser.
npm install --save-dev vitest-location-mock
To start using Vitest Location Mock, extend expect and add hooks by importing the default export in your Vite setup file.
vite.config.js
export default defineConfig({
setupFiles: [
"./config/vitest-setup.js"
]
});
config/vitest-setup.js
// Mock `window.location` with Vitest spies and extend expect
import "vitest-location-mock";
expect(location).toBeAt(url, [base])Throws: When the URLs have a different absolute href.
| Parameter | Type | Description |
|---|---|---|
| location | Location | URL | Instance of URL to check its href |
| url | string | URL | Relative or absolute URL |
| base | string | URL | If the url parameter is relative, an base URL for the URL constructor |
it("should call assign with a relative url", () => {
window.location.assign("/relative-url");
expect(window.location).not.toBeAt("/");
expect(window.location).toBeAt("/relative-url");
});
Copyright Evelyn Hathaway, MIT License
FAQs
vitest hooks for JSDOM location mock
The npm package vitest-location-mock receives a total of 10,219 weekly downloads. As such, vitest-location-mock popularity was classified as popular.
We found that vitest-location-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.

Research
Malicious Namastex.ai npm packages appear to replicate TeamPCP-style Canister Worm tradecraft, including exfiltration and self-propagation.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.