heroku-cli-util
Advanced tools
Comparing version 5.10.3 to 5.10.4
@@ -77,6 +77,9 @@ 'use strict'; | ||
*/ | ||
function mock () { | ||
mocking = true; | ||
cli.stderr = ''; | ||
cli.stdout = ''; | ||
function mock (mock) { | ||
if (mock === false) mocking = false; | ||
else { | ||
mocking = true; | ||
cli.stderr = ''; | ||
cli.stdout = ''; | ||
} | ||
} | ||
@@ -100,2 +103,3 @@ | ||
exports.mock = mock; | ||
exports.mocking = () => mocking; | ||
exports.debug = debug; |
@@ -66,3 +66,3 @@ 'use strict'; | ||
let fs = require('fs'); | ||
fs.appendFileSync(logPath, logtimestamp() + ' ' + msg + '\n'); | ||
fs.appendFileSync(logPath, logtimestamp() + ' ' + cli.color.stripColor(msg) + '\n'); | ||
} | ||
@@ -69,0 +69,0 @@ |
@@ -5,2 +5,4 @@ 'use strict'; | ||
let console = require('./console'); | ||
function findBestHerokuColor() { | ||
@@ -19,3 +21,2 @@ let color = require('./color'); | ||
text: '', | ||
stream: process.stderr | ||
}, options); | ||
@@ -32,6 +33,5 @@ | ||
this.color = findBestHerokuColor(); | ||
this.stream = this.options.stream; | ||
this.id = null; | ||
this.frameIndex = 0; | ||
this.enabled = (this.stream && this.stream.isTTY) && !process.env.CI; | ||
this.enabled = !console.mocking() && (process.stderr && process.stderr.isTTY) && !process.env.CI; | ||
} | ||
@@ -52,4 +52,4 @@ | ||
this.stream.clearLine(); | ||
this.stream.cursorTo(0); | ||
process.stderr.clearLine(); | ||
process.stderr.cursorTo(0); | ||
} | ||
@@ -59,3 +59,3 @@ | ||
this.clear(); | ||
this.stream.write(this.frame()); | ||
process.stderr.write(this.frame()); | ||
} | ||
@@ -66,3 +66,3 @@ | ||
if (!this.enabled) { | ||
this.stream.write(this.text); | ||
console.writeError(this.text); | ||
return; | ||
@@ -85,3 +85,3 @@ } | ||
this.clear(); | ||
this.stream.write(this.text); | ||
process.stderr.write(this.text); | ||
this.cursor.show(); | ||
@@ -93,3 +93,3 @@ } | ||
if (!this.enabled) { | ||
this.stream.write('\n' + this.text); | ||
console.writeError('\n' + this.text); | ||
} | ||
@@ -96,0 +96,0 @@ } |
{ | ||
"name": "heroku-cli-util", | ||
"version": "5.10.3", | ||
"version": "5.10.4", | ||
"description": "Set of helpful CLI utilities", | ||
@@ -14,3 +14,4 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "jshint . && mocha", | ||
"test": "nyc mocha --require ./test/helpers.js && jshint .", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"preversion": "npm test", | ||
@@ -22,2 +23,4 @@ "postversion": "npm publish && git push && git push --tags", | ||
"chai": "^3.0.0", | ||
"coveralls": "2.11.9", | ||
"hook-std": "0.2.0", | ||
"jsdoc": "*", | ||
@@ -28,2 +31,3 @@ "jshint": "*", | ||
"nock": "8.0.0", | ||
"nyc": "6.2.1", | ||
"proxyquire": "1.7.4", | ||
@@ -30,0 +34,0 @@ "sinon": "1.17.3", |
@@ -5,3 +5,3 @@ # heroku-cli-util | ||
[![npm version](https://badge.fury.io/js/heroku-cli-util.svg)](http://badge.fury.io/js/heroku-cli-util) | ||
[![Inline docs](http://inch-ci.org/github/heroku/heroku-cli-util.svg?branch=master)](http://inch-ci.org/github/heroku/heroku-cli-util) | ||
[![Coverage Status](https://coveralls.io/repos/github/heroku/heroku-cli-util/badge.svg?branch=master)](https://coveralls.io/github/heroku/heroku-cli-util?branch=master) | ||
@@ -8,0 +8,0 @@ Set of helpful CLI utilities |
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
385801
29
2556
12