@@ -82,9 +82,9 @@ describe("CLI", () => {
82
82
test . skipIf ( ci ?. skipIf ) (
83
83
testName ,
84
84
async ( ) => {
85
- const { stdout } = await execa ( cmd , given , { cwd } ) ;
85
+ const { stdout } = await execa ( cmd , given , { cwd, stripFinalNewline : false } ) ;
86
86
if ( want instanceof URL ) {
87
- expect ( stdout ) . toMatchFileSnapshot ( fileURLToPath ( want ) ) ;
87
+ await expect ( stdout ) . toMatchFileSnapshot ( fileURLToPath ( want ) ) ;
88
88
} else {
89
89
expect ( stdout ) . toBe ( `${ want } \n` ) ;
90
90
}
@@ -97,8 +97,8 @@ describe("CLI", () => {
97
97
"stdin" ,
98
98
async ( ) => {
99
99
const input = fs . readFileSync ( new URL ( "./examples/stripe-api.yaml" , root ) ) ;
100
- const { stdout } = await execa ( cmd , { input, cwd } ) ;
101
- expect ( stdout ) . toMatchFileSnapshot ( fileURLToPath ( new URL ( "./examples/stripe-api.ts" , root ) ) ) ;
100
+ const { stdout } = await execa ( cmd , { input, cwd, stripFinalNewline : false } ) ;
101
+ await expect ( stdout ) . toMatchFileSnapshot ( fileURLToPath ( new URL ( "./examples/stripe-api.ts" , root ) ) ) ;
102
102
} ,
103
103
TIMEOUT ,
104
104
) ;
@@ -119,8 +119,9 @@ describe("CLI", () => {
119
119
async ( ) => {
120
120
const { stdout } = await execa ( cmd , [ "--properties-required-by-default=true" , "./examples/github-api.yaml" ] , {
121
121
cwd,
122
+ stripFinalNewline : false ,
122
123
} ) ;
123
- expect ( stdout ) . toMatchFileSnapshot ( fileURLToPath ( new URL ( "./examples/github-api-required.ts" , root ) ) ) ;
124
+ await expect ( stdout ) . toMatchFileSnapshot ( fileURLToPath ( new URL ( "./examples/github-api-required.ts" , root ) ) ) ;
124
125
} ,
125
126
TIMEOUT ,
126
127
) ;
@@ -134,7 +135,7 @@ describe("CLI", () => {
134
135
cwd : fileURLToPath ( cwd ) ,
135
136
} ) ;
136
137
for ( const schema of [ "a" , "b" , "c" ] ) {
137
- expect ( fs . readFileSync ( new URL ( `./output/${ schema } .ts` , cwd ) , "utf8" ) ) . toMatchFileSnapshot (
138
+ await expect ( fs . readFileSync ( new URL ( `./output/${ schema } .ts` , cwd ) , "utf8" ) ) . toMatchFileSnapshot (
138
139
fileURLToPath ( new URL ( "../../../examples/simple-example.ts" , cwd ) ) ,
139
140
) ;
140
141
}
@@ -145,7 +146,7 @@ describe("CLI", () => {
145
146
cwd,
146
147
} ) ;
147
148
for ( const schema of [ "a" , "b" , "c" ] ) {
148
- expect (
149
+ await expect (
149
150
fs . readFileSync ( new URL ( `./test/fixtures/redocly-flag/output/${ schema } .ts` , root ) , "utf8" ) ,
150
151
) . toMatchFileSnapshot ( fileURLToPath ( new URL ( "./examples/simple-example.ts" , root ) ) ) ;
151
152
}
0 commit comments