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

Add a failing test for extra ansi escapes #23

Merged
merged 4 commits into from
Apr 15, 2019

Conversation

vadimdemedes
Copy link

@vadimdemedes vadimdemedes commented Mar 2, 2019

For some reason when there's a space or multiple spaces at the end, slice-ansi adds closing escape (\u001b[39m) at the end of the string.

@sindresorhus
Copy link
Member

Can you open an issue too, so we can track it? And comment the issue number above the test.

test.js Outdated
@@ -67,3 +67,9 @@ test('weird null issue', t => {
test('support true color escape sequences', t => {
t.is(sliceAnsi('\u001B[[1m\u001B[[48;2;255;255;255m\u001B[[38;2;255;0;0municorn\u001B[[39m\u001B[[49m\u001B[[22m', 0, 3), '\u001B[1m\u001B[48;2;255;255;25m\u001B[38;2;255;0;0muni\u001B[39m');
});

test.failing('doesn\'t add extra escapes', t => {
const s = '\u001B[30m\u001B[43m RUNS \u001B[49m\u001B[39m \u001B[32mtest\u001B[39m';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include the chalk call used to produce the string in a comment? And use a more descriptive variable name than s.

@vadimdemedes
Copy link
Author

Done.

@sindresorhus sindresorhus merged commit db1aa3a into chalk:master Apr 15, 2019
@vadimdemedes vadimdemedes deleted the extra-escapes branch April 15, 2019 04:21
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

Successfully merging this pull request may close these issues.

None yet

2 participants