File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ async function retryingGot(url, args) {
3131 )
3232}
3333
34- export function report ( error , metadata ) {
34+ export async function report ( error , metadata ) {
3535 // If there's no HAYSTACK_URL set, bail early
3636 if ( ! process . env . HAYSTACK_URL ) return
3737
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ describe('FailBot', () => {
55 const requestBodiesSent = [ ]
66
77 beforeEach ( ( ) => {
8+ delete process . env . HAYSTACK_URL
9+
10+ // Always reset the array to an empty one between tests
11+ // so it doesn't intefere across tests.
12+ requestBodiesSent . length = 0
13+
814 nock ( 'https://haystack.example.com' )
915 . post ( '/' )
1016 . reply ( 200 , ( uri , requestBody ) => {
@@ -15,15 +21,13 @@ describe('FailBot', () => {
1521
1622 afterEach ( ( ) => {
1723 delete process . env . HAYSTACK_URL
18- // Reset the array to an empty one between tests
19- // so it doesn't intefere across tests.
20- requestBodiesSent . length = 0
2124 } )
2225
2326 describe ( '.report' , ( ) => {
2427 it ( 'returns early if `HAYSTACK_URL` is not set' , async ( ) => {
2528 const result = await FailBot . report ( )
2629 expect ( result ) . toBeUndefined ( )
30+ expect ( requestBodiesSent . length ) . toBe ( 0 )
2731 } )
2832
2933 it ( 'sends the expected report' , async ( ) => {
You can’t perform that action at this time.
0 commit comments