colorprint
Advanced tools
Comparing version
@@ -7,7 +7,7 @@ #!/usr/bin/env node | ||
var apeTasking = require('ape-tasking'), | ||
const apeTasking = require('ape-tasking'), | ||
coz = require('coz'); | ||
apeTasking.runTasks('build', [ | ||
function (callback) { | ||
(callback) => { | ||
coz.render([ | ||
@@ -14,0 +14,0 @@ '.*.bud', |
@@ -11,7 +11,7 @@ #!/usr/bin/env node | ||
var apeTasking = require('ape-tasking'), | ||
const apeTasking = require('ape-tasking'), | ||
apeCovering = require('ape-covering'); | ||
apeTasking.runTasks('cover', [ | ||
function (callback) { | ||
(callback) => { | ||
apeCovering.measureCoverage( | ||
@@ -18,0 +18,0 @@ require.resolve('./test.js'), [], { |
@@ -11,3 +11,3 @@ #!/usr/bin/env node | ||
var apeTasking = require('ape-tasking'), | ||
const apeTasking = require('ape-tasking'), | ||
apeReleasing = require('ape-releasing'); | ||
@@ -17,9 +17,7 @@ | ||
apeTasking.runTasks('release', [ | ||
function (callback) { | ||
(callback) => { | ||
apeReleasing.releasePackage({ | ||
beforeRelease: [ | ||
'./ci/build.js', | ||
'./ci/test.js', | ||
'./ci/doc.js', | ||
'./ci/deploy.js' | ||
'./ci/test.js' | ||
] | ||
@@ -26,0 +24,0 @@ }, callback); |
@@ -11,9 +11,9 @@ #!/usr/bin/env node | ||
var apeTasking = require('ape-tasking'), | ||
const apeTasking = require('ape-tasking'), | ||
apeReporting = require('ape-reporting'); | ||
apeTasking.runTasks([ | ||
function (callback) { | ||
(callback) => { | ||
apeReporting.sendToCodeclimate('doc/coverage/lcov.info', callback); | ||
} | ||
], true); |
@@ -11,9 +11,9 @@ #!/usr/bin/env node | ||
var apeTasking = require('ape-tasking'), | ||
const apeTasking = require('ape-tasking'), | ||
apeTesting = require('ape-testing'); | ||
apeTasking.runTasks('test', [ | ||
function (callback) { | ||
apeTesting.runNodeunit('test/**/*_test.js', callback); | ||
(callback) => { | ||
apeTesting.runMocha('test/**/*_test.js', callback); | ||
} | ||
], true); |
@@ -11,9 +11,9 @@ #!/usr/bin/env node | ||
var apeTasking = require('ape-tasking'), | ||
const apeTasking = require('ape-tasking'), | ||
apeUpdating = require('ape-updating'); | ||
apeTasking.runTasks('update', [ | ||
function renderBud(callback) { | ||
(callback) => { | ||
apeUpdating.updateDependencies({}, callback); | ||
} | ||
], true); |
@@ -1,3 +0,5 @@ | ||
var colorpint = require('colorpint'); | ||
"use strict"; | ||
const colorpint = require('colorpint'); | ||
colorpint.notice('This is NOTICE'); //Pipe to stdout with magenta color. | ||
@@ -7,3 +9,4 @@ colorpint.info('This is INFO'); //Pipe to stdout with green color. | ||
colorpint.trace('This is TRACE'); //Pipe to stdout with white color. | ||
colorpint.warn('This is WARN'); //Pipe to stdout with yellow color. | ||
colorpint.error('This is ERROR'); //Pipe to stderr with red color. | ||
colorpint.fatal('This is FATAL'); //Pipe to stderr with bgRed color. |
@@ -18,2 +18,6 @@ { | ||
}, | ||
"WARN": { | ||
"color": "yellow", | ||
"error": false | ||
}, | ||
"ERROR": { | ||
@@ -20,0 +24,0 @@ "color": "red", |
@@ -11,3 +11,3 @@ /** | ||
var formatMsg = require('./msg/format_msg'), | ||
const formatMsg = require('./msg/format_msg'), | ||
decorateMsg = require('./msg/decorate_msg'), | ||
@@ -19,3 +19,3 @@ indentMsg = require('./msg/indent_msg'), | ||
function Colorprint() { | ||
var s = this; | ||
let s = this; | ||
s.init.apply(s, arguments); | ||
@@ -27,8 +27,8 @@ } | ||
prepareMsg: function () { | ||
var s = this; | ||
var msg = formatMsg.apply(formatMsg, arguments); | ||
let s = this; | ||
let msg = formatMsg.apply(formatMsg, arguments); | ||
return [s.PREFIX, indentMsg(msg, s.indent), s.SUFFIX].join(''); | ||
}, | ||
writeToStdout: function (msg, color) { | ||
var s = this; | ||
let s = this; | ||
if(s.disabled) { | ||
@@ -50,2 +50,4 @@ return; | ||
TRACE_COLOR: 'white', | ||
/** Color for warn print. */ | ||
WARN_COLOR: 'yellow', | ||
/** Color for error print. */ | ||
@@ -57,3 +59,3 @@ ERROR_COLOR: 'red', | ||
NOTICE: function () { | ||
var s = this; | ||
let s = this; | ||
s.notice.apply(s, arguments); | ||
@@ -63,3 +65,3 @@ }, | ||
INFO: function () { | ||
var s = this; | ||
let s = this; | ||
s.info.apply(s, arguments); | ||
@@ -69,3 +71,3 @@ }, | ||
DEBUG: function () { | ||
var s = this; | ||
let s = this; | ||
s.debug.apply(s, arguments); | ||
@@ -75,8 +77,13 @@ }, | ||
TRACE: function () { | ||
var s = this; | ||
let s = this; | ||
s.trace.apply(s, arguments); | ||
}, | ||
/** Alias for module:colorprint/lib~Colorprint#warn. */ | ||
WARN: function () { | ||
let s = this; | ||
s.warn.apply(s, arguments); | ||
}, | ||
/** Alias for module:colorprint/lib~Colorprint#error. */ | ||
ERROR: function () { | ||
var s = this; | ||
let s = this; | ||
s.error.apply(s, arguments); | ||
@@ -86,3 +93,3 @@ }, | ||
FATAL: function () { | ||
var s = this; | ||
let s = this; | ||
s.fatal.apply(s, arguments); | ||
@@ -92,3 +99,3 @@ }, | ||
init: function (config) { | ||
var s = this; | ||
let s = this; | ||
extend(s, config); | ||
@@ -107,3 +114,3 @@ }, | ||
notice: function (msg) { | ||
var s = this; | ||
let s = this; | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.NOTICE_COLOR); | ||
@@ -116,3 +123,3 @@ }, | ||
info: function (msg) { | ||
var s = this; | ||
let s = this; | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.INFO_COLOR); | ||
@@ -125,3 +132,3 @@ }, | ||
debug: function (msg) { | ||
var s = this; | ||
let s = this; | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.DEBUG_COLOR); | ||
@@ -134,6 +141,14 @@ }, | ||
trace: function (msg) { | ||
var s = this; | ||
let s = this; | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.TRACE_COLOR); | ||
}, | ||
/** | ||
* Print warn message. | ||
* @param {...string} msg - Message to print. | ||
*/ | ||
warn: function (msg) { | ||
let s = this; | ||
s.writeToStdout(s.prepareMsg.apply(s, arguments), s.WARN_COLOR); | ||
}, | ||
/** | ||
* Print error message. | ||
@@ -143,3 +158,3 @@ * @param {...string} msg - Message to print. | ||
error: function (msg) { | ||
var s = this; | ||
let s = this; | ||
s.writeToStderr(s.prepareMsg.apply(s, arguments), s.ERROR_COLOR); | ||
@@ -152,3 +167,3 @@ }, | ||
fatal: function (msg) { | ||
var s = this; | ||
let s = this; | ||
s.writeToStderr(s.prepareMsg.apply(s, arguments), s.FATAL_COLOR); | ||
@@ -155,0 +170,0 @@ } |
@@ -11,3 +11,3 @@ /** | ||
var Colorprint = require('./colorprint'); | ||
const Colorprint = require('./colorprint'); | ||
@@ -14,0 +14,0 @@ /** @lends create */ |
@@ -11,3 +11,3 @@ /** | ||
var create = require('./create'), | ||
const create = require('./create'), | ||
extend = require('extend'); | ||
@@ -18,3 +18,3 @@ | ||
function Logger(config){ | ||
var s = this; | ||
let s = this; | ||
extend(s, config); | ||
@@ -21,0 +21,0 @@ } |
/** | ||
* Print ansi-colored message to stdout/stderr. | ||
* @version 2.1.0 | ||
* @version 3.0.0 | ||
* @module colorprint | ||
@@ -14,3 +14,3 @@ * @author {@link http://okunishitaka.com|Taka Okunishi | ||
var Colorprint = require('./colorprint'), | ||
const Colorprint = require('./colorprint'), | ||
pkg = require('../package.json'), | ||
@@ -21,3 +21,3 @@ cliColor = require('cli-color'), | ||
var colorprint = create(); | ||
let colorprint = create(); | ||
colorprint.create = create; | ||
@@ -24,0 +24,0 @@ colorprint.define = define; |
@@ -13,3 +13,3 @@ /** | ||
var cliColor = require('cli-color'); | ||
const cliColor = require('cli-color'); | ||
@@ -21,3 +21,3 @@ /** @lends decorateMsg */ | ||
} | ||
var decorator = color && cliColor[color]; | ||
let decorator = color && cliColor[color]; | ||
if (!decorator) { | ||
@@ -24,0 +24,0 @@ throw new Error('Unknown color: ' + color); |
@@ -13,4 +13,4 @@ /** | ||
function formatMsg(msg) { | ||
var s = this; | ||
msg = Array.prototype.slice.call(arguments, 0).map(function (msg) { | ||
let s = this; | ||
msg = Array.prototype.slice.call(arguments, 0).map((msg) => { | ||
if (typeof(msg) === 'object') { | ||
@@ -28,3 +28,3 @@ try { | ||
} | ||
var formatted = msg.shift().replace(/%(.)/g, function ($0, $1) { | ||
let formatted = msg.shift().replace(/%(.)/g, ($0, $1) => { | ||
switch ($1) { | ||
@@ -31,0 +31,0 @@ case 's': |
@@ -11,5 +11,5 @@ /** | ||
var os = require('os'); | ||
const os = require('os'); | ||
var EOL = os.EOL, | ||
const EOL = os.EOL, | ||
TAB = '\t'; | ||
@@ -19,4 +19,4 @@ | ||
function indentMsg(msg, depth) { | ||
var indent = ''; | ||
for (var i = 0; i < depth; i++) { | ||
let indent = ''; | ||
for (let i = 0; i < depth; i++) { | ||
indent += TAB; | ||
@@ -23,0 +23,0 @@ } |
{ | ||
"name": "colorprint", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Print ansi-colored message to stdout/stderr.", | ||
@@ -29,15 +29,2 @@ "main": "lib", | ||
"homepage": "https://github.com/okunishinishi/node-colorprint#readme", | ||
"devDependencies": { | ||
"ape-covering": "^1.1.0", | ||
"ape-deploying": "^1.0.8", | ||
"ape-releasing": "^1.0.16", | ||
"ape-reporting": "^1.0.9", | ||
"ape-tasking": "^1.0.8", | ||
"ape-testing": "^1.5.0", | ||
"ape-tmpl": "^1.3.16", | ||
"ape-updating": "^1.1.1", | ||
"apiguide": "^1.0.10", | ||
"coz": "^3.1.6", | ||
"coz-tmpl": "^1.1.0" | ||
}, | ||
"dependencies": { | ||
@@ -47,3 +34,18 @@ "cli-color": "^1.1.0", | ||
"extend": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"ape-covering": "^2.0.0", | ||
"ape-deploying": "^2.0.0", | ||
"ape-releasing": "^2.0.0", | ||
"ape-reporting": "^2.0.3", | ||
"ape-tasking": "^2.0.0", | ||
"ape-testing": "^2.0.0", | ||
"ape-tmpl": "^2.0.5", | ||
"ape-updating": "^2.0.0", | ||
"apiguide": "^1.0.10", | ||
"coz": "^3.1.6" | ||
}, | ||
"engines": { | ||
"node": ">=4.0.0" | ||
} | ||
} |
@@ -71,4 +71,6 @@ colorprint | ||
```javascript | ||
var colorpint = require('colorpint'); | ||
"use strict"; | ||
const colorpint = require('colorpint'); | ||
colorpint.notice('This is NOTICE'); //Pipe to stdout with magenta color. | ||
@@ -78,2 +80,3 @@ colorpint.info('This is INFO'); //Pipe to stdout with green color. | ||
colorpint.trace('This is TRACE'); //Pipe to stdout with white color. | ||
colorpint.warn('This is WARN'); //Pipe to stdout with yellow color. | ||
colorpint.error('This is ERROR'); //Pipe to stderr with red color. | ||
@@ -99,3 +102,2 @@ colorpint.fatal('This is FATAL'); //Pipe to stderr with bgRed color. | ||
### From Command Line | ||
@@ -110,2 +112,3 @@ | ||
colorpint trace "This is TRACE from CLI" # Pipe to stdout with white color. | ||
colorpint warn "This is WARN from CLI" # Pipe to stdout with yellow color. | ||
colorpint error "This is ERROR from CLI" # Pipe to stderr with red color. | ||
@@ -117,7 +120,5 @@ colorpint fatal "This is FATAL from CLI" # Pipe to stderr with bgRed color. | ||
Fore more detail, see [API Guide of colorpint functions](http://okunishinishi.github.io/node-colorprint/apiguide/module-colorprint_lib.html). | ||
<!-- Section from "doc/readme/03-CLI.md.hbs" End --> | ||
@@ -134,3 +135,5 @@ | ||
```javascript | ||
var colorprint = require('colorprint'); | ||
"use strict"; | ||
const colorprint = require('colorprint'); | ||
colorprint.PREFIX='Yeah!'; | ||
@@ -145,4 +148,6 @@ colorprint.INFO_COLOR='blue'; | ||
```javascript | ||
var Colorprint = require('colorprint/lib/colorprint'); | ||
var colorprint = new Colorprint({ | ||
"use strict"; | ||
const Colorprint = require('colorprint/lib/colorprint'); | ||
let colorprint = new Colorprint({ | ||
PREFIX: '[Foo]', | ||
@@ -156,3 +161,3 @@ INFO_COLOR: 'blue' | ||
colorpint is using [cli-color](https://github.com/medikoo/cli-color) for coloring and you can see [available colors here](https://github.com/medikoo/cli-color#colors). | ||
colorprint is using [cli-color](https://github.com/medikoo/cli-color) for coloring and you can see [available colors here](https://github.com/medikoo/cli-color#colors). | ||
@@ -159,0 +164,0 @@ |
/** | ||
* Test case for colorprint bin. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var bin = require.resolve('../bin/colorprint'), | ||
const bin = require.resolve('../bin/colorprint'), | ||
assert = require('assert'), | ||
childProcess = require('child_process'); | ||
function _spawn(command, args) { | ||
var spawned = childProcess.spawn(command, args); | ||
spawned.stdout.pipe(process.stdout); | ||
spawned.stderr.pipe(process.stderr); | ||
} | ||
describe('bin', ()=> { | ||
function _spawn(command, args) { | ||
let spawned = childProcess.spawn(command, args); | ||
spawned.stdout.pipe(process.stdout); | ||
spawned.stderr.pipe(process.stderr); | ||
} | ||
exports['Print.'] = function (test) { | ||
_spawn(bin, ['notice', 'This is notice', 'from cli.']); | ||
_spawn(bin, ['info', 'This is info', 'from cli.']); | ||
_spawn(bin, ['debug', 'This is debug', 'from cli.']); | ||
_spawn(bin, ['trace', 'This is trace', 'from cli.']); | ||
_spawn(bin, ['error', 'This is error', 'from cli.']); | ||
_spawn(bin, ['fatal', 'This is fatal', 'from cli.']); | ||
test.done(); | ||
}; | ||
it('Print.', (done) => { | ||
_spawn(bin, ['notice', 'This is notice', 'from cli.']); | ||
_spawn(bin, ['info', 'This is info', 'from cli.']); | ||
_spawn(bin, ['debug', 'This is debug', 'from cli.']); | ||
_spawn(bin, ['trace', 'This is trace', 'from cli.']); | ||
_spawn(bin, ['error', 'This is error', 'from cli.']); | ||
_spawn(bin, ['fatal', 'This is fatal', 'from cli.']); | ||
done(); | ||
}); | ||
}); |
/** | ||
* Test case for colorprint. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var Colorprint = require('../lib/colorprint.js'); | ||
const Colorprint = require('../lib/colorprint.js'), | ||
assert = require('assert'); | ||
exports['Colorprint'] = function (test) { | ||
var colorprint = new Colorprint({}); | ||
colorprint.notice('This is notice'); | ||
colorprint.info('This is info'); | ||
colorprint.debug('This is debug'); | ||
colorprint.trace('This is trace'); | ||
colorprint.error('This is error'); | ||
colorprint.fatal('This is fatal'); | ||
describe('colorpint', () => { | ||
it('Colorprint', (done) => { | ||
let colorprint = new Colorprint({}); | ||
colorprint.notice('This is notice'); | ||
colorprint.info('This is info'); | ||
colorprint.debug('This is debug'); | ||
colorprint.trace('This is trace'); | ||
colorprint.error('This is error'); | ||
colorprint.warn('This is warn'); | ||
colorprint.fatal('This is fatal'); | ||
colorprint.INFO('This is INFO'); | ||
colorprint.DEBUG('This is DEBUG'); | ||
colorprint.TRACE('This is TRACE'); | ||
colorprint.ERROR('This is ERROR'); | ||
colorprint.FATAL('This is FATAL'); | ||
test.done(); | ||
}; | ||
colorprint.INFO('This is INFO'); | ||
colorprint.DEBUG('This is DEBUG'); | ||
colorprint.TRACE('This is TRACE'); | ||
colorprint.ERROR('This is ERROR'); | ||
colorprint.WARN('This is WARN'); | ||
colorprint.FATAL('This is FATAL'); | ||
done(); | ||
}); | ||
exports['Colorprint with indent'] = function (test) { | ||
var colorprint = new Colorprint({ | ||
indent: 2 | ||
it('Colorprint with indent', (done) => { | ||
let colorprint = new Colorprint({ | ||
indent: 2 | ||
}); | ||
colorprint.notice('This is indented notice'); | ||
colorprint.info('This is indented info'); | ||
colorprint.debug('This is indented debug'); | ||
colorprint.trace('This is indented trace'); | ||
colorprint.error('This is indented error'); | ||
colorprint.warn('This is indented warn'); | ||
colorprint.fatal('This is indented fatal'); | ||
colorprint.INFO('This is indented INFO'); | ||
colorprint.DEBUG('This is indented DEBUG'); | ||
colorprint.TRACE('This is indented TRACE'); | ||
colorprint.WARN('This is indented WARN'); | ||
colorprint.ERROR('This is indented ERROR'); | ||
colorprint.FATAL('This is indented FATAL'); | ||
done(); | ||
}); | ||
colorprint.notice('This is indented notice'); | ||
colorprint.info('This is indented info'); | ||
colorprint.debug('This is indented debug'); | ||
colorprint.trace('This is indented trace'); | ||
colorprint.error('This is indented error'); | ||
colorprint.fatal('This is indented fatal'); | ||
colorprint.INFO('This is indented INFO'); | ||
colorprint.DEBUG('This is indented DEBUG'); | ||
colorprint.TRACE('This is indented TRACE'); | ||
colorprint.ERROR('This is indented ERROR'); | ||
colorprint.FATAL('This is indented FATAL'); | ||
test.done(); | ||
}; | ||
exports['Customize color print.'] = function (test) { | ||
var colorprint = new Colorprint({ | ||
PREFIX: 'Yeah!', | ||
SUFFIX: 'That\'s it!', | ||
INFO_COLOR: 'blue' | ||
it('Customize color print.', (done) => { | ||
let colorprint = new Colorprint({ | ||
PREFIX: 'Yeah!', | ||
SUFFIX: 'That\'s it!', | ||
INFO_COLOR: 'blue' | ||
}); | ||
colorprint.info('This will be blue with prefix.'); | ||
done(); | ||
}); | ||
colorprint.info('This will be blue with prefix.'); | ||
test.done(); | ||
}; | ||
}); |
/** | ||
* Test case for create. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var create = require('../lib/create.js'); | ||
const create = require('../lib/create.js'), | ||
assert = require('assert'); | ||
exports.setUp = function(done) { | ||
done(); | ||
}; | ||
describe('create', () => { | ||
exports.tearDown = function(done) { | ||
done(); | ||
}; | ||
it('Create', (done) => { | ||
assert.ok(create({})); | ||
done(); | ||
}); | ||
}); | ||
exports['Create'] = function(test){ | ||
test.ok(create({})); | ||
test.done(); | ||
}; | ||
/** | ||
* Test case for decorateMsg. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var decorateMsg = require('../lib/msg/decorate_msg.js'); | ||
const decorateMsg = require('../lib/msg/decorate_msg.js'), | ||
assert = require('assert'); | ||
exports['Decorate msg'] = function (test) { | ||
test.ok(decorateMsg('foo', 'green')); | ||
test.equal(decorateMsg(null), null); | ||
test.done(); | ||
}; | ||
describe('decorate', ()=> { | ||
it('Decorate msg', (done) => { | ||
assert.ok(decorateMsg('foo', 'green')); | ||
assert.equal(decorateMsg(null), null); | ||
done(); | ||
}); | ||
exports['Decorate msg with invalid color.'] = function (test) { | ||
test.throws(function () { | ||
decorateMsg('foo', '__not_existing_color'); | ||
it('Decorate msg with invalid color.', (done) => { | ||
assert.throws(function () { | ||
decorateMsg('foo', '__not_existing_color'); | ||
}); | ||
done(); | ||
}); | ||
test.done(); | ||
}; | ||
}); | ||
/** | ||
* Test case for define. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var define = require('../lib/define.js'); | ||
const define = require('../lib/define.js'), | ||
assert = require('assert'); | ||
exports.setUp = function(done) { | ||
done(); | ||
}; | ||
describe('define', ()=> { | ||
exports.tearDown = function(done) { | ||
done(); | ||
}; | ||
exports['Define'] = function(test){ | ||
var Logger = define({ | ||
verbose:false | ||
it('Define', (done) => { | ||
let Logger = define({ | ||
verbose: false | ||
}); | ||
let logger = new Logger({}); | ||
logger.INFO('This is custom INFO'); | ||
logger.DEBUG('This is custom DEBUG'); | ||
logger.TRACE('This is custom TRACE'); | ||
logger.ERROR('This is custom ERROR'); | ||
logger.WARN('This is custom WARN'); | ||
logger.FATAL('This is custom FATAL'); | ||
done(); | ||
}); | ||
var logger = new Logger({}); | ||
logger.INFO('This is custom INFO'); | ||
logger.DEBUG('This is custom DEBUG'); | ||
logger.TRACE('This is custom TRACE'); | ||
logger.ERROR('This is custom ERROR'); | ||
logger.FATAL('This is custom FATAL'); | ||
test.done(); | ||
}; | ||
}); | ||
/** | ||
* Test case for formatMsg. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var formatMsg = require('../lib/msg/format_msg.js'); | ||
const formatMsg = require('../lib/msg/format_msg.js'), | ||
assert = require('assert'); | ||
exports['Format msg'] = function (test) { | ||
test.equal(formatMsg('Hey, my name is %s, I am %d years old.', 'John', 34, 'Hoo!'), "Hey, my name is John, I am 34 years old. Hoo!"); | ||
test.equal(formatMsg(''), ''); | ||
test.equal(formatMsg(), ''); | ||
test.equal(formatMsg('foo%f', 0.4), 'foo0.4'); | ||
test.equal(formatMsg('foo%j', 0.4), 'foo%j 0.4'); | ||
test.done(); | ||
}; | ||
describe('format', () => { | ||
it('Format msg', (done) => { | ||
assert.equal(formatMsg('Hey, my name is %s, I am %d years old.', 'John', 34, 'Hoo!'), "Hey, my name is John, I am 34 years old. Hoo!"); | ||
assert.equal(formatMsg(''), ''); | ||
assert.equal(formatMsg(), ''); | ||
assert.equal(formatMsg('foo%f', 0.4), 'foo0.4'); | ||
assert.equal(formatMsg('foo%j', 0.4), 'foo%j 0.4'); | ||
done(); | ||
}); | ||
exports['Format msg with object'] = function (test) { | ||
var msg = formatMsg({foo: 'bar'}, null); | ||
test.ok(msg); | ||
test.done(); | ||
}; | ||
it('Format msg with object', (done) => { | ||
let msg = formatMsg({foo: 'bar'}, null); | ||
assert.ok(msg); | ||
done(); | ||
}); | ||
}); | ||
/** | ||
* Test case for indentMsg. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var indentMsg = require('../lib/msg/indent_msg.js'); | ||
const indentMsg = require('../lib/msg/indent_msg.js'), | ||
assert = require('assert'); | ||
exports.setUp = function (done) { | ||
done(); | ||
}; | ||
describe('indent', () => { | ||
exports.tearDown = function (done) { | ||
done(); | ||
}; | ||
it('Indent msg', (done) => { | ||
assert.equal(indentMsg('foo', 2).trim(), 'foo'); | ||
done(); | ||
}); | ||
}); | ||
exports['Indent msg'] = function (test) { | ||
test.equal(indentMsg('foo', 2).trim(), 'foo'); | ||
test.done(); | ||
}; | ||
/** | ||
* Test case for lib. | ||
* Runs with nodeunit. | ||
* Runs with mocha. | ||
*/ | ||
"use strict"; | ||
var lib = require('../lib'); | ||
const lib = require('../lib'), | ||
assert = require('assert'); | ||
exports['Lib'] = function (test) { | ||
test.ok(lib.create({})); | ||
test.ok(new lib.Colorprint({})); | ||
lib.colors.red('foo'); | ||
lib.notice('This is notice'); | ||
lib.info('This is info'); | ||
lib.debug('This is debug'); | ||
lib.trace('This is trace'); | ||
lib.error('This is error'); | ||
lib.fatal('This is fatal'); | ||
describe('lib', () => { | ||
it('Lib', (done) => { | ||
assert.ok(lib.create({})); | ||
assert.ok(new lib.Colorprint({})); | ||
lib.colors.red('foo'); | ||
lib.notice('This is notice'); | ||
lib.info('This is info'); | ||
lib.debug('This is debug'); | ||
lib.trace('This is trace'); | ||
lib.error('This is error'); | ||
lib.warn('This is warn'); | ||
lib.fatal('This is fatal'); | ||
lib.INFO('This is INFO'); | ||
lib.DEBUG('This is DEBUG'); | ||
lib.TRACE('This is TRACE'); | ||
lib.ERROR('This is ERROR'); | ||
lib.FATAL('This is FATAL'); | ||
test.done(); | ||
}; | ||
lib.INFO('This is INFO'); | ||
lib.DEBUG('This is DEBUG'); | ||
lib.TRACE('This is TRACE'); | ||
lib.WARN('This is WARN'); | ||
lib.ERROR('This is ERROR'); | ||
lib.FATAL('This is FATAL'); | ||
process.nextTick(()=> { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
10
-9.09%0
-100%173
2.98%136435
-95.96%49
-52.43%612
-99.5%2
100%