Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
cypress-signalr-mock
Advanced tools
An easy way to mock a SignalR server which can send and receive messages during Cypress tests.
Easy Mock SignalR hub connections in Cypress E2E tests.
The below are not hard requirements, but the plugin is tested against these versions.
Install with npm:
npm install --save-dev cypress-signalr-mock
Install with yarn:
yarn add cypress-signalr-mock --dev
Install with pnpm:
pnpm add -D cypress-signalr-mock
// 01. Import the plugin to where your signalR connections are created
import {useCypressSignalRMock} from 'cypress-signalr-mock';
// 02. Call "useCypressSignalRMock" to create a mock for the SignalR hub connection
// or use the real connection if not running in Cypress E2E mode
const progressHubConnection = useCypressSignalRMock('progress') ??
new HubConnectionBuilder().withUrl(`http://localhost:3000/progress`).build();
// 03. Activate the plugin in your cypress/support/index.js file
import 'cypress-signalr-mock';
// 04. Use the plugin in your tests
cy.signalrPublish(
'progress', // The name of the hub connection
'hello-world', // The name of the message type
{
message: 'Hello World!', // The message payload
},
);
Uses Rx.js behind the scenes to create an observable that can be subscribed to. The observable is created
when the createCypressSignalrMock
function is called. The observable is then used to publish messages
// This will not work
hubConnection.on
and hubConnection.stream
cannot have the same message type name.// This will not work
Shout-out to cypress-plugin-signalr for the inspiration and the methods used. It's unfortunately not maintained anymore, so I decided to make a spiritual successor to it.
FAQs
An easy way to mock a SignalR server which can send and receive messages during Cypress tests.
The npm package cypress-signalr-mock receives a total of 919 weekly downloads. As such, cypress-signalr-mock popularity was classified as not popular.
We found that cypress-signalr-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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.