File tree 2 files changed +11
-12
lines changed
2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change 2
2
skipIfApiStrict ,
3
3
startSharedTestServer ,
4
4
} from '../../../testing/integration-testing-hooks' ;
5
- import { TestShell } from './test-shell' ;
6
5
import { expect } from 'chai' ;
7
6
8
7
const setDifference = < T > ( a : T [ ] , b : T [ ] ) => a . filter ( ( e ) => ! b . includes ( e ) ) ;
@@ -57,7 +56,7 @@ describe('e2e snapshot support', function () {
57
56
] = (
58
57
await Promise . all (
59
58
argLists . map ( ( args ) =>
60
- TestShell . runAndGetOutputWithoutErrors ( { args } )
59
+ this . startTestShell ( { args } ) . waitForCleanOutput ( )
61
60
)
62
61
)
63
62
) . map ( ( output ) =>
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export class TestShell {
50
50
/**
51
51
* Starts a test shell.
52
52
*
53
- * Beware that the caller is responsible for calling {@link TestShell. kill} (and potentially {@link TestShell. waitForExit}).
53
+ * Beware that the caller is responsible for calling {@link kill} (and potentially {@link waitForExit}).
54
54
*
55
55
* Consider calling the `startTestShell` function on a {@link Mocha.Context} instead, as that manages the lifetime the shell
56
56
* and ensures it gets killed eventually.
@@ -108,15 +108,6 @@ export class TestShell {
108
108
return shell ;
109
109
}
110
110
111
- static async runAndGetOutputWithoutErrors (
112
- options : TestShellOptions
113
- ) : Promise < string > {
114
- const shell = this . start ( options ) ;
115
- await shell . waitForExit ( ) ;
116
- shell . assertNoErrors ( ) ;
117
- return shell . output ;
118
- }
119
-
120
111
debugInformation ( ) {
121
112
return {
122
113
pid : this . process . pid ,
@@ -232,6 +223,15 @@ export class TestShell {
232
223
return this . _onClose ;
233
224
}
234
225
226
+ /**
227
+ * Waits for the shell to exit, asserts no errors and returns the output.
228
+ */
229
+ async waitForCleanOutput ( ) : Promise < string > {
230
+ await this . waitForExit ( ) ;
231
+ this . assertNoErrors ( ) ;
232
+ return this . output ;
233
+ }
234
+
235
235
async waitForPromptOrExit ( ) : Promise < TestShellStartupResult > {
236
236
return Promise . race ( [
237
237
this . waitForPrompt ( ) . then ( ( ) => ( { state : 'prompt' } as const ) ) ,
You can’t perform that action at this time.
0 commit comments