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

test: add tests for console.[info|error|warn] #6538

Closed
wants to merge 1 commit into from

Conversation

bengl
Copy link
Member

@bengl bengl commented May 3, 2016

Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

Add tests for console.[info|error|warn].

Just copied the basic tests for log, as they're all the same thing
as log in either stdout or stderr.

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label May 3, 2016
@@ -25,11 +25,15 @@ assert.doesNotThrow(function() {
var custom_inspect = { foo: 'bar', inspect: function() { return 'inspect'; } };

var stdout_write = global.process.stdout.write;
var stderr_write = global.process.stderr.write;
Copy link
Contributor

Choose a reason for hiding this comment

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

const

@mscdex mscdex added the console Issues and PRs related to the console subsystem. label May 3, 2016
@evanlucas
Copy link
Contributor

@cjihrig
Copy link
Contributor

cjihrig commented May 3, 2016

LGTM. CI is green.

@@ -76,17 +102,33 @@ assert.equal('foo bar\n', strings.shift());
assert.equal('foo bar hop\n', strings.shift());
Copy link
Member

Choose a reason for hiding this comment

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

This section is a bit of a mess in that it's not very readable and mixes the strings and errStrings checks up. This can likely be simplified by creating a secondary array with the expected strings in the right order then just doing a for-loop through each of strings and errStrings to check each one. The code would be much easier to read and there'd be much less of it :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, the first bunch of these can work that way since they're just testing equality. I'll do that.

For the ones doing indexOf, regex or other more complex tests, I think they're going to have to be on their own still. Some comments might be able to clarify them though.

@evanlucas
Copy link
Contributor

@evanlucas
Copy link
Contributor

hmmm looks like linting failed?

@jasnell
Copy link
Member

jasnell commented May 3, 2016

LGTM

Just copied the basic tests for log, as they're all the same thing
as log in either stdout or stderr. Cleaned that up a bit.

Also const-ified.
@bengl
Copy link
Member Author

bengl commented May 4, 2016

@evanlucas i fixed the lint

@evanlucas
Copy link
Contributor

Thanks....let's try the CI one more time https://ci.nodejs.org/job/node-test-pull-request/2501/

@bengl
Copy link
Member Author

bengl commented May 6, 2016

@evanlucas looks like a single failure, for unrelated jenkinsey reasons https://ci.nodejs.org/job/node-test-commit-arm/nodes=armv8-ubuntu1404/3137/console

@evanlucas
Copy link
Contributor

Last CI looks good (https://ci.nodejs.org/job/node-test-pull-request/2520/). Landing now. Thanks!

evanlucas pushed a commit that referenced this pull request May 6, 2016
Just copied the basic tests for log, as they're all the same thing
as log in either stdout or stderr. Cleaned that up a bit.

Also const-ified.

PR-URL: #6538
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@evanlucas
Copy link
Contributor

Landed in fd49556. Thanks @bengl!

@evanlucas evanlucas closed this May 6, 2016
evanlucas pushed a commit that referenced this pull request May 17, 2016
Just copied the basic tests for log, as they're all the same thing
as log in either stdout or stderr. Cleaned that up a bit.

Also const-ified.

PR-URL: #6538
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
console Issues and PRs related to the console subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants