Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

[bz5964521] test output is always colorized -- includes escape codes when saved to file #809

Closed
rwaldura opened this issue Nov 29, 2012 · 6 comments

Comments

@rwaldura
Copy link
Contributor

When running tests, the output is colorized always.
E.g. the build output includes color escape codes. See BZ ticket for link.

@isao says there are two code paths for output -- he's fixed the console path to check whether output is a TTY and skip colors. However the test path is still colorizing everything by default.

Example

Executing test: ./test-mime.js
�[37;40minfo:�[0m�[35m (testrunner):�[0m �[32mTesting began at Wed Nov 28 2012 22:08:11 GMT+0000 (GMT).�[0m
�[37;40minfo:�[0m�[35m (testrunner):�[0m �[32mTest suite "mojito-addon-rs-mime-tests" started.�[0m
�[37;40minfo:�[0m�[35m (testrunner):�[0m �[32mTest case "mime rs addon tests" started.�[0m
�[37;40mpass:�[0m�[35m (testrunner):�[0m �[32mparse mime types of resources: passed.�[0m
Waiting for the test report
�[37;40minfo:�[0m�[35m (testrunner):�[0m �[32m
Test case "mime rs addon tests" completed.
Passed:1 Failed:0 Total:1 (0 ignored)�[0m
�[37;40minfo:�[0m�[35m (testrunner):�[0m �[32m
Test suite "mojito-addon-rs-mime-tests" completed.
Passed:1 Failed:0 Total:1 (0 ignored)�[0m
�[37;40minfo:�[0m�[35m (testrunner):�[0m �[32m
Testing completed at Wed Nov 28 2012 22:08:11 GMT+0000 (GMT).
Passed:1 Failed:0 Total:1 (0 ignored)�[0m
Waiting for the test report
'''
@isao
Copy link
Contributor

isao commented Nov 29, 2012

yes, test.js implements different console text coloring functions that are not tty aware.

I have a branch or stash somewhere I think that started converting the code to use utils.js style tty aware colors...

@rwaldura
Copy link
Contributor Author

@jlecomte is reporting this is still occurring with 0.5.1

@isao
Copy link
Contributor

isao commented Jan 4, 2013

pull #872 prevents color codes being output in test results, when piped to a file (or other non-tty usage).

However, output from other mojito components still send colorized output (lib/app/autoload/perf.server.js, and some Y.log calls).

Closing this, and will track the various other offenders separately.

@caridy
Copy link
Contributor

caridy commented Jan 29, 2013

Runtime logs are now processed correctly (since 0.5.2). Test, cli and store logs are still having issues with encoding.

@isao
Copy link
Contributor

isao commented Jan 29, 2013

@caridy test & cli logging are tty aware. escape codes are coming from code-under-test and elsewhere, right?

@isao
Copy link
Contributor

isao commented Mar 28, 2013

as mentioned there are some color codes output when running mojito test but they do not come from the cli. The actual test output is tty aware. i.e. the following have no colors when piped to a file or cat, etc:

...
✔  passed ReadModelRss-tests :: rss model tests :: processError exists
✔  passed ReadModelRss-tests :: rss model tests :: processError not exists is falsey
✔  passed ReadModelRss-tests :: rss model tests :: processResponse strips tags
✔  passed ReadModelRss-tests :: rss model tests :: strip tags
✔  passed ReadController-tests :: ReadController tests :: sizing test 1

Total tests: 30 ✔ Passed: 30  ⚑ Deferred: 0 ✖ Failed: 0   100% pass rate

@isao isao closed this as completed Mar 28, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants