Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A simple mock for requestAnimationFrame
testing with fake timers.
Adapted with gratitude from react-motion
. Original source here.
var createMockRaf = require('mock-raf');
var mockRaf = createMockRaf();
// Stub out your `requestAnimationFrame` method
sinon.stub(window, 'requestAnimationFrame').callsFake(mockRaf.raf);
// Take 10 `requestAnimationFrame` steps (your callback will fire 10 times)
mockRaf.step({ count: 10 });
createMockRaf()
Creates a mockRaf
instance, exposing the functions you'll use to interact with the mock.
Returns:
var mockRaf = createMockRaf();
now()
Returns the current now
value of the mock. Starts at 0 and increases with each step()
taken. Useful for stubbing out performance.now()
or a polyfill when using requestAnimationFrame
with timers.
raf()
Replacement for requestAnimationFrame
or a polyfill. Adds a callback to be fired on the next step.
cancel()
Replacement for cancelAnimationFrame
or a polyfill. Removes all currently scheduled requestAnimationFrame
callbacks from the queue.
step(options)
Takes requestAnimationFrame
steps. Fires currently queued callbacks for each step and increments now
time for each step. The primary way to interact with a mockRaf
instance for testing.
step()
takes an optional options
object:
time
Type: Number
Default: 1000 / 60
The time that should pass during each requestAnimationFrame
step in milliseconds. Default is roughly equivalent to default browser behavior.
count
Type: Number
Default: 1
The number of steps to take.
FAQs
A simple mock for requestAnimationFrame testing with fake timers.
The npm package mock-raf receives a total of 9,332 weekly downloads. As such, mock-raf popularity was classified as popular.
We found that mock-raf 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.