Git Product home page Git Product logo

Comments (6)

raphaelokon avatar raphaelokon commented on June 2, 2024 2

Hi @speedskater. I just use a custom .babelrc with plugins:["babel-plugin-rewire"].
In my mocha.opts I just tell mocha to use babel/register, et voila.
Thanks for the awesome plugin!

from babel-plugin-rewire.

ParAnton avatar ParAnton commented on June 2, 2024 1

To make it work I have in my .babelrc file
"env": { "test":{ "plugins": ["babel-plugin-rewire"] } }
and when I run my test I have to tell babel to use the test by setting
BABEL_ENV=test in my npm cmd before the mocha command

from babel-plugin-rewire.

speedskater avatar speedskater commented on June 2, 2024

I havn't used it in this way myself. But I think you can use a babel require hook: https://babeljs.io/docs/usage/require/. In the options of the hook you can than specify babel-plugin-rewire. This hook than can be invoked by the --require option of mocha (https://mochajs.org/).
I hope this works for you. Just let me know if this solves your issue?

from babel-plugin-rewire.

speedskater avatar speedskater commented on June 2, 2024

@nordisk Thanks. Glad to read, that it works for you and you like it.

from babel-plugin-rewire.

nschurmann avatar nschurmann commented on June 2, 2024

This actually throws an error for me, undefined is not a function, on line 26 of babel-plugin-rewire. Seems that Plugin is undefined.

from babel-plugin-rewire.

liusy182 avatar liusy182 commented on June 2, 2024

I am also hitting the same error when trying to declare the plug-in in .babel.rc. I am interested to know how to get it running.

from babel-plugin-rewire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.