You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

39 lines
968 B

require( 'source-map-support' ).install();
var path = require( 'path' );
var sander = require( 'sander' );
var assert = require( 'assert' );
var rollup = require( '../dist/rollup' );
var SAMPLES = path.resolve( __dirname, 'samples' );
describe( 'rollup', function () {
it( 'exists', function () {
assert.ok( !!rollup );
});
it( 'has a rollup method', function () {
assert.equal( typeof rollup.rollup, 'function' );;
});
sander.readdirSync( SAMPLES ).forEach( function ( dir ) {
var config = require( SAMPLES + '/' + dir + '/_config' );
( config.solo ? it.only : it )( config.description, function () {
return rollup.rollup( SAMPLES + '/' + dir + '/main.js' )
.then( function ( bundle ) {
var result = bundle.generate({
format: 'cjs'
});
try {
var fn = new Function( 'assert', result.code );
fn( assert );
} catch ( err ) {
console.log( result.code );
throw err;
}
});
});
});
});