diff --git a/src/Declaration.js b/src/Declaration.js index 76c7fa1..d5e69b6 100644 --- a/src/Declaration.js +++ b/src/Declaration.js @@ -76,10 +76,12 @@ export class SyntheticDefaultDeclaration { } addReference ( reference ) { + // Bind the reference to `this` declaration. + reference.declaration = this; + // Don't change the name to `default`; it's not a valid identifier name. if ( reference.name === 'default' ) return; - reference.declaration = this; this.name = reference.name; } diff --git a/test/form/sourcemaps-inline/_config.js b/test/form/sourcemaps-inline/_config.js index 1308c06..9cf89fc 100644 --- a/test/form/sourcemaps-inline/_config.js +++ b/test/form/sourcemaps-inline/_config.js @@ -1,5 +1,6 @@ module.exports = { description: 'correct sourcemaps are written (inline)', + skipIfWindows: true, options: { sourceMap: 'inline' } diff --git a/test/form/sourcemaps/_config.js b/test/form/sourcemaps/_config.js index 81e648a..ef616f7 100644 --- a/test/form/sourcemaps/_config.js +++ b/test/form/sourcemaps/_config.js @@ -1,5 +1,6 @@ module.exports = { description: 'correct sourcemaps are written (separate file)', + skipIfWindows: true, options: { sourceMap: true } diff --git a/test/function/resolves-namespace-default/_config.js b/test/function/resolves-namespace-default/_config.js new file mode 100644 index 0000000..4e28079 --- /dev/null +++ b/test/function/resolves-namespace-default/_config.js @@ -0,0 +1,9 @@ +var assert = require('assert'); + +module.exports = { + description: "namespace's 'default' properties should be available", + + exports: function ( exports ) { + assert.equal( exports, 42 ); + } +}; diff --git a/test/function/resolves-namespace-default/main.js b/test/function/resolves-namespace-default/main.js new file mode 100644 index 0000000..1789010 --- /dev/null +++ b/test/function/resolves-namespace-default/main.js @@ -0,0 +1,3 @@ +import * as mod from './mod.js'; + +export default mod.default(); diff --git a/test/function/resolves-namespace-default/mod.js b/test/function/resolves-namespace-default/mod.js new file mode 100644 index 0000000..8883e9e --- /dev/null +++ b/test/function/resolves-namespace-default/mod.js @@ -0,0 +1 @@ +export default function () { return 42; } diff --git a/test/test.js b/test/test.js index 13790be..3599ae9 100644 --- a/test/test.js +++ b/test/test.js @@ -46,13 +46,19 @@ describe( 'rollup', function () { assert.equal( typeof rollup.rollup, 'function' ); }); - it( 'fails without options or options.entry', function () { - rollup.rollup().catch( function (err) { - assert( /must supply options\.entry/.test( err.toString() ) ); + it( 'fails without options', function () { + return rollup.rollup().then( function () { + throw new Error( 'Missing expected error' ); + }, function (err) { + assert.equal( 'You must supply options.entry to rollup', err.message ); }); + }); - rollup.rollup().catch( function (err) { - assert( /must supply options\.entry/.test( err.toString() ) ); + it( 'fails without options.entry', function () { + return rollup.rollup({}).then( function () { + throw new Error( 'Missing expected error' ); + }, function (err) { + assert.equal( 'You must supply options.entry to rollup', err.message ); }); }); }); @@ -221,6 +227,8 @@ describe( 'rollup', function () { var config = require( FORM + '/' + dir + '/_config' ); + if ( config.skipIfWindows && process.platform === 'win32' ) return; + var options = extend( {}, config.options, { entry: FORM + '/' + dir + '/main.js' });