1

Using Rewire for testing..

Rewire is failing to rewire, and I'm wondering why.

Here is an example of rewire failing:

A file has a few exported functions...

export function foo() {}
export function bar() {}
export function baz() {}

In a test file...

import * as pathFileHelpers from 'path/to/file';

pathFileHelpers.__Rewire__({
   readFileSync: () => {
      return 'test test test'
    },
})

_get__(...).__Rewire__ is not a function

Why?

4

0 回答 0