Skip to content

Commit e2ee5e6

Browse files
committed
test: adapt fail test
1 parent 3044a32 commit e2ee5e6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/fail.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
import {escape} from 'node:querystring';
22

3-
import test from 'ava';
4-
import {cleanAll} from 'nock';
5-
import {stub} from 'sinon';
6-
import proxyquire from 'proxyquire';
3+
import nock from 'nock';
4+
import quibble from "quibble"
75
import SemanticReleaseError from '@semantic-release/error';
6+
import sinon from 'sinon';
7+
import test from 'ava';
88

99
import {ISSUE_ID} from '../lib/definitions/constants.js';
1010
import {authenticate} from './helpers/mock-github.js';
11-
import rateLimit from './helpers/rate-limit.js';
11+
import * as RATE_LIMIT_MOCK from './helpers/rate-limit.js';
1212

1313
/* eslint camelcase: ["error", {properties: "never"}] */
1414

15-
const fail = proxyquire('../lib/fail', {
16-
'./get-client': proxyquire('../lib/get-client', {'./definitions/rate-limit': rateLimit}),
17-
});
15+
// mock rate limit imported via lib/get-client.js
16+
await quibble.esm('../lib/definitions/rate-limit.js', RATE_LIMIT_MOCK)
17+
const fail = (await import('../lib/fail.js')).default
1818

1919
test.beforeEach((t) => {
2020
// Mock logger
21-
t.context.log = stub();
22-
t.context.error = stub();
21+
t.context.log = sinon.stub();
22+
t.context.error = sinon.stub();
2323
t.context.logger = {log: t.context.log, error: t.context.error};
2424
});
2525

2626
test.afterEach.always(() => {
2727
// Clear nock
28-
cleanAll();
28+
nock.cleanAll();
2929
});
3030

3131
test.serial('Open a new issue with the list of errors', async (t) => {

0 commit comments

Comments
 (0)