File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ async function retryingGot(url, args) {
31
31
)
32
32
}
33
33
34
- export function report ( error , metadata ) {
34
+ export async function report ( error , metadata ) {
35
35
// If there's no HAYSTACK_URL set, bail early
36
36
if ( ! process . env . HAYSTACK_URL ) return
37
37
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ describe('FailBot', () => {
5
5
const requestBodiesSent = [ ]
6
6
7
7
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
+
8
14
nock ( 'https://haystack.example.com' )
9
15
. post ( '/' )
10
16
. reply ( 200 , ( uri , requestBody ) => {
@@ -15,15 +21,13 @@ describe('FailBot', () => {
15
21
16
22
afterEach ( ( ) => {
17
23
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
21
24
} )
22
25
23
26
describe ( '.report' , ( ) => {
24
27
it ( 'returns early if `HAYSTACK_URL` is not set' , async ( ) => {
25
28
const result = await FailBot . report ( )
26
29
expect ( result ) . toBeUndefined ( )
30
+ expect ( requestBodiesSent . length ) . toBe ( 0 )
27
31
} )
28
32
29
33
it ( 'sends the expected report' , async ( ) => {
You can’t perform that action at this time.
0 commit comments