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

Commit

Permalink
failing test for #144
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 14, 2016
1 parent 5e140bc commit c4c2827
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/function/define-is-undefined/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(function (global, factory) {
typeof define === 'function' && define.amd ? define(factory) :
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
(global.foo = factory());
}(this, (function () { 'use strict';

return 42;

})));
3 changes: 3 additions & 0 deletions test/function/define-is-undefined/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import foo from './foo.js';

assert.equal( foo, 42 );
14 changes: 14 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,5 +345,19 @@ describe( 'rollup-plugin-commonjs', () => {
]
}).then( executeBundle );
});

it( 'rewrites top-level defines', () => {
return rollup({
entry: 'samples/define-is-undefined/main.js',
plugins: [ commonjs() ]
})
.then( bundle => {
executeBundle( bundle, {
define () {
throw new Error( 'nope' );
}
});
});
});
});
});

0 comments on commit c4c2827

Please sign in to comment.