jest-util
Advanced tools
Comparing version 14.2.0-alpha.ca8bfb6e to 14.2.1-alpha.e21d71a4
@@ -10,37 +10,52 @@ /** | ||
*/ | ||
/* global stream$Writable */ | ||
'use strict'; | ||
// Copyright Joyent, Inc. and other Node contributors. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
'use strict'; | ||
const util = require('util'); | ||
const Console = require('console').Console; | ||
const chalk = require('chalk'); | ||
const clearLine = require('./clearLine'); | ||
const format = require('util').format; | ||
class CustomConsole extends Console { | ||
constructor( | ||
stdout, | ||
stderr, | ||
formatBuffer) | ||
{ | ||
super(stdout, stderr); | ||
this._formatBuffer = | ||
formatBuffer || ((type, message) => type + ' ' + message); | ||
} | ||
_log(type, message) { | ||
clearLine(this._stdout); | ||
super.log(this._formatBuffer(type, message)); | ||
} | ||
log() { | ||
this._log('log', format.apply(null, arguments)); | ||
} | ||
info() { | ||
this._log('info', format.apply(null, arguments)); | ||
} | ||
warn() { | ||
return super.warn(chalk.yellow(util.format.apply(this, arguments))); | ||
this._log('warn', format.apply(null, arguments)); | ||
} | ||
error() { | ||
return super.error(chalk.red(util.format.apply(this, arguments))); | ||
this._log('error', format.apply(null, arguments)); | ||
} | ||
getBuffer() { | ||
return null; | ||
}} | ||
@@ -47,0 +62,0 @@ |
@@ -58,2 +58,3 @@ /** | ||
exports.clearLine = require('./clearLine'); | ||
exports.createDirectory = createDirectory; | ||
@@ -60,0 +61,0 @@ exports.escapeStrForRegex = escapeStrForRegex; |
@@ -13,3 +13,3 @@ /** | ||
const Console = require('console').Console; | ||
const Console = require('./Console'); | ||
@@ -16,0 +16,0 @@ class NullConsole extends Console { |
{ | ||
"name": "jest-util", | ||
"version": "14.2.0-alpha.ca8bfb6e", | ||
"version": "14.2.1-alpha.e21d71a4", | ||
"repository": { | ||
@@ -14,4 +14,4 @@ "type": "git", | ||
"graceful-fs": "^4.1.3", | ||
"mkdirp": "^0.5.1", | ||
"jest-mock": "^14.2.0-alpha.ca8bfb6e" | ||
"jest-mock": "^14.2.1-alpha.e21d71a4", | ||
"mkdirp": "^0.5.1" | ||
}, | ||
@@ -18,0 +18,0 @@ "devDependencies": { |
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
12
896
30986
+ Addedjest-mock@14.2.1-alpha.e21d71a4(transitive)
- Removedjest-mock@14.2.0-alpha.ca8bfb6e(transitive)