11import { escape } from 'node:querystring' ;
2- import { beforeEach , afterEach , serial } from 'ava' ;
2+
3+ import nock from 'nock' ;
34import { repeat } from 'lodash-es' ;
4- import { cleanAll } from 'nock ' ;
5- import { stub } from 'sinon ' ;
6- import proxyquire from 'proxyquire ' ;
5+ import sinon from 'sinon ' ;
6+ import test from 'ava ' ;
7+ import quibble from 'quibble ' ;
78
89import { ISSUE_ID } from '../lib/definitions/constants.js' ;
910import getReleaseLinks from '../lib/get-release-links.js' ;
1011import { authenticate } from './helpers/mock-github.js' ;
11- import rateLimit from './helpers/rate-limit.js' ;
12+ import * as RATE_LIMIT_MOCK from './helpers/rate-limit.js' ;
1213
1314/* eslint camelcase: ["error", {properties: "never"}] */
1415
15- const success = proxyquire ( '../ lib/success' , {
16- './get-client' : proxyquire ( '../lib/get-client' , { './ definitions/rate-limit' : rateLimit } ) ,
17- } ) ;
16+ // mock rate limit imported via lib/get-client.js
17+ await quibble . esm ( '../lib/definitions/rate-limit.js' , RATE_LIMIT_MOCK )
18+ const success = ( await import ( '../lib/success.js' ) ) . default
1819
1920test . beforeEach ( ( t ) => {
2021 // Mock logger
21- t . context . log = stub ( ) ;
22- t . context . error = stub ( ) ;
22+ t . context . log = sinon . stub ( ) ;
23+ t . context . error = sinon . stub ( ) ;
2324 t . context . logger = { log : t . context . log , error : t . context . error } ;
2425} ) ;
2526
2627test . afterEach . always ( ( ) => {
2728 // Clear nock
28- cleanAll ( ) ;
29+ nock . cleanAll ( ) ;
2930} ) ;
3031
3132test . serial (
@@ -701,6 +702,7 @@ test.serial('Editing the release to include all release links at the top', async
701702 { name : 'S3' , url : 's3://my-bucket/release-asset' } ,
702703 { name : 'Docker: docker.io/python:slim' } ,
703704 ] ;
705+
704706 const github = authenticate ( env )
705707 . get ( `/repos/${ owner } /${ repo } ` )
706708 . reply ( 200 , { full_name : `${ owner } /${ repo } ` } )
@@ -721,7 +723,7 @@ test.serial('Editing the release to include all release links at the top', async
721723 )
722724 . reply ( 200 , { items : [ ] } )
723725 . patch ( `/repos/${ owner } /${ repo } /releases/${ releaseId } ` , {
724- body : [ ... getReleaseLinks ( releases ) , '\n---\n' , nextRelease . notes ] ,
726+ body : getReleaseLinks ( releases ) + '\n---\n' + nextRelease . notes ,
725727 } )
726728 . reply ( 200 , { html_url : releaseUrl } ) ;
727729
@@ -985,7 +987,7 @@ test.serial('Ignore errors when adding comments and closing issues', async (t) =
985987 . patch ( `/repos/${ owner } /${ repo } /issues/3` , { state : 'closed' } )
986988 . reply ( 200 , { html_url : 'https://github.com/issues/3' } ) ;
987989
988- const [ error1 , error2 ] = await t . throwsAsync (
990+ const { errors : [ error1 , error2 ] } = await t . throwsAsync (
989991 success ( pluginConfig , {
990992 env,
991993 options,
0 commit comments