Skip to content

assert: filename may be undefined in filename.endsWith('.js') #20847

Closed
@jeysal

Description

@jeysal
  • Version: v10.1.0
  • Platform: Linux arch-seckinger 4.16.9-1-ARCH deps: update openssl to 1.0.1j #1 SMP PREEMPT Thu May 17 02:10:09 UTC 2018 x86_64 GNU/Linux
  • Subsystem: assert

Apparently introduced by #18322.
I'm working on a PR to fix this.

code

new Function("assert", "assert(1 === 2);")(require("assert"));

expected behavior

(this is what happens with node 6, 7, 8 and 9)
throws an AssertionError: false == true

actual behavior

(with node 10)
throws

assert.js:163
  if (filename.endsWith('.js') && NativeModule.exists(filename.slice(0, -3))) {
               ^

TypeError: Cannot read property 'endsWith' of undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    assertIssues and PRs related to the assert subsystem.confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions