I'm extremely stupid and didn't commit as I go. To anyone reading this I'm extremely sorry. A lot of these changes are very broad and I plan on releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm afraid I couldn't wait. If you're ever in London I'll buy you a beer (or assorted beverage!) to make up for it, also I'll kiss your feet and give you a back massage, maybe.
23 lines
640 B
JavaScript
23 lines
640 B
JavaScript
var transform = require("../lib/transformation");
|
|
var Plugin = require("../lib/transformation/plugin");
|
|
var babel = require("../lib/api/node");
|
|
var chai = require("chai");
|
|
|
|
suite("traversal path", function () {
|
|
test("replaceWithSourceString", function () {
|
|
var expectCode = "function foo() {}";
|
|
|
|
var actualCode = transform(expectCode, {
|
|
plugins: [new Plugin({
|
|
visitor: {
|
|
FunctionDeclaration: function (path) {
|
|
path.replaceWithSourceString("console.whatever()");
|
|
}
|
|
}
|
|
})]
|
|
}).code;
|
|
|
|
chai.expect(actualCode).to.be.equal("console.whatever();");
|
|
});
|
|
});
|