|
@ -77,7 +77,7 @@ describe( 'rollup', function () { |
|
|
return rollup.rollup({ entry: 'x', plUgins: [] }).then( function () { |
|
|
return rollup.rollup({ entry: 'x', plUgins: [] }).then( function () { |
|
|
throw new Error( 'Missing expected error' ); |
|
|
throw new Error( 'Missing expected error' ); |
|
|
}, function ( err ) { |
|
|
}, function ( err ) { |
|
|
assert.equal( err.message, 'Unexpected key \'plUgins\' found, expected one of: banner, dest, entry, exports, external, footer, format, globals, indent, intro, moduleId, moduleName, noConflict, onwarn, outro, plugins, preferConst, sourceMap, treeshake, useStrict' ); |
|
|
assert.equal( err.message, 'Unexpected key \'plUgins\' found, expected one of: banner, dest, entry, exports, external, footer, format, globals, indent, intro, moduleId, moduleName, noConflict, onwarn, outro, plugins, preferConst, sourceMap, targets, treeshake, useStrict' ); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
@ -154,7 +154,6 @@ describe( 'rollup', function () { |
|
|
|
|
|
|
|
|
// try to generate output
|
|
|
// try to generate output
|
|
|
try { |
|
|
try { |
|
|
if(config.bundleOptions) { console.log(config.bundleOptions); } |
|
|
|
|
|
var result = bundle.generate( extend( {}, config.bundleOptions, { |
|
|
var result = bundle.generate( extend( {}, config.bundleOptions, { |
|
|
format: 'cjs' |
|
|
format: 'cjs' |
|
|
})); |
|
|
})); |
|
@ -253,7 +252,12 @@ describe( 'rollup', function () { |
|
|
if ( config.skipIfWindows && process.platform === 'win32' ) return; |
|
|
if ( config.skipIfWindows && process.platform === 'win32' ) return; |
|
|
|
|
|
|
|
|
var options = extend( {}, config.options, { |
|
|
var options = extend( {}, config.options, { |
|
|
entry: FORM + '/' + dir + '/main.js' |
|
|
entry: FORM + '/' + dir + '/main.js', |
|
|
|
|
|
onwarn: msg => { |
|
|
|
|
|
if ( /No name was provided for/.test( msg ) ) return; |
|
|
|
|
|
if ( /as external dependency/.test( msg ) ) return; |
|
|
|
|
|
console.error( msg ); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
( config.skip ? describe.skip : config.solo ? describe.only : describe)( dir, function () { |
|
|
( config.skip ? describe.skip : config.solo ? describe.only : describe)( dir, function () { |
|
@ -309,7 +313,7 @@ describe( 'rollup', function () { |
|
|
var config = loadConfig( SOURCEMAPS + '/' + dir + '/_config.js' ); |
|
|
var config = loadConfig( SOURCEMAPS + '/' + dir + '/_config.js' ); |
|
|
|
|
|
|
|
|
var entry = path.resolve( SOURCEMAPS, dir, 'main.js' ); |
|
|
var entry = path.resolve( SOURCEMAPS, dir, 'main.js' ); |
|
|
var dest = path.resolve( SOURCEMAPS, dir, '_actual/bundle.js' ); |
|
|
var dest = path.resolve( SOURCEMAPS, dir, '_actual/bundle' ); |
|
|
|
|
|
|
|
|
var options = extend( {}, config.options, { |
|
|
var options = extend( {}, config.options, { |
|
|
entry: entry |
|
|
entry: entry |
|
@ -321,7 +325,7 @@ describe( 'rollup', function () { |
|
|
var options = extend( {}, { |
|
|
var options = extend( {}, { |
|
|
format: profile.format, |
|
|
format: profile.format, |
|
|
sourceMap: true, |
|
|
sourceMap: true, |
|
|
dest: dest |
|
|
dest: `${dest}.${profile.format}.js` |
|
|
}, config.options ); |
|
|
}, config.options ); |
|
|
|
|
|
|
|
|
bundle.write( options ); |
|
|
bundle.write( options ); |
|
@ -354,9 +358,13 @@ describe( 'rollup', function () { |
|
|
PATH: path.resolve( __dirname, '../bin' ) + path.delimiter + process.env.PATH |
|
|
PATH: path.resolve( __dirname, '../bin' ) + path.delimiter + process.env.PATH |
|
|
} |
|
|
} |
|
|
}, function ( err, code, stderr ) { |
|
|
}, function ( err, code, stderr ) { |
|
|
if ( err || config.error ) { |
|
|
if ( err ) { |
|
|
config.error( err ); |
|
|
if ( config.error ) { |
|
|
return done(); |
|
|
config.error( err ); |
|
|
|
|
|
return done(); |
|
|
|
|
|
} else { |
|
|
|
|
|
throw err; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( stderr ) console.error( stderr ); |
|
|
if ( stderr ) console.error( stderr ); |
|
@ -410,6 +418,20 @@ describe( 'rollup', function () { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else if ( sander.existsSync( '_expected' ) && sander.statSync( '_expected' ).isDirectory() ) { |
|
|
|
|
|
var error = null; |
|
|
|
|
|
sander.readdirSync( '_expected' ).forEach( child => { |
|
|
|
|
|
var expected = sander.readFileSync( path.join( '_expected', child ) ).toString(); |
|
|
|
|
|
var actual = sander.readFileSync( path.join( '_actual', child ) ).toString(); |
|
|
|
|
|
try { |
|
|
|
|
|
assert.equal( normaliseOutput( actual ), normaliseOutput( expected ) ); |
|
|
|
|
|
} catch ( err ) { |
|
|
|
|
|
error = err; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
done( error ); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
else { |
|
|
else { |
|
|
var expected = sander.readFileSync( '_expected.js' ).toString(); |
|
|
var expected = sander.readFileSync( '_expected.js' ).toString(); |
|
|
try { |
|
|
try { |
|
|