2

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?

asked Dec 10, 2020 at 18:02

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.