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

ANSI escape codes in messages #388

Closed
TheAlmightyBob opened this issue Oct 4, 2018 · 2 comments
Closed

ANSI escape codes in messages #388

TheAlmightyBob opened this issue Oct 4, 2018 · 2 comments

Comments

@TheAlmightyBob
Copy link

Using vscode-jest 2.9.2, which should have #293 , and jest 23.6.0, which should have jestjs/jest#5909 , I am still seeing ANSI codes in failure messages.

vscode-jest-escapecodes

Is there more configuration I need to be doing to fix this? Did I misunderstand the expected result of the above changes?

(this is not a recent regression for me, it's been like this many months, I was just waiting for the recent 2.9.2 release to see if that fixed it)

Environment

  1. node -v: 10.9.0

  2. npm -v: 6.2.0

  3. npm ls jest or npm ls react-scripts (if you haven’t ejected): 23.6.0

  4. your vscode-jest settings if customized: N/A

  5. Operating system: macOS 10.13.3

Prerequisite

  • are you able to run jest test from command line? YES
  • how do you run your tests from command line? (for example: npm run test or node_modules/.bin/jest) yarn test (which maps to jest)

Steps to Reproduce

The one line in the screenshot is all it takes for me.

Relevant Debug Info

Looks like --no-color is being provided to jest.

[Extension Host] spawning process with command=/<project>/node_modules/.bin/jest, args=--json,--useStderr,--outputFile,/var/folders/z5/46hxmsdj4s339_mjk63_br91wmht3p/T/jest_runner.json,--no-color

I see two errors but am not sure if they are related:

ERR Cannot read property 'text' of undefined: TypeError: Cannot read property 'text' of undefined
    at searchNodes (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/node_modules/jest-test-typescript-parser/build/type_script_parser.js:50:43)
    at visitNode (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/node_modules/typescript/lib/typescript.js:13997:24)
    at Object.forEachChild (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/node_modules/typescript/lib/typescript.js:14229:24)
.
. (repeats a few times)
.
    at Object.parse (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/node_modules/jest-test-typescript-parser/build/type_script_parser.js:88:47)
    at parse (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/node_modules/jest-test-typescript-parser/build/index.js:48:64)
    at Object.parseTest (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/out/src/TestParser.js:12:12)
    at TestResultProvider.getResults (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/out/src/TestResults/TestResultProvider.js:19:43)
ERR Unexpected token, expected : (34:11): SyntaxError: Unexpected token, expected : (34:11)
    at Parser.pp$5.raise (/Users/cclarke/.vscode/extensions/orta.vscode-jest-2.9.2/node_modules/babylon/lib/index.js:4454:13)
(stack trace is long but includes Snapshot.getMetadata)

(there are a few more unexpected token errors at different positions)

Expected Behavior

Test failure messages are human-readable

Actual Behavior

Test failure messages are filled with [39m , [32m, etc

@msfeldstein
Copy link

Did you ever find a solution or workaround to this?

@TheAlmightyBob
Copy link
Author

@msfeldstein Actually this was finally fixed for me with the recent-ish version 3.1.0 (which includes in the release notes that "color escape sequences should be gone from all error messages"). I totally forgot I had this open issue on it.

Are you still seeing these sequences in 3.1.0+? If so, you should probably open a new issue... I'm going to close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants