From c542325a58c21dfb86f0a76906507bcb8df66645 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sun, 19 Jun 2016 10:49:36 -0400 Subject: [PATCH] switch tests from babel to buble --- test/function/assignment-patterns/_config.js | 2 +- .../class-methods-not-renamed/_config.js | 2 +- test/function/cycles-pathological/_config.js | 2 +- .../deconstructed-exported-vars/_config.js | 2 +- test/function/export-destruction/_config.js | 2 +- test/function/import-default-class/_config.js | 2 +- test/function/import-named-class/_config.js | 2 +- .../_config.js | 2 +- .../object-destructuring-renaming/_config.js | 2 +- .../top-level-arrow-function/_config.js | 2 +- test/sourcemaps/transforms/_config.js | 7 +++---- test/test.js | 20 ++++++++----------- 12 files changed, 21 insertions(+), 26 deletions(-) diff --git a/test/function/assignment-patterns/_config.js b/test/function/assignment-patterns/_config.js index d4afdc3..e21b4a0 100644 --- a/test/function/assignment-patterns/_config.js +++ b/test/function/assignment-patterns/_config.js @@ -1,4 +1,4 @@ module.exports = { description: 'allows reassigments to default parameters that shadow imports', - babel: true + buble: true }; diff --git a/test/function/class-methods-not-renamed/_config.js b/test/function/class-methods-not-renamed/_config.js index 0b31fd0..99bfc6e 100644 --- a/test/function/class-methods-not-renamed/_config.js +++ b/test/function/class-methods-not-renamed/_config.js @@ -3,5 +3,5 @@ module.exports = { options: { external: [ 'path' ] }, - babel: true + buble: true }; diff --git a/test/function/cycles-pathological/_config.js b/test/function/cycles-pathological/_config.js index 4e939af..8d44d9a 100644 --- a/test/function/cycles-pathological/_config.js +++ b/test/function/cycles-pathological/_config.js @@ -4,7 +4,7 @@ var warned; module.exports = { description: 'resolves pathological cyclical dependencies gracefully', - babel: true, + buble: true, options: { onwarn: function ( message ) { assert.ok( /Module .+B\.js may be unable to evaluate without .+A\.js, but is included first due to a cyclical dependency. Consider swapping the import statements in .+main\.js to ensure correct ordering/.test( message ) ); diff --git a/test/function/deconstructed-exported-vars/_config.js b/test/function/deconstructed-exported-vars/_config.js index 0451342..a210a0f 100644 --- a/test/function/deconstructed-exported-vars/_config.js +++ b/test/function/deconstructed-exported-vars/_config.js @@ -2,7 +2,7 @@ var assert = require( 'assert' ); module.exports = { description: 'allows destructuring in exported variable declarations, synthetic or otherwise', - babel: true, + buble: true, exports: function ( exports ) { assert.equal( exports.a, 1 ); assert.equal( exports.d, 4 ); diff --git a/test/function/export-destruction/_config.js b/test/function/export-destruction/_config.js index 263c8d1..1d77b9b 100644 --- a/test/function/export-destruction/_config.js +++ b/test/function/export-destruction/_config.js @@ -2,7 +2,7 @@ var assert = require( 'assert' ); module.exports = { description: 'handle destruction patterns in export declarations', - babel: true, + buble: true, exports: function ( exports ) { assert.deepEqual( Object.keys( exports ), [ 'baz', 'quux' ] ); diff --git a/test/function/import-default-class/_config.js b/test/function/import-default-class/_config.js index 5e59ef1..e3201e1 100644 --- a/test/function/import-default-class/_config.js +++ b/test/function/import-default-class/_config.js @@ -1,6 +1,6 @@ module.exports = { description: 'imports a default class', - babel: true + buble: true }; // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-default-class diff --git a/test/function/import-named-class/_config.js b/test/function/import-named-class/_config.js index e7749d0..02a6302 100644 --- a/test/function/import-named-class/_config.js +++ b/test/function/import-named-class/_config.js @@ -1,6 +1,6 @@ module.exports = { description: 'imports a named class', - babel: true + buble: true }; // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-named-class diff --git a/test/function/import-nameless-class-expression/_config.js b/test/function/import-nameless-class-expression/_config.js index 562c561..e6cacef 100644 --- a/test/function/import-nameless-class-expression/_config.js +++ b/test/function/import-nameless-class-expression/_config.js @@ -1,6 +1,6 @@ module.exports = { description: 'imports a nameless class expression', - babel: true + buble: true }; // test copied from https://github.com/esnext/es6-module-transpiler/tree/master/test/examples/export-class-expression diff --git a/test/function/object-destructuring-renaming/_config.js b/test/function/object-destructuring-renaming/_config.js index 4a1b8b6..cae5239 100644 --- a/test/function/object-destructuring-renaming/_config.js +++ b/test/function/object-destructuring-renaming/_config.js @@ -4,7 +4,7 @@ module.exports = { description: 'renaming destructured object properties should request the correct property (#527)', // we must transpile the object destructuring to test it - babel: true, + buble: true, exports: function ( exports ) { assert.equal( exports.env, process.env ); diff --git a/test/function/top-level-arrow-function/_config.js b/test/function/top-level-arrow-function/_config.js index 6ce4fd3..5bdf0bc 100644 --- a/test/function/top-level-arrow-function/_config.js +++ b/test/function/top-level-arrow-function/_config.js @@ -1,4 +1,4 @@ module.exports = { description: 'handles naked return value from top-level arrow function expression (#403)', - babel: true + buble: true }; diff --git a/test/sourcemaps/transforms/_config.js b/test/sourcemaps/transforms/_config.js index b76a885..77b9354 100644 --- a/test/sourcemaps/transforms/_config.js +++ b/test/sourcemaps/transforms/_config.js @@ -1,4 +1,4 @@ -var babel = require( 'babel-core' ); +var buble = require( 'buble' ); var MagicString = require( 'magic-string' ); var assert = require( 'assert' ); var getLocation = require( '../../utils/getLocation' ); @@ -10,9 +10,8 @@ module.exports = { plugins: [ { transform: function ( source, id ) { - return babel.transform( source, { - blacklist: [ 'es6.modules' ], - sourceMap: true + return buble.transform( source, { + transforms: { modules: false } }); } }, diff --git a/test/test.js b/test/test.js index 639104e..df63971 100644 --- a/test/test.js +++ b/test/test.js @@ -6,7 +6,7 @@ var os = require( 'os' ); var sander = require( 'sander' ); var assert = require( 'assert' ); var exec = require( 'child_process' ).exec; -var babel = require( 'babel-core' ); +var buble = require( 'buble' ); var rollup = require( '../dist/rollup' ); var FUNCTION = path.resolve( __dirname, 'function' ); @@ -171,15 +171,12 @@ describe( 'rollup', function () { if ( unintendedError ) throw unintendedError; if ( config.error || config.generateError ) return; - var code; + var code = result.code; - if ( config.babel ) { - code = babel.transform( result.code, { - blacklist: [ 'es6.modules' ], - loose: [ 'es6.classes' ] + if ( config.buble ) { + code = buble.transform( code, { + transforms: { modules: false } }).code; - } else { - code = result.code; } if ( config.code ) config.code( code ); @@ -372,10 +369,9 @@ describe( 'rollup', function () { if ( config.execute ) { try { - if ( config.babel ) { - code = babel.transform( code, { - blacklist: [ 'es6.modules' ], - loose: [ 'es6.classes' ] + if ( config.buble ) { + code = buble.transform( code, { + transforms: { modules: false } }).code; }