Skip to content

Commit 3a0f891

Browse files
committed
Move stripColors to a then modifier
1 parent b62f98c commit 3a0f891

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

test/helpers/run-k-in-javascript.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ function k() {
1515
return execa('eval', args, {shell: '/bin/zsh'}).then(({stdout}) => stdout);
1616
}
1717

18-
k.stripColors = function () {
19-
return k.apply(undefined, arguments)
20-
.then(stdout => stripAnsi(stdout));
18+
k.stripColors = function (stdout) {
19+
return stripAnsi(stdout);
2120
}
2221

23-
k.split = function splitToArray(stdout) {
22+
k.split = function (stdout) {
2423
return stdout.split(/\s?\n/);
2524
}
2625

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import test from 'ava';
2-
import {default as k, split} from './helpers/run-k-in-javascript';
2+
import {default as k, split, stripColors} from './helpers/run-k-in-javascript';
33

44
test('File and directory types', async t => {
5-
const lines = await k.stripColors('fixtures/one').then(split);
5+
const lines = await k('fixtures/one').then(stripColors).then(split);
66
t.is(lines[0], 'total 16');
77
t.is(lines[1], '-rwxr-sr-x 1 supercrabtree staff 0 10 Feb 20:19 | exe-with-gid');
88
t.is(lines[2], '-rwsr-sr-x 1 supercrabtree staff 0 10 Feb 20:42 | exe-with-gid-and-uid');

0 commit comments

Comments
 (0)