[ci] format
This commit is contained in:
parent
cfd895d877
commit
c4c616c0a5
2 changed files with 26 additions and 27 deletions
|
@ -1,17 +1,17 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
|
|
||||||
for (const caseNumber of [ 1, 2, 3, 4 ]) {
|
for (const caseNumber of [1, 2, 3, 4]) {
|
||||||
describe(`Custom 404 with implicit rerouting - Case #${caseNumber}`, () => {
|
describe(`Custom 404 with implicit rerouting - Case #${caseNumber}`, () => {
|
||||||
/** @type Awaited<ReturnType<typeof loadFixture>> */
|
/** @type Awaited<ReturnType<typeof loadFixture>> */
|
||||||
let fixture;
|
let fixture;
|
||||||
/** @type Awaited<ReturnType<typeof fixture['startDevServer']>> */
|
/** @type Awaited<ReturnType<typeof fixture['startDevServer']>> */
|
||||||
let devServer
|
let devServer;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: `./fixtures/custom-404-loop-case-${caseNumber}/`,
|
root: `./fixtures/custom-404-loop-case-${caseNumber}/`,
|
||||||
site: 'http://example.com'
|
site: 'http://example.com',
|
||||||
});
|
});
|
||||||
|
|
||||||
devServer = await fixture.startDevServer();
|
devServer = await fixture.startDevServer();
|
||||||
|
@ -38,10 +38,9 @@ for (const caseNumber of [ 1, 2, 3, 4 ]) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***** UTILITY FUNCTIONS *****/
|
/***** UTILITY FUNCTIONS *****/
|
||||||
|
|
||||||
const timeout = Symbol("timeout")
|
const timeout = Symbol('timeout');
|
||||||
|
|
||||||
/** @template Res */
|
/** @template Res */
|
||||||
function withTimeout(
|
function withTimeout(
|
||||||
|
@ -51,7 +50,7 @@ function withTimeout(
|
||||||
timeLimit
|
timeLimit
|
||||||
) {
|
) {
|
||||||
/** @type Promise<typeof timeout> */
|
/** @type Promise<typeof timeout> */
|
||||||
const timeoutPromise = new Promise(resolve => setTimeout(() => resolve(timeout), timeLimit))
|
const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(timeout), timeLimit));
|
||||||
|
|
||||||
return Promise.race([ responsePromise, timeoutPromise ]);
|
return Promise.race([responsePromise, timeoutPromise]);
|
||||||
}
|
}
|
Loading…
Reference in a new issue