Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quibble

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quibble - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

4

lib/quibble.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.11.1
(function() {

@@ -116,3 +116,3 @@ var Module, _, config, doWithoutCache, fakeLoad, hackErrorStackToGetCallerFile, ignoredCallerFiles, originalLoad, path, quibble, quibbles, requireWasCalledFromAFileThatHasQuibbledStuff;

currentFile = e.stack[0].getFileName();
callerFile = _(e.stack).invoke('getFileName').reject(function(f) {
callerFile = _(e.stack).invoke('getFileName').compact().reject(function(f) {
return includeGlobalIgnores && _.include(ignoredCallerFiles, f);

@@ -119,0 +119,0 @@ }).select(path.isAbsolute).find(function(f) {

{
"name": "quibble",
"version": "0.3.0",
"version": "0.3.1",
"description": "Makes it easy to replace require'd dependencies.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/testdouble/quibble",

@@ -19,7 +19,10 @@ # quibble

beforeEach(function(){
legs = quibble('./../lib/legs', function(){ return 'ooh, legs';});
legs = quibble('./../lib/legs', function(){ return 'a leg';});
subject = require('./../lib/pants');
});
// ... more test stuff
it('contains legs', function() {
expect(subject().left).toContain('a leg')
expect(subject().right).toContain('a leg')
})
});

@@ -29,6 +32,9 @@ ```

That way, when the `subject` loaded from `lib/pants` runs `require('./legs')`,
it will get back the function that returns 'ooh, legs'. The fake value is also
it will get back the function that returns `'a leg'`. The fake value is also
returned by `quibble`, which makes it easy to set and assign a test double in a
one-liner.
For more info on how this module is _really_ intended to be used, check out its
inclusion in [testdouble.js](https://github.com/testdouble/testdouble.js/blob/master/docs/7-replacing-dependencies.md#nodejs)
## Configuration

@@ -70,5 +76,5 @@

3. Require strings are resolved to absolute paths. It can be a bit confusing using other tools because from the perspective of the test particular paths are knocked out _from the perspective of the subject_ and not from the test listing, which runs counter to how every other Node.js API works. Instead, here, the path of the file being knocked out is relative to whoever is knocking it out.
4. A configurable default faker function. This lib was written with [testdouble.js](https://github.com/testdouble/testdouble.js) in mind, thinking that you'd want to default to just create a new testdouble and return it in each case by default, without having to manually create it and pass it in (for somewhat more minimal test setup)
4. A configurable default faker function. This lib was written to support the [testdouble.js](https://github.com/testdouble/testdouble.js) feature [td.replace()](https://github.com/testdouble/testdouble.js/blob/master/docs/7-replacing-dependencies.md#nodejs), in an effort to reduce the amount of per-test friction to repetitively create & pass in test doubles
5. A `reset()` method that undoes everything, intended to be run `afterEach` test runs

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc