Skip to content

Never unhook .node modules #6

@cspotcode

Description

@cspotcode

Native .node modules cannot be loaded more than once.

require('./some-lib.node');
delete require('module')._cache[<some-lib's module ID>];
require('./some-lib.node');
// Error: Module did not self-register.

Mockery will have to cache native modules no matter what, so that they're never loaded more than once. They can still be substituted and mocked. The only problem is if a native module require()s some dependencies, but I don't think that happens in practice.

See also: mfncooper#34

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions