Skip to content

Commit

Permalink
Use require.requireActual because Jest's resolver doesn't work with p…
Browse files Browse the repository at this point in the history
…olydev
  • Loading branch information
ericclemmons committed Mar 16, 2019
1 parent 6ed424d commit beeb24e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/middleware/router/handle.production.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
const debug = require("debug")("polydev")

// ! Jest has a built-in mocking mechanism that can't correctly resolve project
// ! files from node_modules:
// @see https://github.com/facebook/jest/blob/72d01cc79f3dfe05419cd8dea1b6c9a558d93879/packages/jest-resolve/src/index.ts#L277-L279
//
// @ts-ignore
if (require.requireActual) require = require.requireActual

module.exports = async function handle(router, file, routes) {
await Promise.all(
routes.map(async ([httpMethod, route]) => {
Expand Down

0 comments on commit beeb24e

Please sign in to comment.