File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
test/cases/parsing/issue-387 Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ module . exports = 4321 ;
Original file line number Diff line number Diff line change 1+ it ( "should parse cujojs UMD modules" , function ( ) {
2+ ( function ( define ) {
3+
4+ // using the define signature that triggers AMD-wrapped CommonJS
5+ define ( function ( require ) {
6+ return 123 ;
7+ } ) ;
8+ } (
9+ typeof define == 'function' && define . amd
10+ ? define
11+ : function ( factory ) { module . exports = factory ( require ) ; }
12+ ) ) ;
13+ module . exports . should . be . eql ( 123 ) ;
14+ } ) ;
15+
16+ it ( "should parse cujojs UMD modules with deps" , function ( ) {
17+ ( function ( define ) {
18+
19+ // dependencies are listed in the dependency array
20+ define ( [ './file' ] , function ( file ) {
21+ return 1234 ;
22+ } ) ;
23+
24+ } (
25+ typeof define == 'function' && define . amd
26+ ? define
27+ : function ( ids , factory ) {
28+ // note: the lambda function cannot be removed in some CJS environments
29+ var deps = ids . map ( function ( id ) { return require ( id ) ; } ) ;
30+ module . exports = factory . apply ( null , deps ) ;
31+ }
32+ ) ) ;
33+ module . exports . should . be . eql ( 1234 ) ;
34+ } ) ;
35+
36+ it ( "should parse cujojs UMD modules with inlinded deps" , function ( ) {
37+ ( function ( define ) {
38+
39+ // using the define signature that triggers AMD-wrapped CommonJS
40+ define ( function ( require ) {
41+ return require ( "./file" ) ;
42+ } ) ;
43+ } (
44+ typeof define == 'function' && define . amd
45+ ? define
46+ : function ( factory ) { module . exports = factory ( require ) ; }
47+ ) ) ;
48+ module . exports . should . be . eql ( 4321 ) ;
49+ } ) ;
You can’t perform that action at this time.
0 commit comments