From a3a2b2b1e6b461d0705518cbb1eac060359ea223 Mon Sep 17 00:00:00 2001 From: Rich-Harris Date: Sat, 10 Oct 2015 12:12:35 -0400 Subject: [PATCH] update tests --- test/form/intro-and-outro/_config.js | 1 - test/sourcemaps/basic-support/_config.js | 6 +++--- test/sourcemaps/transforms/_config.js | 4 ++-- test/test.js | 8 ++++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/form/intro-and-outro/_config.js b/test/form/intro-and-outro/_config.js index d1166f4..36b7a9d 100644 --- a/test/form/intro-and-outro/_config.js +++ b/test/form/intro-and-outro/_config.js @@ -1,5 +1,4 @@ module.exports = { - solo: true, description: 'adds an intro/outro', options: { intro: '/* this is an intro */', diff --git a/test/sourcemaps/basic-support/_config.js b/test/sourcemaps/basic-support/_config.js index c547c32..d2910f7 100644 --- a/test/sourcemaps/basic-support/_config.js +++ b/test/sourcemaps/basic-support/_config.js @@ -18,7 +18,7 @@ module.exports = { assert.equal( originalLoc.line, 4 ); assert.equal( originalLoc.column, 0 ); - assert.equal( originalLoc.source, 'sourcemaps/basic-support/main.js' ); + assert.equal( originalLoc.source, '../main.js' ); // foo.js generatedLoc = getLocation( code, code.indexOf( "console.log( 'hello from foo.js' )" ) ); @@ -26,7 +26,7 @@ module.exports = { assert.equal( originalLoc.line, 2 ); assert.equal( originalLoc.column, 1 ); - assert.equal( originalLoc.source, 'sourcemaps/basic-support/foo.js' ); + assert.equal( originalLoc.source, '../foo.js' ); // bar.js generatedLoc = getLocation( code, code.indexOf( "console.log( 'hello from bar.js' )" ) ); @@ -34,6 +34,6 @@ module.exports = { assert.equal( originalLoc.line, 2 ); assert.equal( originalLoc.column, 1 ); - assert.equal( originalLoc.source, 'sourcemaps/basic-support/bar.js' ); + assert.equal( originalLoc.source, '../bar.js' ); } }; diff --git a/test/sourcemaps/transforms/_config.js b/test/sourcemaps/transforms/_config.js index 46cd854..e5c230f 100644 --- a/test/sourcemaps/transforms/_config.js +++ b/test/sourcemaps/transforms/_config.js @@ -17,7 +17,7 @@ module.exports = { function ( source, id ) { var s = new MagicString( source ); - s.prepend( '// this is a comment\n' ); + s.append( '\nassert.equal( 1 + 1, 2 );\nassert.equal( 2 + 2, 4 );' ); return { code: s.toString(), @@ -29,7 +29,7 @@ module.exports = { test: function ( code, map ) { var smc = new SourceMapConsumer( map ); - var generatedLoc = getLocation( code, code.indexOf( 42 ) ); + var generatedLoc = getLocation( code, code.indexOf( '42' ) ); var originalLoc = smc.originalPositionFor( generatedLoc ); assert.ok( /foo/.test( originalLoc.source ) ); diff --git a/test/test.js b/test/test.js index dfdcac7..9c442ac 100644 --- a/test/test.js +++ b/test/test.js @@ -270,9 +270,11 @@ describe( 'rollup', function () { describe( dir, function () { var config = require( SOURCEMAPS + '/' + dir + '/_config' ); + var entry = path.resolve( SOURCEMAPS, dir, 'main.js' ); + var dest = path.resolve( SOURCEMAPS, dir, '_actual/bundle.js' ); var options = extend( {}, config.options, { - entry: SOURCEMAPS + '/' + dir + '/main.js' + entry: entry }); PROFILES.forEach( function ( profile ) { @@ -281,9 +283,11 @@ describe( 'rollup', function () { var options = extend( {}, config.options, { format: profile.format, sourceMap: true, - sourceMapFile: path.resolve( __dirname, 'bundle.js' ) + dest: dest }); + bundle.write( options ); + var result = bundle.generate( options ); config.test( result.code, result.map ); });