Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: _get__(...).__REWIRE__ is not a function #109

Open
codejet opened this issue Mar 15, 2016 · 53 comments
Open

TypeError: _get__(...).__REWIRE__ is not a function #109

codejet opened this issue Mar 15, 2016 · 53 comments

Comments

@codejet
Copy link

codejet commented Mar 15, 2016

No matter what I try with exports and imports, I always get:

TypeError: _get__(...).__REWIRE__ is not a function

I added the plugin to our .babelrc for the tests and babel-plugin-rewire.js definitely gets executed.

I couldn't find any really similar issue. Am I missing something obvious?

@speedskater
Copy link
Owner

@codejet is it possible that you have a type in your code and use REWIRE instead of Rewire (https://github.com/speedskater/babel-plugin-rewire).
I would even recommend to use the set method.
Does this solution help you?

@codejet
Copy link
Author

codejet commented Mar 15, 2016

thanks @speedskater, but it doesn't seem to matter whether REWIRE or Rewire...

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

@robin-barnes-triptease
Copy link

I also have what appears to be the same problem:

undefined is not a constructor (evaluating '_get__('consoleLogger').__Rewire__('getWindow', function () {
          return windowMock;
        })')

undefined is not a constructor seems to happen when using either phantom or mocha, not sure which, but basically it's complaining because

moduleName.__Rewire__

is not a function. Note this was working fine until I reinstalled my npm modules, then it broke.

@speedskater
Copy link
Owner

@codejet , @robin-barnes-triptease thank you. Could one of you please create a PR with a minimum sample, similar to the ones existing in the repo?

@mmahalwy
Copy link

@codejet I am experiencing the same problem with PhantomJS but not in Chrome with karma running my tests. Did you get around fixing this? CC: @robin-barnes-triptease

@codejet
Copy link
Author

codejet commented Mar 17, 2016

@mmahalwy no, unfortunately i didn't. we are using mocha here.

@uriklar
Copy link

uriklar commented Mar 23, 2016

+1

@codejet
Copy link
Author

codejet commented Mar 23, 2016

a colleague of mine investigated, and according to him babel-register prevents rewiring of modules living inside node_modules in our case.

@jonashartwig
Copy link

Same issue here using babel 6, mocha, karma on chrome with rc1:

import * as ConfigService from "../src/services/configService";

const getEnvironmentConfigurationMock = () => Promise.resolve({});

ConfigService.__Rewire__("getEnvironmentConfiguration", getEnvironmentConfigurationMock);

where configService:

var environmentConfig = undefined;

export function getEnvironmentConfiguration () {
        ... return some form of promise
    });
}

@ModuloM
Copy link

ModuloM commented Mar 24, 2016

I had the same problem, but manage to fix it.

In your case @jonashartwig, it will be something like, switching:
import * as ConfigService from (...)
To:
import { getEnvironmentConfiguration, __RewireAPI__ as configServiceRewireApi } from (...)

