@@ -12,6 +12,9 @@ function readRepoFile(relativePath) {
1212 return fs . readFileSync ( path . join ( repoRoot , relativePath ) , "utf8" ) ;
1313}
1414
15+ const packageJson = JSON . parse ( readRepoFile ( "package.json" ) ) ;
16+ const version = packageJson . version ;
17+
1518function firstScreen ( markdown ) {
1619 const lines = markdown . split ( / \r ? \n / ) ;
1720 const headingIndexes = [ ] ;
@@ -192,16 +195,16 @@ test("README advertises GitHub Releases and the public Node CI badge", () => {
192195 assert . ok ( readme . includes ( "brew install --cask fiveonecode/simulator-broker/simulator-broker" ) ) ;
193196 assert . ok ( readme . includes ( "homebrew-simulator-broker" ) ) ;
194197 assert . ok ( readme . includes ( "npm install -g" ) ) ;
195- assert . ok ( readme . includes ( " simbroker-0.1.0-alpha.1. tgz" ) ) ;
198+ assert . ok ( readme . includes ( ` simbroker-${ version } . tgz` ) ) ;
196199 assert . equal ( readme . includes ( "is not attached" ) , false ) ;
197200} ) ;
198201
199202test ( "CHANGELOG and package.json name the Alpha version" , ( ) => {
200203 const changelog = readRepoFile ( "CHANGELOG.md" ) ;
201- const packageJson = JSON . parse ( readRepoFile ( "package.json" ) ) ;
202204
203- assert . equal ( packageJson . version , "0.1.0-alpha.1" ) ;
204- assert . ok ( changelog . includes ( "## [0.1.0-alpha.1]" ) ) ;
205+ assert . equal ( packageJson . version , version ) ;
206+ assert . match ( version , / ^ 0 \. 1 \. 0 - a l p h a \. \d + $ / ) ;
207+ assert . ok ( changelog . includes ( `## [${ version } ]` ) ) ;
205208 assert . ok ( changelog . includes ( "scripts/package_cli.sh" ) ) ;
206209} ) ;
207210
@@ -251,7 +254,9 @@ test("issue forms cover install failure, bug, and feature and state Alpha limits
251254 assert . ok ( install . includes ( "install_local.sh --cli-only" ) ) ;
252255 assert . ok ( install . includes ( "brew install fiveonecode/simulator-broker/simbroker" ) ) ;
253256 assert . ok ( install . includes ( "npm install -g" ) ) ;
254- assert . ok ( install . includes ( "simbroker-0.1.0-alpha.1.tgz" ) ) ;
257+ assert . ok ( install . includes ( `simbroker-${ version } .tgz` ) ) ;
258+ assert . ok ( install . includes ( "brew install --cask fiveonecode/simulator-broker/simulator-broker" ) ) ;
259+ assert . equal ( install . includes ( "operator app zip is not attached" ) , false ) ;
255260 assert . ok ( bug . includes ( "labels:" ) ) ;
256261 assert . ok ( feature . includes ( "enhancement" ) ) ;
257262 for ( const body of [ install , bug , feature , config ] ) {
@@ -347,19 +352,20 @@ test("Homebrew formula points at the Alpha CLI tarball and the cask names a nota
347352 assert . ok ( url , "formula must have a url" ) ;
348353 assert . equal (
349354 url [ 1 ] ,
350- " https://github.com/fiveonecode/simulator-broker/releases/download/v0.1.0-alpha.1 /simulator-broker-0.1.0-alpha.1- cli.tar.gz" ,
355+ ` https://github.com/fiveonecode/simulator-broker/releases/download/v ${ version } /simulator-broker-${ version } - cli.tar.gz` ,
351356 ) ;
352357 assert . ok ( checksum , "formula must pin a sha256" ) ;
353- assert . equal ( checksum [ 1 ] , "699695bc65a5bcb25b9c9b5d01494fcc3f25a40dcc90b8b5bf1ec61ea87a8522" ) ;
358+ assert . match ( checksum [ 1 ] , / ^ [ a - f 0 - 9 ] { 64 } $ / ) ;
354359 assert . ok ( formula . includes ( 'shell_output("#{bin}/simbroker --help")' ) ) ;
355360 assert . equal ( formula . includes ( "package:local" ) , false ) ;
356361
357362 assert . ok ( cask . includes ( 'cask "simulator-broker"' ) ) ;
363+ assert . ok ( cask . includes ( `version "${ version } "` ) ) ;
358364 assert . ok ( cask . includes ( "releases/download/v#{version}/Simulator-Broker-#{version}.zip" ) ) ;
359365 assert . ok ( cask . includes ( 'app "Simulator Broker.app"' ) ) ;
360366 const caskChecksum = cask . match ( / s h a 2 5 6 " ( [ a - f 0 - 9 ] { 64 } ) " / ) ;
361367 assert . ok ( caskChecksum , "cask must pin a sha256" ) ;
362- assert . equal ( caskChecksum [ 1 ] , "5e19d128bf8061d5e18812c092e8a3b8e5f4514ff42bc233baa643fb0f075f70" ) ;
368+ assert . match ( caskChecksum [ 1 ] , / ^ [ a - f 0 - 9 ] { 64 } $ / ) ;
363369 assert . equal ( cask . includes ( "sha256 :no_check" ) , false ) ;
364370 assert . equal ( cask . includes ( "package:local" ) , false ) ;
365371 assert . equal ( cask . includes ( "package_local" ) , false ) ;
@@ -386,7 +392,7 @@ test("root package stays private and package_npm.sh packs a runnable simbroker b
386392 } ) ;
387393 assert . equal ( pack . status , 0 , pack . stderr + pack . stdout ) ;
388394
389- const tarball = path . join ( outputDir , " simbroker-0.1.0-alpha.1. tgz" ) ;
395+ const tarball = path . join ( outputDir , ` simbroker-${ version } . tgz` ) ;
390396 assert . equal ( fs . existsSync ( tarball ) , true , pack . stdout ) ;
391397
392398 const installDir = path . join ( outputDir , "prefix" ) ;
@@ -415,7 +421,7 @@ test("package_cli.sh writes a runnable CLI tarball without tests or the app", ()
415421 } ) ;
416422
417423 assert . equal ( result . status , 0 , result . stderr ) ;
418- const tarball = path . join ( outputDir , " simulator-broker-0.1.0-alpha.1- cli.tar.gz" ) ;
424+ const tarball = path . join ( outputDir , ` simulator-broker-${ version } - cli.tar.gz` ) ;
419425 const checksum = `${ tarball } .sha256` ;
420426 assert . equal ( fs . existsSync ( tarball ) , true , result . stdout ) ;
421427 assert . equal ( fs . existsSync ( checksum ) , true , result . stdout ) ;
@@ -425,7 +431,7 @@ test("package_cli.sh writes a runnable CLI tarball without tests or the app", ()
425431 const extract = spawnSync ( "tar" , [ "-xzf" , tarball , "-C" , extractDir ] , { encoding : "utf8" } ) ;
426432 assert . equal ( extract . status , 0 , extract . stderr ) ;
427433
428- const root = path . join ( extractDir , " simulator-broker-0.1.0-alpha.1- cli" ) ;
434+ const root = path . join ( extractDir , ` simulator-broker-${ version } - cli` ) ;
429435 const help = spawnSync ( path . join ( root , "bin/simbroker" ) , [ "--help" ] , { encoding : "utf8" } ) ;
430436 assert . equal ( help . status , 0 , help . stderr ) ;
431437 assert . ok ( help . stdout . includes ( "simbroker" ) || help . stderr . includes ( "simbroker" ) ) ;
0 commit comments