jeudi 10 décembre 2020

__Rewire__ is not a function

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?

Aucun commentaire:

Enregistrer un commentaire