Open History to see the last commit
1import { stripVTControlCharacters } from 'node:util'
2import { expect, test } from 'vitest'
3import { appServerReadyPattern } from '../src/webServer'
4β
5test.each([
6 'β Local: http://localhost:49152/',
7 '\u001b[32mβ\u001b[39m \u001b[1mLocal\u001b[22m: \u001b[36mhttp://localhost:\u001b[1m49152\u001b[22m/\u001b[39m',
8 'Listening on http://[::]:49152',
9 'E2E app: http://localhost:49152',
10 'Accepting connections at http://localhost:49152',
11 'Local: https://localhost:49152/',
12])('captures a bound application port from %s', (line) => {
13 expect(
14 appServerReadyPattern.exec(stripVTControlCharacters(line))?.groups
15 ?.E2E_APP_PORT,
16 ).toBe('49152')
17})
18β
19test('does not confuse an arbitrary URL with app readiness', () => {
20 expect(appServerReadyPattern.test('fetching http://localhost:49152')).toBe(
21 false,
22 )
23})