[Pkg-javascript-commits] [node-cli-cursor] 04/04: enable build-time tests and autopkgtests

Paolo Greppi paolog-guest at moszumanska.debian.org
Fri Dec 23 11:19:11 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-cli-cursor.

commit 400dac8dca231208c597185cee07a495e7c85c89
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date:   Fri Dec 23 11:09:00 2016 +0000

    enable build-time tests and autopkgtests
---
 debian/control               |  2 +
 debian/patches/00-mocha.diff | 96 ++++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series        |  1 +
 debian/rules                 |  6 +--
 debian/tests/control         |  3 ++
 5 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/debian/control b/debian/control
index d7926ba..68e857d 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,8 @@ Uploaders: Paolo Greppi <paolo.greppi at libpf.com>
 Build-Depends:
  debhelper (>= 9)
  , dh-buildinfo
+ , node-restore-cursor (>= 1.0.1)
+ , mocha
  , nodejs
 Standards-Version: 3.9.8
 Homepage: https://github.com/sindresorhus/cli-cursor#readme
diff --git a/debian/patches/00-mocha.diff b/debian/patches/00-mocha.diff
new file mode 100644
index 0000000..77f90e5
--- /dev/null
+++ b/debian/patches/00-mocha.diff
@@ -0,0 +1,96 @@
+Description: Change from ava to mocha as test runner (ava is not yet
+ available as a Debian package). Skip the xo style linter test step
+ (xo is not available as a Debian package).
+ Something like:
+ sed -i 's/t => {/function() {/g' test.js 
+ sed -i 's/t.is/assert.equal/g' test.js 
+Forwarded: not-needed
+Author: Paolo Greppi <paolo.greppi at libpf.com>
+
+Index: node-cli-cursor/test.js
+===================================================================
+--- node-cli-cursor.orig/test.js
++++ node-cli-cursor/test.js
+@@ -1,13 +1,13 @@
+-import childProcess from 'child_process';
+-import test from 'ava';
+-import cliCursor from './';
++var childProcess = require('child_process');
++var assert = require('assert');
++var cliCursor = require('./');
+ 
+ const write = process.stdout.write;
+ const SHOW = '\u001b[?25h';
+ const HIDE = '\u001b[?25l';
+ 
+ function getStdout(fn) {
+-	let ret = '';
++	var ret = '';
+ 
+ 	process.stdout.setEncoding('utf8');
+ 	process.stdout.write = str => {
+@@ -19,48 +19,40 @@ function getStdout(fn) {
+ 	return ret;
+ }
+ 
+-test('show', t => {
+-	t.is(getStdout(cliCursor.show), SHOW);
+-	t.end();
++test('show', function() {
++	assert.equal(getStdout(cliCursor.show), SHOW);
+ });
+ 
+-test('hide', t => {
+-	t.is(getStdout(cliCursor.hide), HIDE);
+-	t.end();
++test('hide', function() {
++	assert.equal(getStdout(cliCursor.hide), HIDE);
+ });
+ 
+-test('toggle', t => {
++test('toggle', function() {
+ 	cliCursor.hide();
+-	t.is(getStdout(cliCursor.toggle), SHOW);
+-	t.end();
++	assert.equal(getStdout(cliCursor.toggle), SHOW);
+ });
+ 
+-test('toggle 2', t => {
++test('toggle 2', function() {
+ 	cliCursor.show();
+-	t.is(getStdout(cliCursor.toggle), HIDE);
+-	t.end();
++	assert.equal(getStdout(cliCursor.toggle), HIDE);
+ });
+ 
+-test('toggle force', t => {
++test('toggle force', function() {
+ 	cliCursor.show();
+-	t.is(getStdout(cliCursor.toggle.bind(null, true)), SHOW);
+-	t.end();
++	assert.equal(getStdout(cliCursor.toggle.bind(null, true)), SHOW);
+ });
+ 
+-test('toggle force 2', t => {
++test('toggle force 2', function() {
+ 	cliCursor.hide();
+-	t.is(getStdout(cliCursor.toggle.bind(null, true)), SHOW);
+-	t.end();
++	assert.equal(getStdout(cliCursor.toggle.bind(null, true)), SHOW);
+ });
+ 
+-test('toggle force 3', t => {
++test('toggle force 3', function() {
+ 	cliCursor.show();
+-	t.is(getStdout(cliCursor.toggle.bind(null, false)), HIDE);
+-	t.end();
++	assert.equal(getStdout(cliCursor.toggle.bind(null, false)), HIDE);
+ });
+ 
+ // used to fail, see sindresorhus/log-update#2
+-test('require', t => {
+-	t.is(childProcess.execSync('node index.js', {encoding: 'utf8'}), '');
+-	t.end();
++test('require', function() {
++	assert.equal(childProcess.execSync('node index.js', {encoding: 'utf8'}), '');
+ });
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..c508ffd
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+00-mocha.diff
diff --git a/debian/rules b/debian/rules
index de57af0..d59f162 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,7 +9,5 @@
 
 #override_dh_auto_build:
 
-#override_dh_auto_test:
-
-
-
+override_dh_auto_test:
+	mocha -u tdd -R spec
diff --git a/debian/tests/control b/debian/tests/control
index 7d017d7..9b95e60 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,5 @@
 Tests: require
 Depends: node-cli-cursor
+
+Test-Command: mocha -u tdd -R spec
+Depends: @, @builddeps@

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



More information about the Pkg-javascript-commits mailing list