@@ -14,8 +14,8 @@ async function runReleaseCommand(args, options = {}) {
1414 ...options ,
1515 env : {
1616 ...options . env ,
17- MONGODB_COMPASS_RELEASE_MAX_WAIT_TIME : '0'
18- }
17+ MONGODB_COMPASS_RELEASE_MAX_WAIT_TIME : '0' ,
18+ } ,
1919 } ;
2020
2121 const proc = execa (
@@ -40,7 +40,7 @@ async function checkoutBranch(branchName, options) {
4040 }
4141}
4242
43- describe ( 'release' , function ( ) {
43+ describe ( 'release' , function ( ) {
4444 if ( ! ! process . env . EVERGREEN && process . platform === 'darwin' ) {
4545 // These tests are not working well on Evergreen macOS machines and we will
4646 // skip them for now (they will run in GitHub CI)
@@ -49,7 +49,7 @@ describe('release', function() {
4949 return ;
5050 }
5151
52- afterEach ( function ( ) {
52+ afterEach ( function ( ) {
5353 while ( running . length ) {
5454 running . shift ( ) . kill ( 'SIGTERM' , { forceKillAfterTimeout : 100 } ) ;
5555 }
@@ -59,7 +59,7 @@ describe('release', function() {
5959 let remote ;
6060 let repoPath ;
6161
62- beforeEach ( async function ( ) {
62+ beforeEach ( async function ( ) {
6363 tempDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'compass-release-tests-' ) ) ;
6464
6565 // create fake git remote:
@@ -89,7 +89,7 @@ describe('release', function() {
8989 } ) ;
9090
9191 // eslint-disable-next-line mocha/no-sibling-hooks
92- afterEach ( function ( ) {
92+ afterEach ( function ( ) {
9393 try {
9494 fs . removeSync ( tempDir ) ;
9595 } catch ( e ) {
@@ -98,134 +98,172 @@ describe('release', function() {
9898 }
9999 } ) ;
100100
101- it ( 'prints usage if no argument is passed' , async function ( ) {
102- const { stdout, failed } = await ( runReleaseCommand ( [ '' ] ) . catch ( e => e ) ) ;
101+ it ( 'prints usage if no argument is passed' , async function ( ) {
102+ const { stdout, failed } = await runReleaseCommand ( [ '' ] ) . catch ( ( e ) => e ) ;
103103 expect ( failed ) . to . be . true ;
104104 expect ( stdout ) . to . contain ( 'USAGE' ) ;
105105 } ) ;
106106
107- describe ( 'checkout' , function ( ) {
108- it ( 'creates a new branch if not exists' , async function ( ) {
107+ describe ( 'checkout' , function ( ) {
108+ it ( 'creates a new branch if not exists' , async function ( ) {
109109 await runReleaseCommand ( [ 'checkout' , '1.12' ] ) ;
110- const { stdout } = await execa ( 'git' , [ 'rev-parse' , '--abbrev-ref' , 'HEAD' ] ) ;
110+ const { stdout } = await execa ( 'git' , [
111+ 'rev-parse' ,
112+ '--abbrev-ref' ,
113+ 'HEAD' ,
114+ ] ) ;
111115 expect ( stdout ) . to . equal ( '1.12-releases' ) ;
112116 } ) ;
113117
114- it ( 'checks out an existing branch' , async function ( ) {
118+ it ( 'checks out an existing branch' , async function ( ) {
115119 await checkoutBranch ( '1.12-releases' ) ;
116120 await checkoutBranch ( MAIN_BRANCH ) ;
117121 await runReleaseCommand ( [ 'checkout' , '1.12' ] ) ;
118- const { stdout } = await execa ( 'git' , [ 'rev-parse' , '--abbrev-ref' , 'HEAD' ] ) ;
122+ const { stdout } = await execa ( 'git' , [
123+ 'rev-parse' ,
124+ '--abbrev-ref' ,
125+ 'HEAD' ,
126+ ] ) ;
119127 expect ( stdout ) . to . equal ( '1.12-releases' ) ;
120128 } ) ;
121129
122- it ( 'prints usage if no version is passed' , async function ( ) {
123- const { stdout, failed } = await ( runReleaseCommand ( [ 'checkout' ] ) . catch ( e => e ) ) ;
130+ it ( 'prints usage if no version is passed' , async function ( ) {
131+ const { stdout, failed } = await runReleaseCommand ( [ 'checkout' ] ) . catch (
132+ ( e ) => e
133+ ) ;
124134 expect ( failed ) . to . be . true ;
125135 expect ( stdout ) . to . contain ( 'USAGE' ) ;
126136 } ) ;
127137
128- it ( `fails if branch is not ${ MAIN_BRANCH } ` , async function ( ) {
138+ it ( `fails if branch is not ${ MAIN_BRANCH } ` , async function ( ) {
129139 await checkoutBranch ( 'some-branch' ) ;
130- const { stderr, failed } = await ( runReleaseCommand ( [ 'checkout' , '1.12' ] ) . catch ( e => e ) ) ;
140+ const { stderr, failed } = await runReleaseCommand ( [
141+ 'checkout' ,
142+ '1.12' ,
143+ ] ) . catch ( ( e ) => e ) ;
131144 expect ( failed ) . to . be . true ;
132- expect ( stderr ) . to . contain ( `The current branch is not the ${ MAIN_BRANCH } branch` ) ;
145+ expect ( stderr ) . to . contain (
146+ `The current branch is not the ${ MAIN_BRANCH } branch`
147+ ) ;
133148 } ) ;
134149 } ) ;
135150
136151 [
137152 [ 'beta' , '1.12.0-beta.0' ] ,
138- [ 'ga' , '1.12.0' ]
139- ] . forEach ( ( [ command , expectedVersion ] ) => {
140- describe ( command , function ( ) {
141- it ( `fails from ${ MAIN_BRANCH } ` , async function ( ) {
153+ [ 'ga' , '1.12.0' ] ,
154+ ] . forEach ( ( [ command , expectedVersion ] ) => {
155+ describe ( command , function ( ) {
156+ it ( `fails from ${ MAIN_BRANCH } ` , async function ( ) {
142157 await checkoutBranch ( MAIN_BRANCH ) ;
143- const { stderr, failed } = await ( runReleaseCommand ( [ command ] ) . catch ( e => e ) ) ;
158+ const { stderr, failed } = await runReleaseCommand ( [ command ] ) . catch (
159+ ( e ) => e
160+ ) ;
144161 expect ( failed ) . to . be . true ;
145- expect ( stderr ) . to . contain ( `The current branch (${ MAIN_BRANCH } ) is not a release branch` ) ;
162+ expect ( stderr ) . to . contain (
163+ `The current branch (${ MAIN_BRANCH } ) is not a release branch`
164+ ) ;
146165 } ) ;
147166
148- it ( 'fails if branch is not a release branch' , async function ( ) {
167+ it ( 'fails if branch is not a release branch' , async function ( ) {
149168 await checkoutBranch ( 'some-branch' ) ;
150- const { stderr, failed } = await ( runReleaseCommand ( [ command ] ) . catch ( e => e ) ) ;
169+ const { stderr, failed } = await runReleaseCommand ( [ command ] ) . catch (
170+ ( e ) => e
171+ ) ;
151172 expect ( failed ) . to . be . true ;
152- expect ( stderr ) . to . contain ( 'The current branch (some-branch) is not a release branch' ) ;
173+ expect ( stderr ) . to . contain (
174+ 'The current branch (some-branch) is not a release branch'
175+ ) ;
153176 } ) ;
154177
155- it ( 'fails with untracked files' , async function ( ) {
178+ it ( 'fails with untracked files' , async function ( ) {
156179 fs . writeFileSync ( 'README.md' , '' ) ;
157180 await checkoutBranch ( '1.12-releases' ) ;
158- const { stderr, failed } = await ( runReleaseCommand ( [ command ] ) . catch ( e => e ) ) ;
181+ const { stderr, failed } = await runReleaseCommand ( [ command ] ) . catch (
182+ ( e ) => e
183+ ) ;
159184 expect ( failed ) . to . be . true ;
160185 expect ( stderr ) . to . contain ( 'You have untracked or staged changes' ) ;
161186 } ) ;
162187
163- it ( 'fails with staged files' , async function ( ) {
188+ it ( 'fails with staged files' , async function ( ) {
164189 fs . writeFileSync ( 'README.md' , '' ) ;
165190 await checkoutBranch ( '1.12-releases' ) ;
166191 await execa ( 'git' , [ 'add' , '.' ] ) ;
167- const { stderr, failed } = await ( runReleaseCommand ( [ command ] ) . catch ( e => e ) ) ;
192+ const { stderr, failed } = await runReleaseCommand ( [ command ] ) . catch (
193+ ( e ) => e
194+ ) ;
168195 expect ( failed ) . to . be . true ;
169196 expect ( stderr ) . to . contain ( 'You have untracked or staged changes' ) ;
170197 } ) ;
171198
172- it ( 'works with committed files' , async function ( ) {
199+ it ( 'works with committed files' , async function ( ) {
173200 fs . writeFileSync ( 'README.md' , '' ) ;
174201 await checkoutBranch ( '1.12-releases' ) ;
175202 await execa ( 'git' , [ 'add' , '.' ] ) ;
176203 await execa ( 'git' , [ 'commit' , '-am' , 'test' ] ) ;
177- await runReleaseCommand ( [ command ] , { input : 'N\n' } ) ;
204+ await runReleaseCommand ( [ command ] , { input : 'N\n' } ) ;
178205 } ) ;
179206
180- it ( 'asks for confirmation and skips if not confirmed' , async function ( ) {
181- expect ( readPackageJsonVersion (
182- path . resolve ( repoPath , './package.json' )
183- ) ) . to . equal ( '1.0.0' ) ;
207+ it ( 'asks for confirmation and skips if not confirmed' , async function ( ) {
208+ expect (
209+ readPackageJsonVersion ( path . resolve ( repoPath , './package.json' ) )
210+ ) . to . equal ( '1.0.0' ) ;
184211
185212 await checkoutBranch ( '1.12-releases' ) ;
186213 const { stderr } = await runReleaseCommand ( [ command ] , {
187- input : 'N\n'
214+ input : 'N\n' ,
188215 } ) ;
189216
190217 expect ( stderr ) . to . contain (
191- `Are you sure you want to bump from 1.0.0 to ${ expectedVersion } and release?` ) ;
218+ `Are you sure you want to bump from 1.0.0 to ${ expectedVersion } and release?`
219+ ) ;
192220
193- expect ( readPackageJsonVersion (
194- path . resolve ( repoPath , './package.json' )
195- ) ) . to . equal ( '1.0.0' ) ;
221+ expect (
222+ readPackageJsonVersion ( path . resolve ( repoPath , './package.json' ) )
223+ ) . to . equal ( '1.0.0' ) ;
196224 } ) ;
197225
198- describe ( 'from a release branch' , function ( ) {
226+ describe ( 'from a release branch' , function ( ) {
199227 let clonePath ;
200228
201- beforeEach ( async function ( ) {
229+ beforeEach ( async function ( ) {
202230 await checkoutBranch ( '1.12-releases' ) ;
203231 await runReleaseCommand ( [ command ] , {
204232 input : 'Y\n' ,
205233 stdout : 'inherit' ,
206- stderr : 'inherit'
234+ stderr : 'inherit' ,
207235 } ) ;
208236
209237 clonePath = path . resolve ( tempDir , command ) ;
210- await execa ( 'git' , [ 'clone' , '--branch' , MAIN_BRANCH , remote , clonePath ] ) ;
238+ await execa ( 'git' , [
239+ 'clone' ,
240+ '--branch' ,
241+ MAIN_BRANCH ,
242+ remote ,
243+ clonePath ,
244+ ] ) ;
211245 } ) ;
212246
213- it ( `does not affect ${ MAIN_BRANCH } ` , function ( ) {
214- const version = readPackageJsonVersion ( path . resolve ( clonePath , 'package.json' ) ) ;
247+ it ( `does not affect ${ MAIN_BRANCH } ` , function ( ) {
248+ const version = readPackageJsonVersion (
249+ path . resolve ( clonePath , 'package.json' )
250+ ) ;
215251 expect ( version ) . to . equal ( '1.0.0' ) ;
216252 } ) ;
217253
218- it ( 'bumps the package version' , async function ( ) {
219- await checkoutBranch ( '1.12-releases' , { cwd : clonePath } ) ;
220- const version = readPackageJsonVersion ( path . resolve ( clonePath , 'package.json' ) ) ;
254+ it ( 'bumps the package version' , async function ( ) {
255+ await checkoutBranch ( '1.12-releases' , { cwd : clonePath } ) ;
256+ const version = readPackageJsonVersion (
257+ path . resolve ( clonePath , 'package.json' )
258+ ) ;
221259 expect ( version ) . to . equal ( expectedVersion ) ;
222260 } ) ;
223261
224- it ( 'pushes tags' , async function ( ) {
225- await checkoutBranch ( '1.12-releases' , { cwd : clonePath } ) ;
262+ it ( 'pushes tags' , async function ( ) {
263+ await checkoutBranch ( '1.12-releases' , { cwd : clonePath } ) ;
226264 await execa ( 'git' , [ 'fetch' , '--all' , '--tags' ] ) ;
227265
228- const { stdout } = await execa ( 'git' , [ 'tag' ] , { cwd : clonePath } ) ;
266+ const { stdout } = await execa ( 'git' , [ 'tag' ] , { cwd : clonePath } ) ;
229267 expect ( stdout . split ( '\n' ) ) . to . deep . equal ( [ `v${ expectedVersion } ` ] ) ;
230268 } ) ;
231269 } ) ;
0 commit comments