@@ -8,30 +8,82 @@ describe('npm-packages publishNpmPackages', function () {
88 let listNpmPackages : SinonStub ;
99 let markBumpedFilesAsAssumeUnchanged : SinonStub ;
1010 let spawnSync : SinonStub ;
11+ const lernaBin = path . resolve (
12+ __dirname ,
13+ '..' ,
14+ '..' ,
15+ '..' ,
16+ '..' ,
17+ 'node_modules' ,
18+ '.bin' ,
19+ 'lerna'
20+ ) ;
1121
1222 beforeEach ( function ( ) {
1323 listNpmPackages = sinon . stub ( ) ;
1424 markBumpedFilesAsAssumeUnchanged = sinon . stub ( ) ;
1525 spawnSync = sinon . stub ( ) ;
1626 } ) ;
1727
18- it ( 'calls lerna to publish packages for a real version' , function ( ) {
19- const lernaBin = path . resolve (
20- __dirname ,
21- '..' ,
22- '..' ,
23- '..' ,
24- '..' ,
25- 'node_modules' ,
26- '.bin' ,
27- 'lerna'
28- ) ;
28+ it ( 'throws if mongosh is not existent when publishing all' , function ( ) {
2929 const packages = [ { name : 'packageA' , version : '0.7.0' } ] ;
3030 listNpmPackages . returns ( packages ) ;
3131
32+ expect ( ( ) =>
33+ publishNpmPackages (
34+ { isDryRun : false , useAuxiliaryPackagesOnly : false } ,
35+ listNpmPackages ,
36+ markBumpedFilesAsAssumeUnchanged ,
37+ spawnSync
38+ )
39+ ) . throws ( 'mongosh package not found' ) ;
40+ } ) ;
41+
42+ it ( 'takes mongosh version and pushes tags' , function ( ) {
43+ const packages = [
44+ { name : 'packageA' , version : '0.7.0' } ,
45+ { name : 'mongosh' , version : '1.2.0' } ,
46+ ] ;
47+ listNpmPackages . returns ( packages ) ;
48+
49+ publishNpmPackages (
50+ { isDryRun : false , useAuxiliaryPackagesOnly : false } ,
51+ listNpmPackages ,
52+ markBumpedFilesAsAssumeUnchanged ,
53+ spawnSync
54+ ) ;
55+
56+ expect ( spawnSync ) . calledWith ( 'git' , [ 'tag' , '-a' , '1.2.0' , '-m' , '1.2.0' ] ) ;
57+ expect ( spawnSync ) . calledWith ( 'git' , [ 'push' , '--follow-tags' ] ) ;
58+ } ) ;
59+
60+ it ( 'does not manually push tags with auxiliary packages' , function ( ) {
61+ const packages = [
62+ { name : 'packageA' , version : '0.7.0' } ,
63+ { name : 'mongosh' , version : '1.2.0' } ,
64+ ] ;
65+ listNpmPackages . returns ( packages ) ;
66+
67+ publishNpmPackages (
68+ { isDryRun : false , useAuxiliaryPackagesOnly : true } ,
69+ listNpmPackages ,
70+ markBumpedFilesAsAssumeUnchanged ,
71+ spawnSync
72+ ) ;
73+
74+ expect ( spawnSync ) . calledWith ( 'git' , [ 'tag' , '-a' , '1.2.0' , '-m' , '1.2.0' ] ) ;
75+ expect ( spawnSync ) . calledWith ( 'git' , [ 'push' , '--follow-tags' ] ) ;
76+ } ) ;
77+
78+ it ( 'calls lerna to publish packages for a real version' , function ( ) {
79+ const packages = [
80+ { name : 'packageA' , version : '0.7.0' } ,
81+ { name : 'mongosh' , version : '1.2.0' } ,
82+ ] ;
83+ listNpmPackages . returns ( packages ) ;
84+
3285 publishNpmPackages (
33- false ,
34- false ,
86+ { isDryRun : false , useAuxiliaryPackagesOnly : false } ,
3587 listNpmPackages ,
3688 markBumpedFilesAsAssumeUnchanged ,
3789 spawnSync
@@ -48,10 +100,7 @@ describe('npm-packages publishNpmPackages', function () {
48100 'from-package' ,
49101 '--no-private' ,
50102 '--no-changelog' ,
51- '--no-push' ,
52103 '--exact' ,
53- '--no-git-tag-version' ,
54- '--force-publish' ,
55104 '--yes' ,
56105 '--no-verify-access' ,
57106 ] ,
@@ -70,8 +119,7 @@ describe('npm-packages publishNpmPackages', function () {
70119
71120 try {
72121 publishNpmPackages (
73- false ,
74- false ,
122+ { isDryRun : false , useAuxiliaryPackagesOnly : false } ,
75123 listNpmPackages ,
76124 markBumpedFilesAsAssumeUnchanged ,
77125 spawnSync
0 commit comments