Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yandeu committed Jul 21, 2023
1 parent 624a94b commit a17ee03
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/browserTest/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ERROR_CODES = {
let hasError = false

const server = createServer(requestListener({ serve, collectCoverage }))
server.closeAsync = () => new Promise(resolve => server.close(() => resolve()))
server.closeAsync = () => /** @type {Promise<void>} */(new Promise(resolve => server.close(() => resolve())))

/**
* @param {{fileName:string, browser:puppeteer.Browser}} param0
Expand Down
2 changes: 2 additions & 0 deletions scripts/browserTest/mime.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check

import { extname } from 'path'

export const mime = fileName => {
Expand Down
2 changes: 2 additions & 0 deletions scripts/browserTest/nyc.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-check

import { spawn } from 'child_process'

const isWin = process.platform === 'win32'
Expand Down
10 changes: 6 additions & 4 deletions scripts/browserTest/requestListener.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @ts-check

import path from 'path'
import { mime } from './mime.mjs'
import { readFile } from 'fs/promises'
import { spawn } from 'child_process'
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
import { NYC } from './nyc.mjs'
Expand All @@ -13,12 +14,12 @@ const testerJS = await readFile(join(__dirname, './tester.js'), { encoding: 'utf

export const totalPasses = [0, 0]

/** @type {Array<{text:string, id: number, type?: string}>} */
let _messages = []

const sendMessages = () => {
_messages
.sort((a, b) => {
a.id - b.id
})
.sort((a, b) => a.id - b.id)
.forEach(m => {
if (m.type === 'end') {
const match = m.text.match(/(\d+)\/(\d+).passing/m)
Expand All @@ -39,6 +40,7 @@ const sendMessages = () => {

_messages = []
}

const queueMessages = message => {
_messages.push(message)

Expand Down

0 comments on commit a17ee03

Please sign in to comment.