Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Richard Marks
    that is double underscore Rewire double underscore ... gitter interpreted it as markdown oops
    Uncaught TypeError: Cannot read property '__Rewire__' of undefined
    Gavri (Gabriel) Guy
    I tried to search for it but couldn’t get a clear answer - is there a way to rewire an es6 class instance method?
    @RichardMarks do you have a sample for your problem?
    @gavriguy rewireing only instance methods is not possible. But you can rewire the class itself.
    @TheSavior a new version rc-3 is out there with your PR.
    @/all I will again have a look at some issues on the upcoming monday.
    Eli White
    @speedskater Thank you very much!
    Robert Stiff
    Hi. And sorry to everybody for the delays. I was quite busy due to a release at my company. I will be on hollidays for the upcoming two weeks and will try to work on issues and PR in the week starting at Monday June 27th.
    David Fox-Powell
    having issues with dynamic require in es6 file yelling that require is undefined
    import thingToRewire from './thing'
    export default thing () {
    @dtothefp can you provide a sample project with your exact configuration?
    @/all published 1.0.0-rc-4
    Vincent Schramer
    Sort of unrelated discussion: I really enjoy the testing patterns that rewire enables.. does anyone know about some strategies for applying it to TypeScript? Is there a way to use this with TypeScript or some typescript-plugin-rewire equivalent?
    Uladzimir Havenchyk
    Hi there! Is it possible to mock out the import from imported component?


    MyComponent.jsx has import someCoolFunctionThatShouldBeMocked

    Tom Rosier
    has anyone seen this error before Warning: [BABEL] src/file_parser.es6: Unknown option: foreign.visitor. Check out http://babeljs.io/docs/usage/options/ for more info Use --force to continue.
    Chris Braddock
    I need some help getting Rewire working. I think it may be at least being included as a plugin now, but I can't say for sure. I can tell it's doing something now because when I enable the plugin I see in my test output: PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR LOG: 'named exports are not supported in *.vue files.' however, I do not see any __RewireAPI__ being added to exports in my test files :(
    Chris Braddock
    ^ I've used vue-templates webpack as a starting point so isparta is involved
    hi all, i found project and cant start it, i use nodemon --exec babel -- --stage 1 --optional strict -- index.js, but there are error "Error: Cannot find module '/home/wq/rozum2/1'" i think that the reason is in babel, what can be wrong?
    --stage 1
    Can I use Babel-rewire-plugin when I run a Mocha test from IntelliJ?
    Roy Mor

    How can I spy on a function that is references from an object? Example:

    const map = {
    function run(options)  {
    function a() {...}
    function b() {...}
    function c() {...}


    import { a, __RewireAPI__ as ARewireAPI } from './a';
    describe('a', () => {
      describe('run', () => {
        const spy= jasmine.createSpy('spy').and.callFake(() => {
        beforeEach(() => {
          ARewireAPI.__Rewire__('b', spy);
        afterEach(() => {
        it('calls b()', () => {
          a.run({val: 'b'}); // doesn't call the spy because what actually being called is the reference from the map object
    Claire Martinez
    has anyone had any luck running the 1.x version of the require plugin with karma/jasmine on Phantomjs? its working on Chrome but not Phantomjs for me.
    I get errs like TypeError: 'undefined' is not a function (evaluating '_get__('AGGrid').__ResetDependency__('AgGridReact')') at :322
    Claire Martinez
    Oh I see it's already reported as an issue speedskater/babel-plugin-rewire#109 ; but it's not fixed yet.
    hey guys, i’m trying to do a simple rewire and I get this error: TypeError: _photoImgFileHandler$2.default.Rewire is not a function
    is there another requirements other than installing babel-plugin-rewire through npm ?
    ignore that, needed to add a plugins key to my babel.rc file
    Brandon Ramsey
    I feel like I’m doing something wrong — When I put babel-plugin-rewire into place, all of my imports into my tested files start failing. I saw the ignoredIdentifiers config option — Am I supposed to ignore everything that is imported into all of my tested files? Some of my imports look like:
    import {Map} from ‘immutable’
    import {flatMap} from ‘lodash’
    Bruno Teixeira
    hey guys?
    anyone there*
    John Wolfe
    good morning, i have a question. is it possible to use ES6 promises without module bundling when using babel through gulp on my js files?
    emmm, no one
    Hello, Everyone, I want to ask is there a way to get the mocked function details like returned values and args in babel-plugin-rewire?
    Please see this link: