Skip to content

Cannot extend Console in node 10 rc.0 #20157

Description

@SimenB
  • Version:
    10.0.0-rc.0
  • Platform:
    macOS
  • Subsystem:
    console

See the following file:

const {Console} = require('console');

class MyConsole extends Console {
  hello() {}
}

const cons = new MyConsole(process.stdout);

console.log(cons.hello)

This will log [Function: hello] in node 8 and node 9, but undefined in the RC.

I'm not sure if it's supposed to happen - my only guess from looking at the changelog is #17708, but I'm not sure if it's it?

This completely breaks Jest (which I wanted to test using the RC) as it extends Console for its own logging. See https://github.com/facebook/jest/blob/ef8f9ce4e02397dc75bdd510079bbfb36ad06728/packages/jest-util/src/buffered_console.js#L164-L166 which is undefined, meaning Jest errors out on an internal error here: https://github.com/facebook/jest/blob/ef8f9ce4e02397dc75bdd510079bbfb36ad06728/packages/jest-runner/src/run_test.js#L137

Activity

  1. vsemozhetbyt commented on Apr 19, 2018

    @vsemozhetbyt
    Contributor

    I cannot reproduce with v10.0.0-nightly201804120aab8ff602 but can reproduce with the next v10.0.0-nightly201804132a6ab9b37b. So if I compare properly, the cause should be here:

    a984551...2a6ab9b

  2. apapirovski commented on Apr 19, 2018

    @apapirovski
    Contributor

    I have a reproduction. Working on a fix.

  3. vsemozhetbyt commented on Apr 19, 2018

    @vsemozhetbyt
    Contributor

    cc @jasnell Sorry, seems like one more regression blocking v10.

  4. added this to the 10.0.0 milestone on Apr 19, 2018
  5. added
    consoleIssues and PRs related to the console subsystem.
    regressionIssues related to regressions.
    on Apr 19, 2018
  6. apapirovski commented on Apr 19, 2018

    @apapirovski
    Contributor

    Fix coming shortly.

  7. apapirovski commented on Apr 19, 2018

    @apapirovski
    Contributor

    PR in #20158

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    consoleIssues and PRs related to the console subsystem.regressionIssues related to regressions.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions