|
1 | 1 | import {escape} from 'node:querystring';
|
2 | 2 |
|
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" |
7 | 5 | import SemanticReleaseError from '@semantic-release/error';
|
| 6 | +import sinon from 'sinon'; |
| 7 | +import test from 'ava'; |
8 | 8 |
|
9 | 9 | import {ISSUE_ID} from '../lib/definitions/constants.js';
|
10 | 10 | 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'; |
12 | 12 |
|
13 | 13 | /* eslint camelcase: ["error", {properties: "never"}] */
|
14 | 14 |
|
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 |
18 | 18 |
|
19 | 19 | test.beforeEach((t) => {
|
20 | 20 | // Mock logger
|
21 |
| - t.context.log = stub(); |
22 |
| - t.context.error = stub(); |
| 21 | + t.context.log = sinon.stub(); |
| 22 | + t.context.error = sinon.stub(); |
23 | 23 | t.context.logger = {log: t.context.log, error: t.context.error};
|
24 | 24 | });
|
25 | 25 |
|
26 | 26 | test.afterEach.always(() => {
|
27 | 27 | // Clear nock
|
28 |
| - cleanAll(); |
| 28 | + nock.cleanAll(); |
29 | 29 | });
|
30 | 30 |
|
31 | 31 | test.serial('Open a new issue with the list of errors', async (t) => {
|
|
0 commit comments