mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
chore: migrate api-net-session-spec.ts to vitest
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { net, session, BrowserWindow, ClientRequestConstructorOptions } from 'electron/main';
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { afterEach, beforeEach, describe, it } from 'vitest';
|
||||
|
||||
import * as dns from 'node:dns';
|
||||
|
||||
@@ -14,14 +15,12 @@ describe('net module (session)', () => {
|
||||
beforeEach(() => {
|
||||
respondNTimes.routeFailure = false;
|
||||
});
|
||||
afterEach(async function () {
|
||||
afterEach(async (ctx) => {
|
||||
await session.defaultSession.clearCache();
|
||||
if (respondNTimes.routeFailure && this.test) {
|
||||
if (!this.test.isFailed()) {
|
||||
throw new Error(
|
||||
'Failing this test due an unhandled error in the respondOnce route handler, check the logs above for the actual error'
|
||||
);
|
||||
}
|
||||
if (respondNTimes.routeFailure && ctx.task.result?.state !== 'fail') {
|
||||
throw new Error(
|
||||
'Failing this test due an unhandled error in the respondOnce route handler, check the logs above for the actual error'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user