@@ -30,7 +30,7 @@ function loadMockNpm (test, args) {
30
30
...args ,
31
31
mocks : {
32
32
...mockNpmRegistryFetch ( {
33
- [ `/-/package/ ${ pkg } /dist-tags ` ] : ( ) => {
33
+ [ `/${ pkg } ` ] : ( ) => {
34
34
throw new Error ( 'not found' )
35
35
} ,
36
36
} ) . mocks ,
@@ -1088,7 +1088,6 @@ t.test('does not abort when prerelease and authored tag latest', async t => {
1088
1088
} )
1089
1089
1090
1090
t . test ( 'PREVENTS publish when latest dist-tag is HIGHER than publishing version' , async t => {
1091
- const latest = '100.0.0'
1092
1091
const version = '50.0.0'
1093
1092
1094
1093
const { npm } = await loadMockNpm ( t , {
@@ -1111,7 +1110,7 @@ t.test('PREVENTS publish when latest dist-tag is HIGHER than publishing version'
1111
1110
} ,
1112
1111
mocks : {
1113
1112
...mockNpmRegistryFetch ( {
1114
- [ `/-/package/ ${ pkg } /dist-tags ` ] : { latest } ,
1113
+ [ `/${ pkg } ` ] : { versions : { '50.0.0' : { } , '99.0.0' : { } , '100.0.0' : { } , '101.0.0-pre' : { } } } ,
1115
1114
} ) . mocks ,
1116
1115
} ,
1117
1116
} )
@@ -1120,9 +1119,8 @@ t.test('PREVENTS publish when latest dist-tag is HIGHER than publishing version'
1120
1119
} , new Error ( 'Cannot publish a lower version without an explicit dist tag.' ) )
1121
1120
} )
1122
1121
1123
- t . test ( 'ALLOWS publish when latest dist-tag is LOWER than publishing version' , async t => {
1122
+ t . test ( 'ALLOWS publish when latest versions are LOWER than publishing version' , async t => {
1124
1123
const version = '100.0.0'
1125
- const latest = '50.0.0'
1126
1124
1127
1125
const { npm } = await loadMockNpm ( t , {
1128
1126
config : {
@@ -1138,7 +1136,7 @@ t.test('ALLOWS publish when latest dist-tag is LOWER than publishing version', a
1138
1136
} ,
1139
1137
mocks : {
1140
1138
...mockNpmRegistryFetch ( {
1141
- [ `/-/package/ ${ pkg } /dist-tags ` ] : { latest } ,
1139
+ [ `/${ pkg } ` ] : { versions : { '50.0.0' : { } , '99.0.0' : { } , '101.0.0-pre' : { } } } ,
1142
1140
} ) . mocks ,
1143
1141
} ,
1144
1142
} )
@@ -1155,7 +1153,7 @@ t.test('ALLOWS publish when latest dist-tag is LOWER than publishing version', a
1155
1153
await npm . exec ( 'publish' , [ ] )
1156
1154
} )
1157
1155
1158
- t . test ( 'ALLOWS publish when latest dist-tag is missing from response ' , async t => {
1156
+ t . test ( 'ALLOWS publish when not published yet ' , async t => {
1159
1157
const version = '100.0.0'
1160
1158
1161
1159
const { npm } = await loadMockNpm ( t , {
@@ -1172,7 +1170,7 @@ t.test('ALLOWS publish when latest dist-tag is missing from response', async t =
1172
1170
} ,
1173
1171
mocks : {
1174
1172
...mockNpmRegistryFetch ( {
1175
- [ `/-/package/ ${ pkg } /dist-tags ` ] : { } ,
1173
+ [ `/${ pkg } ` ] : { } ,
1176
1174
} ) . mocks ,
1177
1175
} ,
1178
1176
} )
0 commit comments