1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 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@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'}), '');
});
|