buba v4.0.2
buba
Bublé transform + a little bit of Babel
Why?
Because a wise man once said your source code should be transpiled with same tool as your tests to avoid any hidden bugs.
The usecase would be transpiling es* source code with Bublé and have tests match as well. An alternative to using babel-register
The primary transformer here is Bublé we only use Babel for support with module import/exports.
Install
npm install buba --save-devUsage
Source code
CLI
buba -i input.js -o output.js
# or with a directory
buba -i src/ -o lib/
# to enable sourceMaps
buba -i input.js -o output.js -sAPI Usage
import { transformFile } from 'buba'
const { code, map } = transformFile('input.js', {
buble: {} // buble options
babel: {} // babel options
})Tests
mocha --require buba/register tests/**/*.js
# or
tape --require buba/register tests/**/*.jsWith mocha you can also provide buba within the mocha.opts config file:
--require buba/register
--reporter spec
--ui bddCurrently we only plan to use Babel for modules but you can add support for something like generators by adding a .babelrc file.
API Usage
Just make sure that buba is the 1st thing you require
require('buba/register')
const prelude = require('./prelude') // prelude has import/export, arrow functions, etcTodo
- Add Tests
- Add Bublé options
- Add CLI supoort - thanks @TylorS
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago