Skip to content

node inspect crashes when tab-completing with a require #41793

Open
@langdon-holly

Description

@langdon-holly

Steps to reproduce:

  1. Create an empty file named "test.js"
  2. Run node inspect test.js
  3. Enter the debug repl
  4. Type require("
  5. Press tab

Result: Node prints the following message to standard error, then exits with status 1.

There was an internal error in node-inspect. Please report this bug.
Cannot read property 'extensions' of undefined
TypeError: Cannot read property 'extensions' of undefined
    at REPLServer.complete (repl.js:1031:51)
    at REPLServer.completer (repl.js:492:14)
    at REPLServer.Interface._tabComplete (readline.js:476:8)
    at REPLServer.Interface._ttyWrite (readline.js:975:16)
    at REPLServer.self._ttyWrite (repl.js:719:7)
    at ReadStream.onkeypress (readline.js:178:10)
    at ReadStream.emit (events.js:182:13)
    at ReadStream.EventEmitter.emit (domain.js:441:20)
    at emitKeys (internal/readline.js:424:14)
    at emitKeys.next (<anonymous>)

Observed rules for reproduction:

  • test.js can be any JavaScript file.
  • A single quote may be substituted for the double quote in step 3.
  • require(" may be preceded by any JavaScript code.
  • Space characters may be typed between require and (".
  • The paren must be immediately followed by the quote (no whitespace).
  • Any additional characters may be typed before pressing tab.
  • The cursor must be somewhere after the quote when pressing tab.

Metadata

Metadata

Assignees

No one assigned

    Labels

    debuggerIssues and PRs related to the debugger subsystem.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions