@@ -385,7 +385,7 @@ test.concurrent('root install with optional deps', (): Promise<void> => {
385
385
} ) ;
386
386
387
387
test . concurrent ( 'install file: protocol with relative paths' , ( ) : Promise < void > => {
388
- return runInstall ( { noLockfile : true } , 'install-file-relative' , async config => {
388
+ return runInstall ( { } , 'install-file-relative' , async config => {
389
389
expect ( await fs . readFile ( path . join ( config . cwd , 'node_modules' , 'root-a' , 'index.js' ) ) ) . toEqual ( 'foobar;\n' ) ;
390
390
} ) ;
391
391
} ) ;
@@ -459,17 +459,30 @@ test.concurrent('install file: link file dependencies', async (): Promise<void>
459
459
} ) ;
460
460
461
461
test . concurrent ( 'install file: protocol' , ( ) : Promise < void > => {
462
- return runInstall ( { noLockfile : true } , 'install-file' , async config => {
462
+ return runInstall ( { lockfile : false } , 'install-file' , async config => {
463
463
expect ( await fs . readFile ( path . join ( config . cwd , 'node_modules' , 'foo' , 'index.js' ) ) ) . toEqual ( 'foobar;\n' ) ;
464
464
} ) ;
465
465
} ) ;
466
466
467
467
test . concurrent ( 'install with file: protocol as default' , ( ) : Promise < void > => {
468
- return runInstall ( { noLockfile : true } , 'install-file-as-default' , async config => {
468
+ return runInstall ( { } , 'install-file-as-default' , async config => {
469
469
expect ( await fs . readFile ( path . join ( config . cwd , 'node_modules' , 'foo' , 'index.js' ) ) ) . toEqual ( 'foobar;\n' ) ;
470
470
} ) ;
471
471
} ) ;
472
472
473
+ test . concurrent ( "don't install with file: protocol as default if target is a file" , ( ) : Promise < void > => {
474
+ // $FlowFixMe
475
+ return expect ( runInstall ( { lockfile : false } , 'install-file-as-default-no-file' ) ) . rejects . toBeDefined ( ) ;
476
+ } ) ;
477
+
478
+ test . concurrent ( "don't install with file: protocol as default if target is valid semver" , ( ) : Promise < void > => {
479
+ return runInstall ( { } , 'install-file-as-default-no-semver' , async config => {
480
+ expect ( await fs . readFile ( path . join ( config . cwd , 'node_modules' , 'foo' , 'package.json' ) ) ) . toMatchSnapshot (
481
+ 'install-file-as-default-no-semver' ,
482
+ ) ;
483
+ } ) ;
484
+ } ) ;
485
+
473
486
// When local packages are installed, dependencies with different forms of the same relative path
474
487
// should be deduped e.g. 'file:b' and 'file:./b'
475
488
test . concurrent ( 'install file: dedupe dependencies 1' , ( ) : Promise < void > => {
@@ -505,7 +518,7 @@ test.concurrent('install file: dedupe dependencies 3', (): Promise<void> => {
505
518
} ) ;
506
519
507
520
test . concurrent ( 'install everything when flat is enabled' , ( ) : Promise < void > => {
508
- return runInstall ( { noLockfile : true , flat : true } , 'install-file' , async config => {
521
+ return runInstall ( { lockfile : false , flat : true } , 'install-file' , async config => {
509
522
expect ( await fs . readFile ( path . join ( config . cwd , 'node_modules' , 'foo' , 'index.js' ) ) ) . toEqual ( 'foobar;\n' ) ;
510
523
} ) ;
511
524
} ) ;
@@ -587,7 +600,7 @@ test.concurrent('install should run install scripts in the order of dependencies
587
600
} ) ;
588
601
589
602
test . concurrent ( 'install with comments in manifest' , ( ) : Promise < void > => {
590
- return runInstall ( { noLockfile : true } , 'install-with-comments' , async config => {
603
+ return runInstall ( { lockfile : false } , 'install-with-comments' , async config => {
591
604
expect ( await fs . readFile ( path . join ( config . cwd , 'node_modules' , 'foo' , 'index.js' ) ) ) . toEqual ( 'foobar;\n' ) ;
592
605
} ) ;
593
606
} ) ;
@@ -759,7 +772,7 @@ test.concurrent('offline mirror can be disabled locally', (): Promise<void> => {
759
772
760
773
// sync test because we need to get all the requests to confirm their validity
761
774
test ( 'install a scoped module from authed private registry' , ( ) : Promise < void > => {
762
- return runInstall ( { noLockfile : true } , 'install-from-authed-private-registry' , async config => {
775
+ return runInstall ( { } , 'install-from-authed-private-registry' , async config => {
763
776
const authedRequests = request . __getAuthedRequests ( ) ;
764
777
765
778
expect ( authedRequests [ 0 ] . url ) . toEqual ( 'https://registry.yarnpkg.com/@types%2flodash' ) ;
@@ -774,7 +787,7 @@ test('install a scoped module from authed private registry', (): Promise<void> =
774
787
} ) ;
775
788
776
789
test ( 'install a scoped module from authed private registry with a missing trailing slash' , ( ) : Promise < void > => {
777
- return runInstall ( { noLockfile : true } , 'install-from-authed-private-registry-no-slash' , async config => {
790
+ return runInstall ( { } , 'install-from-authed-private-registry-no-slash' , async config => {
778
791
const authedRequests = request . __getAuthedRequests ( ) ;
779
792
780
793
expect ( authedRequests [ 0 ] . url ) . toEqual ( 'https://registry.yarnpkg.com/@types%2flodash' ) ;
0 commit comments