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

test-console

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

test-console - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

5

package.json
{
"name": "test-console",
"version": "0.7.0",
"version": "0.7.1",
"description": "A simple and pragmatic library for testing Node.js console output.",

@@ -19,4 +19,3 @@ "main": "src/index.js",

"spy",
"test",
"double"
"test double"
],

@@ -23,0 +22,0 @@ "author": "James Shore",

4

README.md

@@ -15,3 +15,3 @@ # test-console

console.log("foo");
};
});
assert.deepEqual(output, [ "foo\n "]);

@@ -158,2 +158,4 @@ ```

__0.7.1:__ Bug fix: Sync() versions restore old behavior even if exception occurs
__0.7.0:__ Initial release: `inspect()`, `inspectSync()`, `ignore()`, and `ignoreSync()`

@@ -160,0 +162,0 @@

@@ -62,2 +62,20 @@ // Copyright (c) 2014 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.

it("restores old behavior even when an exception occurs", function() {
// inception!
stdout.inspectSync(function(output) {
var exceptionPropagated = false;
try {
stdout.inspectSync(function() {
throw new Error("intentional exception");
});
}
catch (err) {
exceptionPropagated = true;
}
assert.isTrue(exceptionPropagated, "exception should be propagated");
console.log("foo");
assert.deepEqual(output, [ "foo\n" ], "console should be restored");
});
});
it("also returns output", function() {

@@ -64,0 +82,0 @@ var output = stdout.inspectSync(function() {

@@ -16,3 +16,3 @@ // Copyright (c) 2014 Titanium I.T. LLC. All rights reserved. For license, see "README" or "LICENSE" file.

var originalStdout = stream.write;
var originalWrite = stream.write;
stream.write = function(string) {

@@ -25,3 +25,3 @@ output.push(string);

restore: function() {
stream.write = originalStdout;
stream.write = originalWrite;
}

@@ -33,4 +33,8 @@ };

var inspect = this.inspect();
fn(inspect.output);
inspect.restore();
try {
fn(inspect.output);
}
finally {
inspect.restore();
}
return inspect.output;

@@ -37,0 +41,0 @@ };

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