From b834f6950a904193a8740ead9620fd13a9b72109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kiner-tang=28=E6=96=87=E8=BE=89=29?= <1127031143@qq.com> Date: Sun, 15 Oct 2023 08:02:36 -0500 Subject: [PATCH] chore: site test opt (#45351) * chore: site test opt * Update scripts/check-site.ts Signed-off-by: lijianan <574980606@qq.com> * Update scripts/check-site.ts Signed-off-by: lijianan <574980606@qq.com> --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: lijianan <574980606@qq.com> --- scripts/check-site.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/check-site.ts b/scripts/check-site.ts index e69e3f277e..43196c0f79 100755 --- a/scripts/check-site.ts +++ b/scripts/check-site.ts @@ -3,7 +3,7 @@ import type http from 'http'; import type https from 'https'; import { join } from 'path'; -import cheerio from 'cheerio'; +import { load } from 'cheerio'; import { globSync } from 'glob'; import { createServer } from 'http-server'; import fetch from 'isomorphic-fetch'; @@ -20,9 +20,9 @@ describe('site test', () => { const port = 3000; const render = async (path: string) => { const resp = await fetch(`http://127.0.0.1:${port}${path}`).then(async (res) => { - const html = await res.text(); - const $ = cheerio.load(html, { decodeEntities: false, recognizeSelfClosing: true }); - return { html, status: res.status, $ }; + const html: string = await res.text(); + const $ = load(html, { decodeEntities: false, recognizeSelfClosing: true }); + return { status: res.status, $ }; }); return resp; };