Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npmlog/test/progress.js')
-rw-r--r--deps/npm/node_modules/npmlog/test/progress.js33
1 files changed, 25 insertions, 8 deletions
diff --git a/deps/npm/node_modules/npmlog/test/progress.js b/deps/npm/node_modules/npmlog/test/progress.js
index 97b13ded2c6..68dca2afc73 100644
--- a/deps/npm/node_modules/npmlog/test/progress.js
+++ b/deps/npm/node_modules/npmlog/test/progress.js
@@ -1,6 +1,7 @@
'use strict'
var test = require('tap').test
+var Progress = require('are-we-there-yet')
var log = require('../log.js')
var actions = []
@@ -38,9 +39,18 @@ function didActions(t, msg, output) {
actions = []
}
+function resetTracker() {
+ log.disableProgress()
+ log.tracker = new Progress.TrackerGroup()
+ log.enableProgress()
+ actions = []
+}
test('enableProgress', function (t) {
t.plan(6)
+ resetTracker()
+ log.disableProgress()
+ actions = []
log.enableProgress()
didActions(t, 'enableProgress', [ [ 'enable' ], [ 'show', undefined, 0 ] ])
log.enableProgress()
@@ -49,6 +59,7 @@ test('enableProgress', function (t) {
test('disableProgress', function (t) {
t.plan(4)
+ resetTracker()
log.disableProgress()
didActions(t, 'disableProgress', [ [ 'hide' ], [ 'disable' ] ])
log.disableProgress()
@@ -57,6 +68,9 @@ test('disableProgress', function (t) {
test('showProgress', function (t) {
t.plan(5)
+ resetTracker()
+ log.disableProgress()
+ actions = []
log.showProgress('foo')
didActions(t, 'showProgress disabled', [])
log.enableProgress()
@@ -67,6 +81,7 @@ test('showProgress', function (t) {
test('clearProgress', function (t) {
t.plan(3)
+ resetTracker()
log.clearProgress()
didActions(t, 'clearProgress', [ [ 'hide' ] ])
log.disableProgress()
@@ -77,10 +92,10 @@ test('clearProgress', function (t) {
test("newItem", function (t) {
t.plan(12)
- log.enableProgress()
+ resetTracker()
actions = []
var a = log.newItem("test", 10)
- didActions(t, "newItem", [ [ 'show', undefined, 0 ] ])
+ didActions(t, "newItem", [ [ 'show', 'test', 0 ] ])
a.completeWork(5)
didActions(t, "newItem:completeWork", [ [ 'show', 'test', 0.5 ] ])
a.finish()
@@ -90,24 +105,26 @@ test("newItem", function (t) {
// test that log objects proxy through. And test that completion status filters up
test("newGroup", function (t) {
t.plan(23)
+ resetTracker()
var a = log.newGroup("newGroup")
- didActions(t, "newGroup", [ [ 'show', undefined, 0.5 ] ])
+ didActions(t, 'newGroup', [[ 'show', 'newGroup', 0 ]])
a.warn("test", "this is a test")
- didActions(t, "newGroup:warn", [ [ 'pulse', 'test' ], [ 'hide' ], [ 'show', undefined, 0.5 ] ])
+ didActions(t, "newGroup:warn", [ [ 'pulse', 'test' ], [ 'hide' ], [ 'show', undefined, 0 ] ])
var b = a.newItem("newGroup2", 10)
- didActions(t, "newGroup:newItem", [ [ 'show', 'newGroup', 0.5 ] ])
+ didActions(t, "newGroup:newItem", [ [ 'show', 'newGroup2', 0 ] ])
b.completeWork(5)
- didActions(t, "newGroup:completeWork", [ [ 'show', 'newGroup2', 0.75 ] ])
+ didActions(t, "newGroup:completeWork", [ [ 'show', 'newGroup2', 0.5] ])
a.finish()
didActions(t, "newGroup:finish", [ [ 'show', 'newGroup', 1 ] ])
})
test("newStream", function (t) {
t.plan(13)
+ resetTracker()
var a = log.newStream("newStream", 10)
- didActions(t, "newStream", [ [ 'show', undefined, 0.6666666666666666 ] ])
+ didActions(t, "newStream", [ [ 'show', 'newStream', 0 ] ])
a.write("abcde")
- didActions(t, "newStream", [ [ 'show', 'newStream', 0.8333333333333333 ] ])
+ didActions(t, "newStream", [ [ 'show', 'newStream', 0.5 ] ])
a.write("fghij")
didActions(t, "newStream", [ [ 'show', 'newStream', 1 ] ])
t.is(log.tracker.completed(), 1, "Overall completion")