
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A node.js module that helps with mocking and behavior verification.
Make sure your dog is working properly:
function Dog() {}
Dog.prototype.seeCat = function() {
this.bark('whuf, whuf');
this.run();
}
Dog.prototype.bark = function(bark) {
require('sys').puts(bark);
}
var gently = new (require('gently').Gently)
, assert = require('assert')
, dog = new Dog();
gently.expect(dog, 'bark', function(bark) {
assert.equal(bark, 'whuf, whuf');
});
gently.expect(dog, 'run');
dog.seeCat();
You can also easily test event emitters with this, for example a simple sequence of 2 events emitted by fs.WriteStream
:
var gently = new (require('gently').Gently)
, stream = new (require('fs').WriteStream)('my_file.txt');
gently.expect(stream, 'emit', function(event) {
assert.equal(event, 'open');
});
gently.expect(stream, 'emit', function(event) {
assert.equal(event, 'drain');
});
Creates a new gently instance. It listens to the process 'exit'
event to make sure all expectations have been verified.
Creates an expectation for an objects method to be called. You can optionally specify the call count
you are expecting, as well as mock
function that will run instead of the original function.
Restores an object method that has been previously overwritten using gently.expect()
.
Verifies that all expectations of this gently instance have been satisfied. If not called manually, this method is called when the process 'exit'
event is fired.
Gently is licensed under the MIT license.
FAQs
<!-- badges/ --> [](https://travis-ci.org/felixge/node-gently) [](https://www.npmjs.com/package/gently) [![Dependency Status](https
The npm package gently receives a total of 327 weekly downloads. As such, gently popularity was classified as not popular.
We found that gently demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.