Skip to content

Commit 15e1843

Browse files
committed
stripAnsi for tests
1 parent e1535eb commit 15e1843

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

tests/commands-test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const execa = require('execa');
88
const mkdirp = require('mkdirp');
99
const p = require('path').join;
1010
const strip = require('../utils').strip;
11+
const { stripVTControlCharacters: stripAnsi } = require('node:util');
1112

1213
const FEATURES = require('../features');
1314

@@ -99,15 +100,17 @@ QUnit.module('commands', (hooks) => {
99100
let feature = FEATURES[key];
100101

101102
assert.ok(
102-
result.stdout.indexOf(`${key} (Default: ${feature.default}`) >= 0,
103+
stripAnsi(result.stdout).indexOf(
104+
`${key} (Default: ${feature.default}`
105+
) >= 0,
103106
`it should include ${key} and its default value`
104107
);
105108
assert.ok(
106-
result.stdout.indexOf(feature.description) >= 0,
109+
stripAnsi(result.stdout).indexOf(feature.description) >= 0,
107110
`it should include the description for ${key}`
108111
);
109112
assert.ok(
110-
result.stdout.indexOf(feature.url) >= 0,
113+
stripAnsi(result.stdout).indexOf(feature.url) >= 0,
111114
`it should include the URL for ${key}`
112115
);
113116
});
@@ -190,7 +193,8 @@ QUnit.module('commands', (hooks) => {
190193
'it should print an error'
191194
);
192195
assert.ok(
193-
result.stdout.indexOf('foo-bar is not a valid feature') >= 0,
196+
stripAnsi(result.stdout).indexOf('foo-bar is not a valid feature') >=
197+
0,
194198
'it should print an error'
195199
);
196200
});
@@ -216,11 +220,11 @@ QUnit.module('commands', (hooks) => {
216220
);
217221

218222
assert.ok(
219-
result.stdout.indexOf('Error:') >= 0,
223+
stripAnsi(result.stdout).indexOf('Error:') >= 0,
220224
'it should print an error'
221225
);
222226
assert.ok(
223-
result.stdout.indexOf(
227+
stripAnsi(result.stdout).indexOf(
224228
'application-template-wrapper is only available in Ember 3.1.0 or above'
225229
) >= 0,
226230
'it should print an error'

0 commit comments

Comments
 (0)