@@ -10,19 +10,19 @@ import { Given, When, Then } from '@cucumber/cucumber'
10
10
* test steps will live here.
11
11
*/
12
12
13
- Given ( 'another user pushed {int} commits to {string}' , async function ( this : BundleServerWorld , commitNum : number , branch : string ) {
13
+ Given ( 'another user pushed {int} commits to {string}' , async function ( this : BundleServerWorld , commitNum : number , branch : string ) {
14
14
const clonedRepo = this . getRepoAtBranch ( User . Another , branch )
15
15
16
16
for ( let i = 0 ; i < commitNum ; i ++ ) {
17
17
utils . assertStatus ( 0 , clonedRepo . runShell ( `echo ${ randomBytes ( 16 ) . toString ( 'hex' ) } >README.md` ) )
18
18
utils . assertStatus ( 0 , clonedRepo . runGit ( "add" , "README.md" ) )
19
- utils . assertStatus ( 0 , clonedRepo . runGit ( "commit" , "-m" , `test ${ i + 1 } ` ) )
19
+ utils . assertStatus ( 0 , clonedRepo . runGit ( "commit" , "-m" , `test ${ i + 1 } ` ) )
20
20
}
21
21
utils . assertStatus ( 0 , clonedRepo . runGit ( "push" , "origin" , branch ) )
22
22
} )
23
23
24
24
Given ( 'another developer removed {int} commits and added {int} commits to {string}' ,
25
- async function ( this : BundleServerWorld , removeCommits : number , addCommits : number , branch : string ) {
25
+ async function ( this : BundleServerWorld , removeCommits : number , addCommits : number , branch : string ) {
26
26
const clonedRepo = this . getRepoAtBranch ( User . Another , branch )
27
27
28
28
// First, reset
@@ -32,37 +32,37 @@ Given('another developer removed {int} commits and added {int} commits to {strin
32
32
for ( let i = 0 ; i < addCommits ; i ++ ) {
33
33
utils . assertStatus ( 0 , clonedRepo . runShell ( `echo ${ randomBytes ( 16 ) . toString ( 'hex' ) } >README.md` ) )
34
34
utils . assertStatus ( 0 , clonedRepo . runGit ( "add" , "README.md" ) )
35
- utils . assertStatus ( 0 , clonedRepo . runGit ( "commit" , "-m" , `test ${ i + 1 } ` ) )
35
+ utils . assertStatus ( 0 , clonedRepo . runGit ( "commit" , "-m" , `test ${ i + 1 } ` ) )
36
36
}
37
37
38
38
// Finally, force push
39
39
utils . assertStatus ( 0 , clonedRepo . runGit ( "push" , "-f" , "origin" , branch ) )
40
40
}
41
41
)
42
42
43
- Given ( 'I cloned from the remote repo with a bundle URI' , async function ( this : BundleServerWorld ) {
43
+ Given ( 'I cloned from the remote repo with a bundle URI' , async function ( this : BundleServerWorld ) {
44
44
const user = User . Me
45
45
this . cloneRepositoryFor ( user , this . bundleServer . bundleUri ( ) )
46
46
utils . assertStatus ( 0 , this . getRepo ( user ) . cloneResult )
47
47
} )
48
48
49
- When ( 'I clone from the remote repo with a bundle URI' , async function ( this : BundleServerWorld ) {
49
+ When ( 'I clone from the remote repo with a bundle URI' , async function ( this : BundleServerWorld ) {
50
50
this . cloneRepositoryFor ( User . Me , this . bundleServer . bundleUri ( ) )
51
51
} )
52
52
53
- When ( 'I fetch from the remote' , async function ( this : BundleServerWorld ) {
53
+ When ( 'I fetch from the remote' , async function ( this : BundleServerWorld ) {
54
54
const clonedRepo = this . getRepo ( User . Me )
55
55
utils . assertStatus ( 0 , clonedRepo . runGit ( "fetch" , "origin" ) )
56
56
} )
57
57
58
- Then ( 'bundles are downloaded and used' , async function ( this : BundleServerWorld ) {
58
+ Then ( 'bundles are downloaded and used' , async function ( this : BundleServerWorld ) {
59
59
const clonedRepo = this . getRepo ( User . Me )
60
60
61
61
// Verify the clone executed as-expected
62
62
utils . assertStatus ( 0 , clonedRepo . cloneResult , "git clone failed" )
63
63
64
64
// Ensure warning wasn't thrown
65
- clonedRepo . cloneResult . stderr . toString ( ) . split ( "\n" ) . forEach ( function ( line ) {
65
+ clonedRepo . cloneResult . stderr . toString ( ) . split ( "\n" ) . forEach ( function ( line ) {
66
66
if ( line . startsWith ( "warning: failed to download bundle from URI" ) ) {
67
67
assert . fail ( line )
68
68
}
@@ -78,13 +78,13 @@ Then('bundles are downloaded and used', async function(this: BundleServerWorld)
78
78
assert . strictEqual ( result . status , 0 , "git for-each-ref failed" )
79
79
80
80
const bundleRefRegex = new RegExp ( '^refs/bundles/.*$' )
81
- const bundleRefs = result . stdout . toString ( ) . split ( "\n" ) . filter ( function ( line ) {
81
+ const bundleRefs = result . stdout . toString ( ) . split ( "\n" ) . filter ( function ( line ) {
82
82
return bundleRefRegex . test ( line )
83
83
} )
84
84
assert . strict ( bundleRefs . length > 0 , "No bundle refs found in the repo" )
85
85
} )
86
86
87
- Then ( 'I am up-to-date with {string}' , async function ( this : BundleServerWorld , branch : string ) {
87
+ Then ( 'I am up-to-date with {string}' , async function ( this : BundleServerWorld , branch : string ) {
88
88
const clonedRepo = this . getRepo ( User . Me )
89
89
const result = clonedRepo . runGit ( "rev-parse" , `refs/remotes/origin/${ branch } ` )
90
90
utils . assertStatus ( 0 , result )
@@ -94,7 +94,7 @@ Then('I am up-to-date with {string}', async function(this: BundleServerWorld, br
94
94
} )
95
95
96
96
Then ( 'my repo\'s bundles {boolean} up-to-date with {string}' ,
97
- async function ( this : BundleServerWorld , expectedUpToDate : boolean , branch : string ) {
97
+ async function ( this : BundleServerWorld , expectedUpToDate : boolean , branch : string ) {
98
98
const clonedRepo = this . getRepo ( User . Me )
99
99
const result = clonedRepo . runGit ( "rev-parse" , `refs/bundles/${ branch } ` )
100
100
utils . assertStatus ( 0 , result )
0 commit comments