Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
reinstate named exports from object literals test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 5, 2015
1 parent 3c55518 commit 9687b2d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/samples/named-exports-from-object-literal/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 1;
5 changes: 5 additions & 0 deletions test/samples/named-exports-from-object-literal/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { a, b, c } from './other.js';

assert.equal( a, 1 );
assert.equal( b, 2 );
assert.equal( c, 3 );
9 changes: 9 additions & 0 deletions test/samples/named-exports-from-object-literal/other.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var a = require( './a.js' );
var b = 2;

module.exports = {
a: a,
b: b,
c: a + b,
2: 1 + 1
};
14 changes: 14 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,20 @@ describe( 'rollup-plugin-commonjs', function () {
});
});

it( 'identifies named exports from object literals', function () {
return rollup.rollup({
entry: 'samples/named-exports-from-object-literal/main.js',
plugins: [ commonjs() ]
}).then( function ( bundle ) {
var generated = bundle.generate({
format: 'cjs'
});

var fn = new Function ( 'module', 'assert', generated.code );
fn( {}, assert );
});
});

it( 'handles references to `global`', function () {
return rollup.rollup({
entry: 'samples/global/main.js',
Expand Down

0 comments on commit 9687b2d

Please sign in to comment.