Comparing version 1.0.0 to 1.1.0
21
index.js
@@ -124,4 +124,4 @@ // | ||
// ## Exports | ||
module.exports = { | ||
// ## The prunk object | ||
var prunk = { | ||
@@ -158,4 +158,6 @@ // Provide access to the cache. | ||
// | ||
// It returns the prunk object so that you can chain calls. | ||
mock: function(test, value) { | ||
createMock(test, value, 'mock'); | ||
return prunk; | ||
}, | ||
@@ -168,4 +170,6 @@ | ||
// | ||
// It returns the prunk object so that you can chain calls. | ||
suppress: function(test) { | ||
createMock(test, void 0, 'sup'); | ||
return prunk; | ||
}, | ||
@@ -177,4 +181,6 @@ | ||
// mocks. | ||
// It returns the prunk object so that you can chain calls. | ||
unmock: function(test) { | ||
remove(test, 'mock'); | ||
return prunk; | ||
}, | ||
@@ -186,4 +192,6 @@ | ||
// imports. | ||
// It returns the prunk object so that you can chain calls. | ||
unsuppress: function(test) { | ||
remove(test, 'sup'); | ||
return prunk; | ||
}, | ||
@@ -193,4 +201,6 @@ | ||
// Removes all mocks for imports | ||
// It returns the prunk object so that you can chain calls. | ||
unmockAll: function() { | ||
removeAll('mock'); | ||
return prunk; | ||
}, | ||
@@ -200,6 +210,11 @@ | ||
// Removes all suppressed imports | ||
// It returns the prunk object so that you can chain calls. | ||
unsuppressAll: function() { | ||
removeAll('sup'); | ||
return prunk; | ||
} | ||
}; | ||
}; | ||
// ## Exports | ||
module.exports = prunk; |
{ | ||
"name": "prunk", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A mocking utility for node.js require", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -74,4 +74,6 @@ # prunk | ||
var mockStyles = (req) => 'style.css' === req; | ||
prunk.mock( mockStyles, 'no css, dude.'); | ||
```javascript | ||
var mockStyles = (req) => 'style.css' === req; | ||
prunk.mock( mockStyles, 'no css, dude.'); | ||
``` | ||
@@ -82,6 +84,15 @@ `test` can also be a `RegExp` that is matched agains the name | ||
prunk.mock( 'style.css', 'no css, dude.' ); | ||
prunk.mock( /\.(css|scss|sass|less)/, 'no styles, dude.'); | ||
```javascript | ||
prunk.mock( 'style.css', 'no css, dude.' ); | ||
prunk.mock( /\.(css|scss|sass|less)/, 'no styles, dude.'); | ||
``` | ||
This function returns the prunk object so that you can chain calls. | ||
```javascript | ||
prunk.mock( ... ) | ||
.mock( ... ) | ||
.mock( ... ); | ||
``` | ||
### prunk.unmock(test) | ||
@@ -93,5 +104,8 @@ | ||
This function returns the prunk object so that you can chain calls. | ||
### prunk.unmockAll() | ||
Removes all mocks | ||
Removes all mocks. | ||
This function returns the prunk object so that you can chain calls. | ||
@@ -109,4 +123,6 @@ ### prunk.suppress(test) | ||
var mockStyles = (req) => 'style.css' === req; | ||
prunk.mock( mockStyles, 'no css, dude.'); | ||
```javascript | ||
var mockStyles = (req) => 'style.css' === req; | ||
prunk.mock( mockStyles, 'no css, dude.'); | ||
``` | ||
@@ -116,5 +132,9 @@ `test` can also be a `RegExp` that is matched agains the name | ||
prunk.mock( 'style.css', 'no css, dude.' ); | ||
prunk.mock( /\.(css|scss|sass|less)/, 'no styles, dude.'); | ||
```javascript | ||
prunk.mock( 'style.css', 'no css, dude.' ); | ||
prunk.mock( /\.(css|scss|sass|less)/, 'no styles, dude.'); | ||
``` | ||
This function returns the prunk object so that you can chain calls. | ||
### prunk.unsuppress(test) | ||
@@ -125,6 +145,8 @@ | ||
imports. | ||
This function returns the prunk object so that you can chain calls. | ||
### prunk.unsuppressAll() | ||
Removes all suppressed imports | ||
Removes all suppressed imports. | ||
This function returns the prunk object so that you can chain calls. | ||
@@ -131,0 +153,0 @@ ## Documentation |
@@ -92,2 +92,6 @@ /** | ||
it('should return the prunk object again', function() { | ||
expect( prunk.mock() ).to.equal( prunk ); | ||
}); | ||
}); | ||
@@ -145,2 +149,6 @@ | ||
}); | ||
it('should return the prunk object again', function() { | ||
expect( prunk.unmock() ).to.equal( prunk ); | ||
}); | ||
}); | ||
@@ -202,2 +210,6 @@ | ||
}); | ||
it('should return the prunk object again', function() { | ||
expect( prunk.unmockAll() ).to.equal( prunk ); | ||
}); | ||
}); | ||
@@ -253,2 +265,6 @@ | ||
}); | ||
it('should return the prunk object again', function() { | ||
expect( prunk.suppress() ).to.equal( prunk ); | ||
}); | ||
}); | ||
@@ -305,2 +321,6 @@ | ||
}); | ||
it('should return the prunk object again', function() { | ||
expect( prunk.unsuppress() ).to.equal( prunk ); | ||
}); | ||
}); | ||
@@ -362,2 +382,6 @@ | ||
}); | ||
it('should return the prunk object again', function() { | ||
expect( prunk.unsuppressAll() ).to.equal( prunk ); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33664
476
149