1
1
import * as assert from 'assert'
2
- import * as utils from '../support/utils'
2
+ import * as utils from '../../../shared/ support/utils'
3
3
import { randomBytes } from 'crypto'
4
- import { BundleServerWorld , User } from '../support/world'
4
+ import { EndToEndBundleServerWorld , User } from '../support/world'
5
5
import { Given , When , Then } from '@cucumber/cucumber'
6
6
7
7
/**
@@ -10,7 +10,7 @@ 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 : EndToEndBundleServerWorld , commitNum : number , branch : string ) {
14
14
const clonedRepo = this . getRepoAtBranch ( User . Another , branch )
15
15
16
16
for ( let i = 0 ; i < commitNum ; i ++ ) {
@@ -22,7 +22,7 @@ Given('another user pushed {int} commits to {string}', async function (this: Bun
22
22
} )
23
23
24
24
Given ( 'another user removed {int} commits and added {int} commits to {string}' ,
25
- async function ( this : BundleServerWorld , removeCommits : number , addCommits : number , branch : string ) {
25
+ async function ( this : EndToEndBundleServerWorld , removeCommits : number , addCommits : number , branch : string ) {
26
26
const clonedRepo = this . getRepoAtBranch ( User . Another , branch )
27
27
28
28
// First, reset
@@ -40,33 +40,33 @@ Given('another user removed {int} commits and added {int} commits to {string}',
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 : EndToEndBundleServerWorld ) {
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 : EndToEndBundleServerWorld ) {
50
50
this . cloneRepositoryFor ( User . Me , this . bundleServer . bundleUri ( ) )
51
51
} )
52
52
53
- When ( 'another developer clones from the remote repo without a bundle URI' , async function ( this : BundleServerWorld ) {
53
+ When ( 'another developer clones from the remote repo without a bundle URI' , async function ( this : EndToEndBundleServerWorld ) {
54
54
this . cloneRepositoryFor ( User . Another )
55
55
} )
56
56
57
- When ( 'I fetch from the remote' , async function ( this : BundleServerWorld ) {
57
+ When ( 'I fetch from the remote' , async function ( this : EndToEndBundleServerWorld ) {
58
58
const clonedRepo = this . getRepo ( User . Me )
59
59
utils . assertStatus ( 0 , clonedRepo . runGit ( "fetch" , "origin" ) )
60
60
} )
61
61
62
- Then ( 'bundles are downloaded and used' , async function ( this : BundleServerWorld ) {
62
+ Then ( 'bundles are downloaded and used' , async function ( this : EndToEndBundleServerWorld ) {
63
63
const clonedRepo = this . getRepo ( User . Me )
64
64
65
65
// Verify the clone executed as-expected
66
66
utils . assertStatus ( 0 , clonedRepo . cloneResult , "git clone failed" )
67
67
68
68
// Ensure warning wasn't thrown
69
- clonedRepo . cloneResult . stderr . toString ( ) . split ( "\n" ) . forEach ( function ( line ) {
69
+ clonedRepo . cloneResult . stderr . toString ( ) . split ( "\n" ) . forEach ( function ( line : string ) {
70
70
if ( line . startsWith ( "warning: failed to download bundle from URI" ) ) {
71
71
assert . fail ( line )
72
72
}
@@ -81,13 +81,13 @@ Then('bundles are downloaded and used', async function (this: BundleServerWorld)
81
81
result = clonedRepo . runGit ( "for-each-ref" , "--format=%(refname)" , "refs/bundles/*" )
82
82
utils . assertStatus ( 0 , result , "git for-each-ref failed" )
83
83
84
- const bundleRefs = result . stdout . toString ( ) . split ( "\n" ) . filter ( function ( line ) {
84
+ const bundleRefs = result . stdout . toString ( ) . split ( "\n" ) . filter ( function ( line : string ) {
85
85
return line . trim ( ) != ""
86
86
} )
87
87
assert . strict ( bundleRefs . length > 0 , "No bundle refs found in the repo" )
88
88
} )
89
89
90
- Then ( 'I am up-to-date with {string}' , async function ( this : BundleServerWorld , branch : string ) {
90
+ Then ( 'I am up-to-date with {string}' , async function ( this : EndToEndBundleServerWorld , branch : string ) {
91
91
const clonedRepo = this . getRepo ( User . Me )
92
92
const result = clonedRepo . runGit ( "rev-parse" , `refs/remotes/origin/${ branch } ` )
93
93
utils . assertStatus ( 0 , result )
@@ -97,7 +97,7 @@ Then('I am up-to-date with {string}', async function (this: BundleServerWorld, b
97
97
} )
98
98
99
99
Then ( 'my repo\'s bundles {boolean} up-to-date with {string}' ,
100
- async function ( this : BundleServerWorld , expectedUpToDate : boolean , branch : string ) {
100
+ async function ( this : EndToEndBundleServerWorld , expectedUpToDate : boolean , branch : string ) {
101
101
const clonedRepo = this . getRepo ( User . Me )
102
102
const result = clonedRepo . runGit ( "rev-parse" , `refs/bundles/${ branch } ` )
103
103
utils . assertStatus ( 0 , result )
@@ -112,7 +112,7 @@ Then('my repo\'s bundles {boolean} up-to-date with {string}',
112
112
}
113
113
)
114
114
115
- Then ( 'I compare the clone execution times' , async function ( this : BundleServerWorld ) {
115
+ Then ( 'I compare the clone execution times' , async function ( this : EndToEndBundleServerWorld ) {
116
116
const myClone = this . getRepo ( User . Me )
117
117
const otherClone = this . getRepo ( User . Another )
118
118
0 commit comments