Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update dependency ansi_up to version .x 🌟 #4331

Merged
merged 9 commits into from
Dec 20, 2019
15 changes: 8 additions & 7 deletions packages/server/lib/errors.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
_ = require("lodash")
strip = require("strip-ansi")
chalk = require("chalk")
ansi_up = require("ansi_up")
_ = require("lodash")
strip = require("strip-ansi")
chalk = require("chalk")
AU = require('ansi_up')
Promise = require("bluebird")

ansi_up = new AU.default
ansi_up.use_classes = true

twoOrMoreNewLinesRe = /\n{2,}/

isProduction = ->
Expand Down Expand Up @@ -913,9 +916,7 @@ clone = (err, options = {}) ->
obj = _.pick(err, "type", "name", "stack", "fileName", "lineNumber", "columnNumber")

if options.html
obj.message = ansi_up.ansi_to_html(err.message, {
use_classes: true
})
obj.message = ansi_up.ansi_to_html(err.message)
else
obj.message = err.message

Expand Down
3 changes: 2 additions & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
"@cypress/commit-info": "2.2.0",
"@cypress/get-windows-proxy": "1.6.0",
"@cypress/icons": "0.7.0",
"@cypress/mocha-teamcity-reporter": "1.0.0",
"@ffmpeg-installer/ffmpeg": "1.0.19",
"ansi_up": "1.3.0",
"ansi_up": "4.0.3",
"black-hole-stream": "0.0.1",
"bluebird": "3.7.0",
"browserify": "16.3.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/server/test/unit/errors_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,16 @@ describe "lib/errors", ->
expect(ret).to.be.undefined

context ".clone", ->
it "converts err.message from ansi to html with span classes", ->
it "converts err.message from ansi to html with span classes when html true", ->
err = new Error("foo" + chalk.blue("bar") + chalk.yellow("baz"))
obj = errors.clone(err, {html: true})
expect(obj.message).to.eq('foo<span class="ansi-blue-fg">bar</span><span class="ansi-yellow-fg">baz</span>')

it "does not convert err.message from ansi to html when no html option", ->
err = new Error("foo" + chalk.blue("bar") + chalk.yellow("baz"))
obj = errors.clone(err)
expect(obj.message).to.eq('foo\u001b[34mbar\u001b[39m\u001b[33mbaz\u001b[39m')

context ".displayFlags", ->
it "returns string formatted from selected keys", ->
options = {
Expand Down