Skip to content

5 builtins missing from jest-resolve #4677

Closed
@billiegoose

Description

@billiegoose

Expected result: tests pass
Actual result:

  ● Test suite failed to run

    Cannot find module '_stream_transform' from 'index.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:191:17)
      at Object.<anonymous> (node_modules/thru/index.js:1:106)

These are builtin modules that are part of the undocumented "private" core API but are unfortunately shimmed in browserify, and some module authors continue to prefer them over the public builtins because using them shaves a few kb off of their bundle size:

_stream_duplex
_stream_passthrough
_stream_readable
_stream_transform
_stream_writable

My root problem is that the test-runner, jest, does not recognize _stream_transform as a core module and breaks as a result. You can see I originally tried to submit a fix to thru (the module that requires _stream_transform) but as switching from _stream_transform to stream would have increased the bundle size, I am now looking for other solutions. builtin-modules is philosophically opposed to adding them to it's list. is-builtin-module is by the same author. So I've worked my way up the dependency chain to jest-resolve. Hopefully you will see that practicality of adding these to the list of builtin modules, since browserify makes this assumption already.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions