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
|
Description: Change from ava to mocha as test runner (ava is not yet
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
sed -i 's/let /var /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,6 +1,6 @@
-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.stderr.write;
const SHOW = '\u001b[?25h';
@@ -9,7 +9,7 @@ const HIDE = '\u001b[?25l';
process.stderr.isTTY = true;
function getStderr(fn) {
- let ret = '';
+ var ret = '';
process.stderr.setEncoding('utf8');
process.stderr.write = str => {
@@ -21,40 +21,40 @@ function getStderr(fn) {
return ret;
}
-test('show', t => {
- t.is(getStderr(cliCursor.show), SHOW);
+test('show', function() {
+ assert.equal(getStderr(cliCursor.show), SHOW);
});
-test('hide', t => {
- t.is(getStderr(cliCursor.hide), HIDE);
+test('hide', function() {
+ assert.equal(getStderr(cliCursor.hide), HIDE);
});
-test('toggle', t => {
+test('toggle', function() {
cliCursor.hide();
- t.is(getStderr(cliCursor.toggle), SHOW);
+ assert.equal(getStderr(cliCursor.toggle), SHOW);
});
-test('toggle 2', t => {
+test('toggle 2', function() {
cliCursor.show();
- t.is(getStderr(cliCursor.toggle), HIDE);
+ assert.equal(getStderr(cliCursor.toggle), HIDE);
});
-test('toggle force', t => {
+test('toggle force', function() {
cliCursor.show();
- t.is(getStderr(cliCursor.toggle.bind(null, true)), SHOW);
+ assert.equal(getStderr(cliCursor.toggle.bind(null, true)), SHOW);
});
-test('toggle force 2', t => {
+test('toggle force 2', function() {
cliCursor.hide();
- t.is(getStderr(cliCursor.toggle.bind(null, true)), SHOW);
+ assert.equal(getStderr(cliCursor.toggle.bind(null, true)), SHOW);
});
-test('toggle force 3', t => {
+test('toggle force 3', function() {
cliCursor.show();
- t.is(getStderr(cliCursor.toggle.bind(null, false)), HIDE);
+ assert.equal(getStderr(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'}), '');
+test('require', function() {
+ assert.equal(childProcess.execSync('node index.js', {encoding: 'utf8'}), '');
});
|