File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { TextDecoder } from "node:util";
22import path from "path" ;
33
44import * as github from "@actions/github" ;
5- import { TestFn } from "ava" ;
5+ import { ExecutionContext , TestFn } from "ava" ;
66import nock from "nock" ;
77import * as sinon from "sinon" ;
88
@@ -180,6 +180,23 @@ export function getRecordingLogger(messages: LoggedMessage[]): Logger {
180180 } ;
181181}
182182
183+ export function checkExpectedLogMessages (
184+ t : ExecutionContext < any > ,
185+ messages : LoggedMessage [ ] ,
186+ expectedMessages : string [ ] ,
187+ ) {
188+ for ( const expectedMessage of expectedMessages ) {
189+ t . assert (
190+ messages . some (
191+ ( msg ) =>
192+ typeof msg . message === "string" &&
193+ msg . message . includes ( expectedMessage ) ,
194+ ) ,
195+ `Expected '${ expectedMessage } ' in the logger output, but didn't find it in:\n ${ messages . map ( ( m ) => ` - '${ m . message } '` ) . join ( "\n" ) } ` ,
196+ ) ;
197+ }
198+ }
199+
183200/** Mock the HTTP request to the feature flags enablement API endpoint. */
184201export function mockFeatureFlagApiEndpoint (
185202 responseStatusCode : number ,
You can’t perform that action at this time.
0 commit comments