@@ -8,7 +8,7 @@ test('index.js of module dir', function(done) {
88 resolve ( 'module-a' , { paths : [ fixtures_dir ] , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
99 assert . ifError ( err ) ;
1010 assert . equal ( path , require . resolve ( './fixtures/node_modules/module-a/index' ) ) ;
11- assert . strictEqual ( pkg , undefined ) ;
11+ assert . strictEqual ( pkg . main , 'fixtures' ) ;
1212 done ( ) ;
1313 } ) ;
1414} ) ;
@@ -70,7 +70,7 @@ test('string alt browser field as main - require subfile', function(done) {
7070// one of the keys replaces the main file
7171// this would be done if the user needed to replace main and some other module
7272test ( 'object browser field as main' , function ( done ) {
73- resolve ( 'module-d' , { paths : [ fixtures_dir ] , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
73+ resolve ( 'module-d' , { paths : [ fixtures_dir ] } , function ( err , path , pkg ) {
7474 assert . ifError ( err ) ;
7575 assert . equal ( path , require . resolve ( './fixtures/node_modules/module-d/browser' ) ) ;
7676 assert . equal ( pkg . main , './browser.js' ) ;
@@ -82,7 +82,7 @@ test('object browser field as main', function(done) {
8282// one of the keys replaces the main file
8383// however the main has no prefix and browser uses ./ prefix for the same file
8484test ( 'object browser field as main' , function ( done ) {
85- resolve ( 'module-k' , { paths : [ fixtures_dir ] , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
85+ resolve ( 'module-k' , { paths : [ fixtures_dir ] } , function ( err , path , pkg ) {
8686 assert . ifError ( err ) ;
8787 assert . equal ( path , require . resolve ( './fixtures/node_modules/module-k/browser' ) ) ;
8888 assert . equal ( pkg . main , './browser.js' ) ;
@@ -91,7 +91,7 @@ test('object browser field as main', function(done) {
9191} ) ;
9292
9393test ( 'deep module reference mapping' , function ( done ) {
94- resolve ( 'module-l/direct' , { basedir : __dirname + '/fixtures' , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
94+ resolve ( 'module-l/direct' , { basedir : __dirname + '/fixtures' } , function ( err , path , pkg ) {
9595 assert . ifError ( err ) ;
9696 assert . equal ( path , require . resolve ( './fixtures/node_modules/module-l/browser-direct' ) ) ;
9797 assert . equal ( pkg . main , './browser.js' ) ;
@@ -102,14 +102,14 @@ test('deep module reference mapping', function(done) {
102102// package.json has browser field as object
103103// test that file resolves even though the file extension is omitted
104104test ( 'deep module reference mapping without file extension - .js' , function ( done ) {
105- resolve ( 'module-n/foo' , { basedir : __dirname + '/fixtures' , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
105+ resolve ( 'module-n/foo' , { basedir : __dirname + '/fixtures' } , function ( err , path , pkg ) {
106106 assert . ifError ( err ) ;
107107 assert . equal ( path , require . resolve ( './fixtures/node_modules/module-n/browser-foo' ) ) ;
108108 done ( ) ;
109109 } ) ;
110110} ) ;
111111test ( 'deep module reference mapping without file extension - .json' , function ( done ) {
112- resolve ( 'module-n/bar' , { basedir : __dirname + '/fixtures' , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
112+ resolve ( 'module-n/bar' , { basedir : __dirname + '/fixtures' } , function ( err , path , pkg ) {
113113 assert . ifError ( err ) ;
114114 assert . equal ( path , require . resolve ( './fixtures/node_modules/module-n/browser-bar' ) ) ;
115115 done ( ) ;
@@ -285,7 +285,6 @@ test('alt-browser field', function(done) {
285285test ( 'alt-browser deep module reference mapping' , function ( done ) {
286286 resolve ( 'alt-browser-field/direct' , {
287287 basedir : __dirname + '/fixtures' ,
288- package : { main : 'fixtures' } ,
289288 browser : 'chromeapp'
290289 } , function ( err , path , pkg ) {
291290 assert . ifError ( err ) ;
@@ -312,10 +311,9 @@ test('alt-browser fallback to "browser" on deps of deps', function(done) {
312311} ) ;
313312
314313test ( 'not fail on accessing path name defined in Object.prototype' , function ( done ) {
315- resolve ( 'toString' , { paths : [ fixtures_dir ] , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
314+ resolve ( 'toString' , { paths : [ fixtures_dir ] } , function ( err , path , pkg ) {
316315 assert . ifError ( err ) ;
317316 assert . equal ( path , require . resolve ( './fixtures/node_modules/toString/index' ) ) ;
318- assert . strictEqual ( pkg , undefined ) ;
319317 done ( ) ;
320318 } ) ;
321319} ) ;
@@ -334,10 +332,9 @@ test('respect symlinks', function (done) {
334332 // - node_modules
335333 // - symlink to x
336334 //
337- resolve ( 'linked' , { paths : [ fixtures_dir + '/linker/node_modules' ] , package : { main : 'fixtures' } } , function ( err , path , pkg ) {
335+ resolve ( 'linked' , { paths : [ fixtures_dir + '/linker/node_modules' ] } , function ( err , path , pkg ) {
338336 assert . ifError ( err ) ;
339337 assert . equal ( path , require . resolve ( './fixtures/linked/index' ) ) ;
340- assert . strictEqual ( pkg , undefined ) ;
341338 done ( ) ;
342339 } ) ;
343- } ) ;
340+ } ) ;
0 commit comments