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

Debug.log output prints to STDOUT instead of STDERR #365

Open
dgtized opened this issue Jun 13, 2019 · 4 comments
Open

Debug.log output prints to STDOUT instead of STDERR #365

dgtized opened this issue Jun 13, 2019 · 4 comments
Assignees

Comments

@dgtized
Copy link

dgtized commented Jun 13, 2019

This is particularly a problem with the JUnit formatting as it means any Debug.log is included in the head of the JUnit output, making it invalid xml.

Steps to reproduce; write a test case with Debug.log, and invoke elm-test with JUnit reporter redirected to an xml file.

If Debug.log went to STDERR it would not be redirected to the file. Alternatively allow Junit reporter to specify a file and only output the test results to the file.

@mgold
Copy link
Collaborator

mgold commented Jun 14, 2019

Alternatively allow Junit reporter to specify a file and only output the test results to the file.

Nah, that's what shell redirects are for. Separating output seems reasonable.

@harrysarson
Copy link
Collaborator

I see a few ways to go about this:

  1. Somewhere near https://github.com/rtfeldman/node-test-runner/blob/master/templates/before.js#L41 replace the global console.log with a function that instead calls console.error. However, I fear this may also redirect test output to std error.

  2. In prepareCompiledJsFile() (https://github.com/rtfeldman/node-test-runner/blob/master/lib/Generate.js#L11) and find replace all occurances of

    var _Debug_log = F2(function(tag, value)
    {
    console.log(tag + ': ' + _Debug_toString(value));
    return value;
    });
    

    with

    var _Debug_log = F2(function(tag, value)
    {
    console.error(tag + ': ' + _Debug_toString(value));
    return value;
    });
    

    (there should only be one match)

  3. Let Debug.log write to stdout and provide a new function in elm-explorations/test that logs its input. This would give us control over where the output is written to and even allow the output to be filtered to inprove the test output.

Thoughts?

@harrysarson
Copy link
Collaborator

May I bump? @mgold and @rtfeldman are any of these approaches worth investigating further?

@mgold
Copy link
Collaborator

mgold commented Aug 20, 2019

I have no preferences on implementation.

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

No branches or pull requests

4 participants