Skip to content

Commit 9201258

Browse files
committed
chore: putout: strip-ansi -> stripVTControlCharacters
1 parent 635f8a2 commit 9201258

File tree

8 files changed

+15
-18
lines changed

8 files changed

+15
-18
lines changed

packages/engine-reporter/lib/report.spec.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const {stripVTControlCharacters} = require('node:util');
34
const tryToCatch = require('try-to-catch');
45
const montag = require('montag');
56
const {test, stub} = require('supertape');
@@ -86,8 +87,7 @@ test('putout: report: dump', async (t) => {
8687
places,
8788
});
8889

89-
const stripAnsi = await simpleImport('strip-ansi');
90-
const result = stripAnsi(formatted);
90+
const result = stripVTControlCharacters(formatted);
9191

9292
const expected = montag`
9393
hello

packages/putout/bin/debugger-exit.spec.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {EventEmitter} from 'node:events';
2+
import {stripVTControlCharacters} from 'node:util';
23
import {test, stub} from 'supertape';
3-
import stripAnsi from 'strip-ansi';
44
import {onDebuggerExit} from './debugger-exit.mjs';
55

66
const {assign} = Object;
@@ -113,7 +113,7 @@ test('putout: cli: onDebuggerExit: log', (t) => {
113113
const expected = `node --inspect: 'kill 1337'`;
114114

115115
const [args] = log.args;
116-
const result = stripAnsi(args[0]);
116+
const result = stripVTControlCharacters(args[0]);
117117

118118
t.equal(result, expected);
119119
t.end();

packages/putout/bin/putout.spec.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {createRequire} from 'node:module';
22
import {spawnSync} from 'node:child_process';
3+
import {stripVTControlCharacters} from 'node:util';
34
import {test} from 'supertape';
4-
import stripAnsi from 'strip-ansi';
55

66
const require = createRequire(import.meta.url);
77
const cliPath = new URL('putout.mjs', import.meta.url).pathname;
@@ -31,7 +31,7 @@ test('putout: bin: cli: -f: object', (t) => {
3131
encoding: 'utf8',
3232
});
3333

34-
const result = stripAnsi(stderr);
34+
const result = stripVTControlCharacters(stderr);
3535

3636
t.equal(result, `🐊 Cannot find package 'putout-formatter-{}'\n`);
3737
t.end();

packages/putout/lib/cli/index.spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const {stripVTControlCharacters} = require('node:util');
34
const process = require('node:process');
45

56
const {join, basename} = require('node:path');
@@ -985,8 +986,7 @@ test('putout: cli: --staged --fix', async (t) => {
985986
const [allArgCalls] = logError.args;
986987
const [arg] = allArgCalls;
987988

988-
const stripAnsi = await simpleImport('strip-ansi');
989-
const output = stripAnsi(arg);
989+
const output = stripVTControlCharacters(arg);
990990
const message = `🐊 No files matching the pattern './xxx.js' were found`;
991991

992992
stopAll();
@@ -2388,8 +2388,7 @@ test('putout: processor: invalid config: message', async (t) => {
23882388
const [allArgCalls] = logError.args;
23892389
const [arg] = allArgCalls;
23902390

2391-
const stripAnsi = await simpleImport('strip-ansi');
2392-
const result = stripAnsi(arg);
2391+
const result = stripVTControlCharacters(arg);
23932392
const expected = '🐊 .putout.json: exclude: must NOT have additional properties';
23942393

23952394
t.equal(result, expected);

packages/putout/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@
224224
"mock-require": "^3.0.2",
225225
"montag": "^1.2.1",
226226
"nodemon": "^3.0.1",
227-
"strip-ansi": "^7.0.0",
228227
"supertape": "^11.0.3"
229228
},
230229
"license": "MIT",

packages/test/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@
7272
"eslint-plugin-n": "^17.0.0",
7373
"eslint-plugin-putout": "^29.0.0",
7474
"madrun": "^11.0.0",
75-
"nodemon": "^3.0.1",
76-
"strip-ansi": "^7.1.0"
75+
"nodemon": "^3.0.1"
7776
},
7877
"license": "MIT",
7978
"engines": {

packages/test/test/progress.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const {stripVTControlCharacters} = require('node:util');
34
const readAllFiles = require('@putout/plugin-filesystem/read-all-files');
45
const tryToCatch = require('try-to-catch');
56

@@ -28,8 +29,7 @@ testProgress('@putout/test: progress: no name', async ({progress, match}) => {
2829
rule: 'read-all-files',
2930
});
3031

31-
const {default: stripAnsi} = await import('strip-ansi');
32-
const result = stripAnsi(error.message);
32+
const result = stripVTControlCharacters(error.message);
3333

3434
match(result, `^ ☝️ Looks like you forget to pass the 'name'`);
3535
}, {

packages/test/test/report.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const {stripVTControlCharacters} = require('node:util');
34
const {join} = require('node:path');
45

56
const montag = require('montag');
@@ -296,8 +297,7 @@ test('putout: test: noReportAfterTransformWithOptions: internal', (t) => {
296297
t.end();
297298
});
298299

299-
test('putout: test: report: with one argument', async (t) => {
300-
const {default: strip} = await import('strip-ansi');
300+
test('putout: test: report: with one argument', (t) => {
301301
const cache = new Map();
302302

303303
cache.set('x', 'y');
@@ -313,7 +313,7 @@ test('putout: test: report: with one argument', async (t) => {
313313
` +
314314
'\n';
315315

316-
t.equal(strip(error.message), expected);
316+
t.equal(stripVTControlCharacters(error.message), expected);
317317
t.end();
318318
}, {
319319
checkAssertionsCount: false,

0 commit comments

Comments
 (0)