Skip to content

browserify #113

@boneskull

Description

@boneskull

there's some stuff in the works to move Mocha way from browserify and onto webpack, but not sure when that'll land.

in the meantime, I'm struggling to get rewiremock working in a browserify bundle via karma. it's throwing an exception because require.resolve does not exist. first, it throws because of the node-libs-browser module:

  Uncaught TypeError: require.resolve is not a function
  at /var/folders/74/theKashey/rewiremock/node_modules/node-libs-browser/index.js:1:1 <- /var/folders/74/p0gxrmy93fq88nm66cs7z42h0000gn/T/55824eb469904ee97753db535d0bc15b.browserify.js:46563:31

Even if that's addressed somehow, it will certainly throw in the two other places that use require.resolve in the codebase (nested.js & mockModule.js).

For this to work, I'm going to guess you'd want to publish a browser bundle and reference it in the browser field of package.json--or otherwise point to a non-bundled, browser-specific implementation. But that's just my guess.

But... this may be a "WONTFIX" for you--and I get it. Just something I ran into and thought it wouldn't hurt to mention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions