[Pkg-javascript-commits] [node-wrap-ansi] 01/01: restore files from upstream

Paolo Greppi paolog-guest at moszumanska.debian.org
Tue Nov 29 12:23:31 UTC 2016


This is an automated email from the git hooks/post-receive script.

paolog-guest pushed a commit to branch master
in repository node-wrap-ansi.

commit d8cb8b7aa93761eaae1cfcb44e65b9dbef31b02e
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date:   Tue Nov 29 13:20:54 2016 +0100

    restore files from upstream
---
 package.json |  3 ++-
 test.js      | 64 ++++++++++++++++++++++++++++++++++++------------------------
 2 files changed, 41 insertions(+), 26 deletions(-)

diff --git a/package.json b/package.json
index 97dba1e..960ea2d 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,8 @@
     "node": ">=0.10.0"
   },
   "scripts": {
-    "test": "mocha -u tdd"
+    "test": "xo && nyc node test.js",
+    "coverage": "nyc --reporter=text-lcov node test.js | coveralls"
   },
   "files": [
     "index.js"
diff --git a/test.js b/test.js
index 677517e..f976a75 100755
--- a/test.js
+++ b/test.js
@@ -1,5 +1,5 @@
 'use strict';
-var assert = require('assert');
+var test = require('ava');
 var chalk = require('chalk');
 var hasAnsi = require('has-ansi');
 var stripAnsi = require('strip-ansi');
@@ -10,73 +10,87 @@ var fn = require('./');
 var fixture = 'The quick brown ' + chalk.red('fox jumped over ') + 'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
 var fixture2 = '12345678\n901234567890';
 
-test('wraps string at 20 characters', function () {
+test('wraps string at 20 characters', function (t) {
 	var res20 = fn(fixture, 20);
 
-	assert(res20 === 'The quick brown \u001b[31mfox\u001b[39m\n\u001b[31mjumped over \u001b[39mthe lazy\n\u001b[32mdog and then ran\u001b[39m\n\u001b[32maway with the\u001b[39m\n\u001b[32municorn.\u001b[39m');
-	assert(stripAnsi(res20).split('\n').every(function (x) {
+	t.assert(res20 === 'The quick brown \u001b[31mfox\u001b[39m\n\u001b[31mjumped over \u001b[39mthe lazy\n\u001b[32mdog and then ran\u001b[39m\n\u001b[32maway with the\u001b[39m\n\u001b[32municorn.\u001b[39m');
+	t.assert(stripAnsi(res20).split('\n').every(function (x) {
 		return x.length <= 20;
 	}));
+
+	t.end();
 });
 
-test('wraps string at 30 characters', function () {
+test('wraps string at 30 characters', function (t) {
 	var res30 = fn(fixture, 30);
 
-	assert(res30 === 'The quick brown \u001b[31mfox jumped\u001b[39m\n\u001b[31mover \u001b[39mthe lazy \u001b[32mdog and then ran\u001b[39m\n\u001b[32maway with the unicorn.\u001b[39m');
-	assert(stripAnsi(res30).split('\n').every(function (x) {
+	t.assert(res30 === 'The quick brown \u001b[31mfox jumped\u001b[39m\n\u001b[31mover \u001b[39mthe lazy \u001b[32mdog and then ran\u001b[39m\n\u001b[32maway with the unicorn.\u001b[39m');
+	t.assert(stripAnsi(res30).split('\n').every(function (x) {
 		return x.length <= 30;
 	}));
+
+	t.end();
 });
 
-test('does not break strings longer than "cols" characters', function () {
+test('does not break strings longer than "cols" characters', function (t) {
 	var res5 = fn(fixture, 5, {hard: false});
 
-	assert(res5 === 'The\nquick\nbrown\n\u001b[31mfox\u001b[39m\n\u001b[31mjumped\u001b[39m\n\u001b[31mover\u001b[39m\n\u001b[31m\u001b[39mthe\nlazy\n\u001b[32mdog\u001b[39m\n\u001b[32mand\u001b[39m\n\u001b[32mthen\u001b[39m\n\u001b[32mran\u001b[39m\n\u001b[32maway\u001b[39m\n\u001b[32mwith\u001b[39m\n\u001b[32mthe\u001b[39m\n\u001b[32municorn.\u001b[39m');
-	assert(
+	t.assert(res5 === 'The\nquick\nbrown\n\u001b[31mfox\u001b[39m\n\u001b[31mjumped\u001b[39m\n\u001b[31mover\u001b[39m\n\u001b[31m\u001b[39mthe\nlazy\n\u001b[32mdog\u001b[39m\n\u001b[32mand\u001b[39m\n\u001b[32mthen\u001b[39m\n\u001b[32mran\u001b[39m\n\u001b[32maway\u001b[39m\n\u001b[32mwith\u001b[39m\n\u001b[32mthe\u001b[39m\n\u001b[32municorn.\u001b[39m');
+	t.assert(
 		stripAnsi(res5).split('\n').filter(function (x) {
 			return x.length > 5;
 		}).length > 0
 	);
+
+	t.end();
 });
 
-test('handles colored string that wraps on to multiple lines', function () {
+test('handles colored string that wraps on to multiple lines', function (t) {
 	var res = fn(chalk.green('hello world') + ' hey!', 5, {hard: false});
 	var lines = res.split('\n');
-	assert(hasAnsi(lines[0]));
-	assert(hasAnsi(lines[1]));
-	assert(hasAnsi(lines[2]) === false);
+	t.assert(hasAnsi(lines[0]));
+	t.assert(hasAnsi(lines[1]));
+	t.assert(hasAnsi(lines[2]) === false);
+	t.end();
 });
 
-test('does not prepend newline if first string is greater than "cols"', function () {
+test('does not prepend newline if first string is greater than "cols"', function (t) {
 	var res = fn(chalk.green('hello') + '-world', 5, {hard: false});
-	assert(res.split('\n').length === 1);
+	t.assert(res.split('\n').length === 1);
+	t.end();
 });
 
 // when "hard" is true
 
-test('breaks strings longer than "cols" characters', function () {
+test('breaks strings longer than "cols" characters', function (t) {
 	var res5 = fn(fixture, 5, {hard: true});
 
-	assert(res5 === 'The\nquick\nbrown\n\u001b[31mfox\u001b[39m\n\u001b[31mjumpe\u001b[39m\n\u001b[31md\u001b[39m\n\u001b[31mover\u001b[39m\n\u001b[31m\u001b[39mthe\nlazy\n\u001b[32mdog\u001b[39m\n\u001b[32mand\u001b[39m\n\u001b[32mthen\u001b[39m\n\u001b[32mran\u001b[39m\n\u001b[32maway\u001b[39m\n\u001b[32mwith\u001b[39m\n\u001b[32mthe\u001b[39m\n\u001b[32munico\u001b[39m\n\u001b[32mrn.\u001b[39m');
-	assert(stripAnsi(res5).split('\n').every(function (x) {
+	t.assert(res5 === 'The\nquick\nbrown\n\u001b[31mfox\u001b[39m\n\u001b[31mjumpe\u001b[39m\n\u001b[31md\u001b[39m\n\u001b[31mover\u001b[39m\n\u001b[31m\u001b[39mthe\nlazy\n\u001b[32mdog\u001b[39m\n\u001b[32mand\u001b[39m\n\u001b[32mthen\u001b[39m\n\u001b[32mran\u001b[39m\n\u001b[32maway\u001b[39m\n\u001b[32mwith\u001b[39m\n\u001b[32mthe\u001b[39m\n\u001b[32munico\u001b[39m\n\u001b[32mrn.\u001b[39m');
+	t.assert(stripAnsi(res5).split('\n').every(function (x) {
 		return x.length <= 5;
 	}));
+
+	t.end();
 });
 
-test('removes last row if it contained only ansi escape codes', function () {
+test('removes last row if it contained only ansi escape codes', function (t) {
 	var res = fn(chalk.green('helloworld'), 2, {hard: true});
 
-	assert(stripAnsi(res).split('\n').every(function (x) {
+	t.assert(stripAnsi(res).split('\n').every(function (x) {
 		return x.length === 2;
 	}));
+
+	t.end();
 });
 
-test('does not prepend newline if first word is split', function () {
+test('does not prepend newline if first word is split', function (t) {
 	var res = fn(chalk.green('hello') + 'world', 5, {hard: true});
-	assert(res.split('\n').length === 2);
+	t.assert(res.split('\n').length === 2);
+	t.end();
 });
 
-test('takes into account line returns inside input', function () {
+test('takes into account line returns inside input', function (t) {
 	var res20 = fn(fixture2, 10, {hard: true});
-	assert(res20 === '12345678\n9012345678\n90');
+	t.assert(res20 === '12345678\n9012345678\n90');
+	t.end();
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-wrap-ansi.git



More information about the Pkg-javascript-commits mailing list