@@ -128,7 +128,7 @@ test('trace transforms json', t => {
128128 contents : "define('text!foo/bar.json',function(){return \"{\\\"a\\\":1}\";});\n" ,
129129 sourceMap : undefined ,
130130 moduleId : 'foo/bar.json' ,
131- defined : [ 'text!foo/bar.json' ] ,
131+ defined : 'text!foo/bar.json' ,
132132 deps : [ ] ,
133133 packageName : undefined ,
134134 shimed : undefined
@@ -150,7 +150,7 @@ test('trace transforms text file', t => {
150150 contents : "define('text!foo/bar.html',function(){return \"<p></p>\";});\n" ,
151151 sourceMap : undefined ,
152152 moduleId : 'foo/bar.html' ,
153- defined : [ 'text!foo/bar.html' ] ,
153+ defined : 'text!foo/bar.html' ,
154154 deps : [ ] ,
155155 packageName : undefined ,
156156 shimed : undefined
@@ -288,3 +288,49 @@ test('trace supports cache', t => {
288288 t . end ( ) ;
289289 } ) ;
290290} ) ;
291+
292+ test ( 'trace traces npm js with dist alias' , t => {
293+ const unit = {
294+ path : 'node_modules/foo/dist/bar.js' ,
295+ contents : "define(['a','text!./b.css'],function() {});" ,
296+ moduleId : 'foo/dist/bar' ,
297+ packageName : 'foo'
298+ }
299+
300+ trace ( unit ) . then ( traced => {
301+ t . deepEqual ( traced , {
302+ path : 'node_modules/foo/dist/bar.js' ,
303+ contents : "define('foo/dist/bar',['a','text!./b.css'],function() {});define('foo/bar',['foo/dist/bar'],function(m){return m;});\n" ,
304+ sourceMap : undefined ,
305+ moduleId : 'foo/dist/bar' ,
306+ defined : [ 'foo/dist/bar' , 'foo/bar' ] ,
307+ deps : [ 'a' , 'text!foo/dist/b.css' ] ,
308+ packageName : 'foo' ,
309+ shimed : undefined
310+ } )
311+ t . end ( ) ;
312+ } ) ;
313+ } ) ;
314+
315+ test ( 'trace traces npm html with dist alias' , t => {
316+ const unit = {
317+ path : 'node_modules/foo/dist/cjs/bar.html' ,
318+ contents : "<p></p>" ,
319+ moduleId : 'foo/dist/cjs/bar.html' ,
320+ packageName : 'foo'
321+ }
322+
323+ trace ( unit ) . then ( traced => {
324+ t . deepEqual ( traced , {
325+ path : 'node_modules/foo/dist/cjs/bar.html' ,
326+ contents : "define('text!foo/dist/cjs/bar.html',function(){return \"<p></p>\";});\ndefine('text!foo/bar.html',['text!foo/dist/cjs/bar.html'],function(m){return m;});\n" ,
327+ sourceMap : undefined ,
328+ moduleId : 'foo/dist/cjs/bar.html' ,
329+ defined : [ 'text!foo/dist/cjs/bar.html' , 'text!foo/bar.html' ] ,
330+ deps : [ ] ,
331+ packageName : 'foo' ,
332+ shimed : undefined
333+ } )
334+ t . end ( ) ;
335+ } ) ;
336+ } ) ;
0 commit comments