And finally in the code
configServiceRewireApi.__Rewire__("getEnvironmentConfiguration", (...)

Hope it helps.

@spncrlkt
Copy link
Contributor

Ran into this today:

import * as things from './myThings.js';
...
things.__Rewire__(...)

Throws:
TypeError: _get__('things').__REWIRE__ is not a function

I wanted to keep the import * as syntax, so I found a workaround by importing the things and the API separately:

import * as things from 'myThings.js';
import { __RewireAPI__ as ThingsRewireAPI } from 'myThings.js';
...
ThingsRewireAPI.__Rewire__(...)

@joshnuss
Copy link

It seems you can't rewire a dependency that is not used. This caused the issue for me.

It's a little confusing when doing TDD, cause you might want to rewire a service before anything actually uses it.

// notice Foo is never used, so babel doesnt bother loading it
import Foo from "./foo"
export default class Bar {
}
import Bar from "./bar"

Bar.__Rewire__('Foo', 1); // TypeError: _get__(...).__Rewire__ is not a function

This can be fixed by adding a reference to the import anywhere in your code

import Foo from "./foo"

Foo; // now the module will be included

export default class Bar {
}

@speedskater
Copy link
Owner

@spncrlkt, @ModuloM, @robin-barnes-triptease , @jonashartwig The behaviour regarding wildcard imports is intentional. The reason is that if we would add the rewire api to the wildcard import it could break the contract of modules expecting certain exports.

@joshnuss You are right, rewiring a dependency which is not used or does not exist causes an error at the moment. I think we should be able to ignore such cases, as rewiring not existing dependencies won't change anything. @TheSavior what do you think?
Anyway @joshnuss could you please create a PR for a failing usage test?

@mmahalwy
Copy link

I am still getting this error with as simple as:

import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { asyncConnect } from 'redux-async-connect';

import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';

import { load } from 'redux/modules/image_attributions';

@asyncConnect([{
  promise({ store: { dispatch } }) {
    return dispatch(load());
  }
}])
@connect(
  state => ({
    imageAttributions: state.imageAttributions.entities
  })
)
export default class ImageAttribution extends Component {
  static propTypes = {
    imageAttributions: PropTypes.array
  };

  render() {
    return (
      <Grid style={{marginTop: '140px'}}>
      </Grid>
    );
  }
}

and test:

import ImageAttributions from './index';

console.log(ImageAttributions); // function Connect(props, context) { ... }
console.log(ImageAttributions.__GetDependency__); // undefined
console.log(ImageAttributions.__Rewire__); // undefined

This only happens with phantomjs and only when I have export default and using babel 6:

{
  "presets": ["react", "es2015", "stage-0"],
  "plugins": [
    "transform-runtime",
    "add-module-exports",
    "transform-decorators-legacy",
    "transform-react-display-name"
  ],
  "env": {
    "test": {
      "plugins": [
        "rewire"
      ]
    },

My work around has been:

import ImageAttributions, { __RewireAPI__ as ImageAttributionsApi } from './index';

which is weird since export default should already have the apis.

@speedskater
Copy link
Owner

@mmahalwy maybe this could be related to the decorators in your sample. What happens if your separate the declaration of the component and the export?

@mmahalwy
Copy link

i can give it a try and report back

@mmahalwy
Copy link

@speedskater getting same problem with non decoratored file

@asgarddesigns
Copy link

I found declaring an anonymous function as default export directly caused this error, whereas assigning to a const and exporting that worked.

e.g.
doesn't work:

default export ({ path, func }) => {
    function request(params) {
    //do stuff
    }
    return { request };
};

does work

const method = ({ path, func }) => {
  function request(params) {
    //do stuff
  }
  return { request };
};
export default method;

@speedskater
Copy link
Owner

speedskater commented Jul 5, 2016

@asgarddesigns thanks for figuring this out. Could you please create a PR with a failing sample with your example?

@BenoitAverty
Copy link

I found the same thing as @asgarddesigns. However, it is still related to the import not being used because adding a reference to the unused import fixed the problem.

@asgarddesigns
Copy link

@speedskater sorry, been on holidays. Will try and push something up when I get a chance (an remember what I was actually doing!).

@liamfd
Copy link

liamfd commented Jul 13, 2016

I encountered an issue that may be related (version 1.0.0-rc-3, using it with webpack).

I have two modules, both of which consist of a number of exported functions. However, when I imported them, __Rewire_API__ worked fine for one, but not the other.

When trying to track down the difference between my modules, I discovered that while __Rewire_API__ is defined when importing this module:

const foo = 'TEST';
export const bar = () => {
  return foo;
};

It is undefined (both as a default import and as a named import) while importing this one:

export const bar = () => {
  return 'TEST (not Foo!)';
};

This also does not work (notice that foo is defined, but unused):

const foo = 'bar';
export const bar = () => {
  return 'TEST (not Foo!)';
};

Here is the module that I imported the three of these with:

import { bar, __RewireAPI__ as RewireBar } from './bar';
console.log('bar:', bar());
console.log('rewire:', RewireBar);

So it seems that you need at least one top level variable that is used within the module for __RewireAPI__ to work when that module is imported.

I suppose that makes sense, as there would be nothing for rewire to, well, rewire, but it occurred during development and I couldn't figure out for the life of me what was happening, so if it would be possible to have a descriptive error, or simply have __Rewire_API__ work anyways, that would be great.

Let me know if this is the right place for this or if I can provide any more detail.

@elicwhite
Copy link
Contributor

@liamfd Do you still have this problem with the latest version (1.0.0-rc-4)

@liamfd
Copy link

liamfd commented Jul 13, 2016

@TheSavior unfortunately yes, the issue still seems to be present with 1.0.0-rc-4.

@panzerdp
Copy link

panzerdp commented Aug 7, 2016

The problem is still present in 1.0.0-rc-5.
I included rewire as a plugin in .babelrc. Then tried mocha tests without modifications and it fails: TypeError: _get__(...) is not a function . Tests were working fine before, without rewire plugin.
I am using mocha 2.5.3 with babel.

selection_004

@tchock
Copy link

tchock commented Oct 3, 2016

I still got this error in 1.0 doing something like this:

PushQueue.js

export default class PushQueue {
  // ...
}

PushQueue.spec.js

const MockQueueItem = function MockQueueItem(action, payload) {
  console.log('should be called', action, payload);
  return { action, payload };
};

import PushQueue from './PushQueue';

describe('PushQueue', function () {
  beforeEach(function () {
    PushQueue.__Rewire__('PushQueueItem', MockQueueItem);
    this.queue = new PushQueue();
  });

  afterEach(function () {   
    PushQueue.__ResetDependency__('PushQueueItem');
  });

  // tests are here ...
});

As @mmahalwy said: __Rewire__ and __ResetDependency__ are undefined.

When I also import the __RewireAPI__ from the PushQueue.js file I can call these functions there but it doesn't change the import when calling a function that uses the PushQueueItem.

Is there some update about this issue?

@speedskater
Copy link
Owner

@tchock thanks for providing the sample. Could you please provide the complete code of PushQueue so that i can try to tackle the issue asap?

@speedskater
Copy link
Owner

@tchock Thanks for providing the complete code and sorry for my delay but I have been on holidays over the last 3 weeks. I will have a look at the code tomorrow in the evening and let you know whether I can figure something out.

@speedskater
Copy link
Owner

@tchock I have not found your problem till now (trying to create a sample project but i think i will have to do it over the weekend). But maybe your issue is related to issue #93 and the proposed fix in the sample project danawoodman/webpack-babel-rewire-bug-example#1

@jonashartwig
Copy link

I usually do it like this:

import PushQueue from './PushQueue';
import { __RewireAPI__ } from "./PushQueue";

this usually works for me

@renaudtertrais
Copy link

renaudtertrais commented Nov 16, 2016

I got this issue also but that was because my isparta config in webpack of karma was incorrect.
I fixed it with (it's in the README btw):

webpack: {
  isparta: {
    embedSource: true,
    noAutoWrap: true,
    babel: {
      plugins: 'rewire'
    }
  },

  module: {
    preLoaders: [
      {
        test: /\.jsx?$/,
        loader: 'isparta',
        include: path.join(__dirname, 'src'),
        exclude: /node_modules/,
      }
    ]
  }
}

@tchock
Copy link

tchock commented Nov 17, 2016

The import { __RewireAPI__ } from "./PushQueue"; code also doesn't really work (tried this already some time ago). I've already have the right isparta config for this. Hopefully this will be fixed with the issue @speedskater mentioned. I will hold my hopes high :)

@tchock
Copy link

tchock commented Nov 20, 2016

Ok I got it to work! I had the plugin added to isparta and also to the babel-loader.
This caused that Rewire was undefined.

I removed the plugin from the babel-loader and it worked.

@speedskater maybe this should be added to the readme?

@speedskater
Copy link
Owner

@tchock Thanks for your feedback. I added it to the readme. Furthermore I created a working unit test with your sample and added it to the repository.
Is there any reason why you are using isparta instead of babel-plugin-istanbul ?

@tchock
Copy link

tchock commented Nov 21, 2016

@speedskater cool! I was just not aware of the babel-plugin-istanbul. Is this in any way better or better maintained? Because isparta doesn't see that much love recently.

@speedskater
Copy link
Owner

@tchock. Don't know which one is better maintained, but the last times i have tried babel-plugin-istanbul it worked almost out of the box while maintaining line numbers.

@mayeaux
Copy link

mayeaux commented Dec 21, 2016

@joshnuss Thanks, for the life of me I could not figure that out.

@Claire
Copy link

Claire commented Jan 6, 2017

+1

I don't thave the webpack, .babelrc config conflict.

Can't use __Rewire__ method with test running in Phantomjs which our Jenkins CI build uses. Any ETA?

@sculove
Copy link

sculove commented Jan 13, 2017

+1

@noahehall
Copy link

just wrestled with this for an hour, if you're component exports a default && named export, make sure your default export is the one you're testing

@csvan
Copy link

csvan commented Jun 1, 2017

@ModuloM solution worked in my case. I'm using Karma with the webpack plugin, and tests are passing both in Chrome and PhantomJS.

@JakubPetriska
Copy link

JakubPetriska commented Jun 5, 2017

I also have similar issues and I'm able to fix it with solution from @ModuloM .

+1

@pavelkukov
Copy link

__Rewire__ method is exported as a member of default.
It is possible to use it with import all:

import * as MyModule from 'path'
MyModule.default.__Rewire__('do', magic)

default will be exported from your module.
For example, export { a, b, c } will have unexpected default when imported.

import * as MyModule from 'path'
Object.keys(MyModule) // [a, b, c, default]

@Lian1230
Copy link

In my case, it seems like the babel is not set properly. I moved the babel setting from package.json to .babelrc, use "babel" as "inherit" and require "babel-register" then it worked.

@laddi
Copy link

laddi commented Feb 8, 2018

We've been scratching our heads on this for a couple of days now. We ran into all the same problems when trying to rewire in files that only contained exported functions. What we ran into was that __RewireAPI__ was always undefined and would only become defined when we added a local variable or function.

But we tried adding a export default { method1, method2, ... } and that seemed to clear it up for us. So it's obvious that if no default export exists (and no local variables/functions) then __RewireAPI__ will never be added to the file. But this workaround works fine for us, just a shame it took us this long to discover it... 😛

Babel settings are still in package.json for us so that clearly wasn't a factor. I'm not sure if this is a bug or not but the solution wasn't obvious and this kind of contradicts the documentation. Unless we are seriously misunderstanding that... 😉

@relu-xz
Copy link

relu-xz commented Oct 10, 2018

It's 2018 and @asgarddesigns's solution works!

@i-am-lioness
Copy link

i-am-lioness commented Dec 24, 2018

Just FYI, for me this problem appeared when I added non-default exports to module I was testing.

For example, when it was just

// MyModule.js
export default ObjectA;
// MyModule.spec.js
import ObjectA from './MyModule'

ObjectA.__Rewire('myImport', 5);

it worked just fine.

But when I changed it to

// MyModule.js
export { objectA as default, objectB };

then I got the error.

When I changed it back, the problem went away. I ended up deciding to revert to the original code, and find another way to design my code such that I would not have to export objectB.
hjh
kjl

@stoplion
Copy link

stoplion commented Jun 3, 2019

1. Using wildcard imports in test, then rewire-ing deps not working..

import * as helper from '../../../server/helpers/post_helper';
helper.changeTitle. __REWIRE__('readFileSync', { ... })

__Rewire__ is not a function

2. names imports also failing..

import { changeTitle } from '../../../server/helpers/post_helper';
changeTitle. __REWIRE__('readFileSync', { ... })

Also getting a..
__Rewire__ is not a function

2. Rewire API

import * as helper from '../../../server/helpers/post_helper';
import {__RewireAPI__ as helperRewired }from '../../../server/helpers/post_helper';
helperRewired. __REWIRE__('readFileSync', { ... })

Also error

Is there any solution to this?

@0xdevalias
Copy link

0xdevalias commented Nov 15, 2019

Using version: "babel-plugin-rewire": "^1.2.0",


tl;dr

The main 'fix' for me getting the following error:

TypeError: _get__(...) is not a function

was to use __Rewire__ rather than __RewireAPI__ for my imports/etc.

This may be an effective solution for a pile of (at least seemingly partially) related issues I seemed to come across while trying to debug this, including:

For completeness (this is a refinement on the version in my deep dive below), here is some example 'all in one' code of a full jest.mock only the things I need to + rewire them for any functions that needed to use them internally:

jest.mock('render', () => {
  // Require the original module to not be mocked...
  const originalModule = jest.requireActual('render')

  // These are the things we want to mock
  const mocks = {
    collectReactComponents: jest.fn(),
  }

  // For all of the exports we mock above, ensure we rewire the internal module usage as well
  for (const [exportName, exportMock] of Object.entries(mocks)) {
    originalModule.__Rewire__(exportName, exportMock)
  }

  return {
    __esModule: true, // Use it when dealing with esModules
    ...originalModule,
    ...mocks,
  }
})

Unfortunately due to the way babel-plugin-jest-hoist works, there doesn't immediately seem to be an easy/nice way of abstracting this into helper function.

They do allow an 'escape hatch' for lazy loaded variables prefixed with mock , but I couldn't immediately think of a good way to use that to abstract this nicer.


My deep dive and eventual path to success

Not sure if this is going to help anyone here.. but I was using things like the following to import:

import renderReactComponents, { collectReactComponents } from 'render'
const __RenderRewireAPI__ = require('render').__RewireAPI__

console.warn('render', Object.getOwnPropertyNames(require('render')))
console.warn('render2', require('render'))
console.warn('render3', require('render').__RewireAPI__)

__RenderRewireAPI__('collectReactComponents', jest.fn())

This was giving me the following cryptic error:

TypeError: _get__(...) is not a function

And resulted in outputs like this:

console.warn
    render [ '__esModule',
      '__get__',
      '__GetDependency__',
      '__Rewire__',
      '__set__',
      '__ResetDependency__',
      'default',
      'collectReactComponents',
      // ...snip...
      '__RewireAPI__' ]

  console.warn
    render2 { __get__: [Function: _get__],
      __GetDependency__: [Function: _get__],
      __Rewire__: [Function: _set__],
      __set__: [Function: _set__],
      __ResetDependency__: [Function: _reset__],
      default: [Function: renderReactComponents],
      collectReactComponents: [Function: collectReactComponents],
      // ...snip...
      __RewireAPI__: {} }

  console.warn
    render3 {}

So there appears to be a __RewireAPI__ element there.. but it's an empty object. There is however also the __Rewire__ export, which actually seems to have a function set on it..

Changing my import to:

const __RenderRewireAPI__ = require('render').__Rewire__

Appeared to get rid of the TypeError.

My original 'non-rewired code looked like this:

const renderReactComponents = (reactComponentCollection, combinedReducers) => {
  console.warn('inside-renderReactComponents', collectReactComponents)
  // ...snip...

But looking at the console log, we can see that that line has now been rewired to use _get__("collectReactComponents") as expected!

console.warn
    renderReactComponents function renderReactComponents(reactComponentCollection, combinedReducers) {
      console.warn('inside-renderReactComponents', _get__("collectReactComponents"));

Interestingly though, in my test file where I imported collectReactComponents i am seeing the original still, but inside the rewired module I get the expected mock function. I believe this is due to my import 'binding' before I actually called the rewire function.

console.warn
    collectReactComponents function collectReactComponents(reactComponentCollection) {
    // ..snip..
}

console.warn
    inside-renderReactComponents::collectReactComponents function mockConstructor() {
            return fn.apply(this, arguments);
          }

Looking a little deeper using code like the following:

console.warn('render-afterRewire-collectReactComponents', require('render').collectReactComponents)
console.warn('render-afterRewire-makeProviderWithName', require('render').makeProviderWithName)

I get output like this:

 console.warn
    render-afterRewire-collectReactComponents function collectReactComponents(reactComponentCollection) {
      return Array.from(document.querySelectorAll('[data-react-class]')).map(function (node) {
        return {
          node: node,
          componentName: node.dataset.reactClass,
          component: reactComponentCollection[node.dataset.reactClass],
          props: JSON.parse(node.dataset.reactProps || '{}'),
          reducer: node.dataset.reducer
        };
      });
    }

  console.warn
    render-afterRewire-makeProviderWithName function makeProviderWithName(name) {
      var ProviderWithName =
      /*#__PURE__*/
      function (_get__2) {
 
     // ...snip...
    }

Which to me looks like makeProviderWithName was probably rewritten by rewire, but collectReactComponents appears to have remained unchanged (probably because it seems to be a 'pure' function and doesn't call into any of the other functions within the render module.

So I wonder if because it doesn't 'need' to be rewritten, it isn't replaced with the rewired mock, and thus we still get the original output when we import the dependency, even though all internal calls of it are rewired correctly.

It could also just be that this was never a goal of rewire, which is probably fine, as we can likely get this same functionality now using the standard jest.mock functionality.

Working rewire into my typical jest.mock 'only the things I need to' pattern looks something like this:

import renderReactComponents, { collectReactComponents } from 'render'

jest.mock('render', () => {
  // Require the original module to not be mocked...
  const originalModule = jest.requireActual('render')

  const collectReactComponentsMock = jest.fn()

  originalModule.__Rewire__(
    'collectReactComponents',
    collectReactComponentsMock
  )

  return {
    __esModule: true, // Use it when dealing with esModules
    ...originalModule,
    collectReactComponents: collectReactComponentsMock,
  }
})

console.warn('render-afterRewire-alreadyImported', collectReactComponents)
console.warn('render-afterRewire-freshRequire', require('render').collectReactComponents)

renderReactComponents('aaa', 'bbb')

Which ends up with the following console output, showing that things appear to have been mocked/rewired in all the places like we wanted!

  console.warn
    render-afterRewire-alreadyImported function mockConstructor() {
            return fn.apply(this, arguments);
          }

  console.warn
    render-afterRewire-freshRequire function mockConstructor() {
            return fn.apply(this, arguments);
          }

  console.warn
    inside-renderReactComponents::collectReactComponents function mockConstructor() {
            return fn.apply(this, arguments);
          }

So.. seemingly for me.. my biggest problem here was trying was to use __Rewire__ rather than __RewireAPI__ for my imports/etc.

@0xdevalias
Copy link

Following on from my last comment, I found a way to abstract some of the boilerplate into a common helper function:

// helpers/mock-helpers.js

export const makeMockWireFunc = (mockImportPath, mocks) => {
  // Require the original module to not be mocked...
  const originalModule = jest.requireActual(mockImportPath)

  // For all of the exports we mock above, ensure we rewire the internal module usage as well
  for (const [exportName, exportMock] of Object.entries(mocks)) {
    originalModule.__Rewire__(exportName, exportMock)
  }

  return {
    __esModule: true, // Use it when dealing with esModules
    ...originalModule,
    ...mocks,
  }
}

Then in your test file/place you want to do the mocking:

jest.mock('render', () =>
  require('helpers/mock-helpers').makeMockWireFunc('render', {
    collectReactComponents: jest.fn(),
  })
)

This doesn't appear to break anything babel-plugin-jest-hoist or babel-plugin-rewire, and avoids violating babel-plugin-jest-hoist's rules around not closing around external variables, and using an inline function for the handler.

Unfortunately you still have to pass the imported function (in this case, 'render') in to the 2 functions.. but it's definitely less effort/duplication than was required before.

@stoplion
Copy link

Running into same issue in 2020

@raywinca
Copy link

raywinca commented Nov 18, 2021

got the same issue here in late 2021.

What I have:
1> npm install -D babel-node babel-plugin-rewire
2> in package.json, add the plug in to the babel plugins section

"babel": {
            ...
           "plugins": [
                  "babel-plugin-rewire"
           ]
        }
  1. I have an ES6 module called features with named exported function called getFeatures(), the module doesn't have a default export.
// --feautre.js --
const allFeatures = () => {
   // sync function not async
}

export function getUserFeatures(user_id){
   ...
   const results = allFeatures();
  ...
}

I tried to rewire the allFeatures() function to return some mocked results, and no luck so far.
Version 1

// -- feature.test.js--
import feature from "./feature";

test('',()=>{
   feature.__Rewire__("allFeatures", ()=>{
      ...
  }) 
})

Error Message
TypeError: Cannot read property '__Rewire__' of undefined

Version 2

// -- feature.test.js--
import * as feature from "./feature";

test('',()=>{
   feature.__Rewire__("allFeatures", ()=>{
      ...
  }) 
})

Error Message
TypeError: Cannot read property '__Rewire__' of undefined

Version 3

// -- feature.test.js--
import {getUserFeatures, __RewireAPI__ as featureApi} from "./feature";

test('',()=>{
   featureApi.__Rewire__("allFeatures", ()=>{
      ...
  }) 
})

Error Message
TypeError: Cannot read property '__Rewire__' of undefined

Could someone please let me know what did I do wrong? I'm deeply confused. Thanks for your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests