Skip to content

Commit

Permalink
Replace strip-ansi with native Node API (#2436)
Browse files Browse the repository at this point in the history
  • Loading branch information
Namchee authored Oct 5, 2024
1 parent d612cc5 commit edaf1c0
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions features/support/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import util from 'node:util'
import { Console } from 'node:console'
import { expect } from 'chai'
import toString from 'stream-to-string'
import stripAnsi from 'strip-ansi'
import * as messages from '@cucumber/messages'
import * as messageStreams from '@cucumber/message-streams'
import FakeReportServer from '../../test/fake_report_server'
Expand Down Expand Up @@ -139,7 +138,7 @@ export class World {
error: result.error,
errorOutput: result.stderr,
envelopes,
output: stripAnsi(result.stdout),
output: util.stripVTControlCharacters(result.stdout),
}
this.verifiedLastRunError = false
expect(this.lastRun.output).to.not.include('Unhandled rejection')
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@
"resolve-pkg": "^2.0.0",
"semver": "7.5.3",
"string-argv": "0.3.1",
"strip-ansi": "6.0.1",
"supports-color": "^8.1.1",
"tmp": "0.2.3",
"type-fest": "^4.8.3",
Expand Down
4 changes: 2 additions & 2 deletions src/publish/publish_plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Writable } from 'node:stream'
import { stripVTControlCharacters } from 'node:util'
import { supportsColor } from 'supports-color'
import hasAnsi from 'has-ansi'
import stripAnsi from 'strip-ansi'
import { InternalPlugin } from '../plugin'
import { IPublishConfig } from './types'
import HttpStream from './http_stream'
Expand Down Expand Up @@ -48,7 +48,7 @@ compose the console message on this end.
*/
function sanitisePublishOutput(raw: string, stderr: Writable) {
if (!supportsColor(stderr) && hasAnsi(raw)) {
return stripAnsi(raw)
return stripVTControlCharacters(raw)
}
return raw
}

0 comments on commit edaf1c0

Please sign in to comment.