From 30af4569e6b27222d428794788d1ca96f53cb89c Mon Sep 17 00:00:00 2001 From: Chris Rice <43147264+chrisrice202@users.noreply.github.com> Date: Tue, 7 Nov 2023 08:24:00 -0700 Subject: [PATCH] chore: replaced `test-listen` with `async-listen` (#920) --- package-lock.json | 44 +++++++------------ packages/playwright/package.json | 3 +- .../playwright/test/axe-playwright.spec.ts | 6 ++- packages/puppeteer/package.json | 3 +- packages/puppeteer/test/axe-puppeteer.spec.ts | 6 ++- packages/puppeteer/test/utils.ts | 6 ++- packages/webdriverio/package.json | 3 +- .../webdriverio/test/axe-webdriverio.spec.ts | 6 ++- packages/webdriverjs/package.json | 3 +- .../webdriverjs/test/axe-webdriverjs.spec.ts | 6 ++- test/wdio/package.json | 2 +- test/wdio/wdio-globals.spec.ts | 6 ++- 12 files changed, 46 insertions(+), 48 deletions(-) diff --git a/package-lock.json b/package-lock.json index 072182dd..c35033c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5425,15 +5425,6 @@ "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", "dev": true }, - "node_modules/@types/test-listen": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@types/test-listen/-/test-listen-1.1.0.tgz", - "integrity": "sha512-y6ZfbSzYHniCeY6ZAzsQjSAdJInNVoEz4Uhsb81W+RCoNYA59yoG/+XbqPqCPj2KCU3Wa6RFWSozutkGIHIsNQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/tough-cookie": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz", @@ -11644,6 +11635,15 @@ "node": ">=0.12.0" } }, + "node_modules/async-listen": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/async-listen/-/async-listen-3.0.1.tgz", + "integrity": "sha512-cWMaNwUJnf37C/S5TfCkk/15MwbPRwVYALA2jtjkbHjCmAPiDXyNJy2q3p1KAZzDLHAWyarUWSujUoHR4pEgrA==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, "node_modules/asynciterator.prototype": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz", @@ -29094,12 +29094,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/test-listen": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/test-listen/-/test-listen-1.1.0.tgz", - "integrity": "sha512-OyEVi981C1sb9NX1xayfgZls3p8QTDRwp06EcgxSgd1kktaENBW8dO15i8v/7Fi15j0IYQctJzk5J+hyEBId2w==", - "dev": true - }, "node_modules/text-extensions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", @@ -31232,7 +31226,7 @@ "dependencies": { "@axe-core/webdriverjs": "^4.8.1", "axe-core": "~4.8.2", - "chromedriver": "*", + "chromedriver": "latest", "colors": "^1.4.0", "commander": "^9.4.1", "selenium-webdriver": "^4.8.1" @@ -31312,14 +31306,13 @@ "@types/express": "^4.17.14", "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", "express": "^4.18.2", "mocha": "^10.0.0", "nyc": "^15.1.0", "rimraf": "^5.0.5", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4" @@ -31341,7 +31334,7 @@ "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", "@types/sinon": "^10.0.13", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", "cross-dirname": "^0.1.0", @@ -31351,7 +31344,6 @@ "puppeteer": "19.7.3", "sinon": "^14.0.1", "source-map-support": "^0.5.21", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4" @@ -31429,10 +31421,10 @@ "@types/express": "^4.17.14", "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", - "chromedriver": "*", + "chromedriver": "latest", "cross-dirname": "^0.1.0", "delay": "^5.0.0", "express": "^4.18.2", @@ -31440,7 +31432,6 @@ "nyc": "^15.1.0", "rimraf": "^5.0.5", "source-map-support": "^0.5.21", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4", @@ -31464,16 +31455,15 @@ "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", "@types/selenium-webdriver": "^4.1.5", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", - "chromedriver": "*", + "chromedriver": "latest", "express": "^4.18.2", "mocha": "^10.0.0", "nyc": "^15.1.0", "rimraf": "^5.0.5", "selenium-webdriver": "^4.8.1", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4" @@ -31522,11 +31512,11 @@ "@wdio/local-runner": "^8.20.0", "@wdio/mocha-framework": "^8.20.0", "@wdio/spec-reporter": "^8.20.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.10", "express": "^4.18.2", "mocha": "^10.2.0", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "typescript": "^5.2.2" } diff --git a/packages/playwright/package.json b/packages/playwright/package.json index f2cba325..92439c88 100644 --- a/packages/playwright/package.json +++ b/packages/playwright/package.json @@ -56,14 +56,13 @@ "@types/express": "^4.17.14", "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", "express": "^4.18.2", "mocha": "^10.0.0", "nyc": "^15.1.0", "rimraf": "^5.0.5", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4" diff --git a/packages/playwright/test/axe-playwright.spec.ts b/packages/playwright/test/axe-playwright.spec.ts index c5dc55db..a269c33a 100644 --- a/packages/playwright/test/axe-playwright.spec.ts +++ b/packages/playwright/test/axe-playwright.spec.ts @@ -3,7 +3,7 @@ import fs from 'fs'; import { chromium, ChromiumBrowser, Page } from '@playwright/test'; import express from 'express'; import type { AxeResults, Result } from 'axe-core'; -import testListen from 'test-listen'; +import listen from 'async-listen'; import { assert } from 'chai'; import path from 'path'; import { Server, createServer } from 'http'; @@ -38,7 +38,9 @@ describe('@axe-core/playwright', () => { const app = express(); app.use(express.static(fixturesPath)); server = createServer(app); - addr = await testListen(server); + // async-listen adds trailing forward slash, + // this removes the unnecessary trailing forward slash + addr = (await listen(server)).toString().replace(/\/$/, ''); }); after(async () => { diff --git a/packages/puppeteer/package.json b/packages/puppeteer/package.json index f93faa59..24834a3a 100644 --- a/packages/puppeteer/package.json +++ b/packages/puppeteer/package.json @@ -37,7 +37,7 @@ "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", "@types/sinon": "^10.0.13", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", "cross-dirname": "^0.1.0", @@ -47,7 +47,6 @@ "puppeteer": "19.7.3", "sinon": "^14.0.1", "source-map-support": "^0.5.21", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4" diff --git a/packages/puppeteer/test/axe-puppeteer.spec.ts b/packages/puppeteer/test/axe-puppeteer.spec.ts index d9b0ea5e..036f3bd2 100644 --- a/packages/puppeteer/test/axe-puppeteer.spec.ts +++ b/packages/puppeteer/test/axe-puppeteer.spec.ts @@ -6,7 +6,7 @@ import { assert } from 'chai'; import Puppeteer, { Browser, Page } from 'puppeteer'; import { createServer, Server } from 'http'; import * as sinon from 'sinon'; -import testListen from 'test-listen'; +import listen from 'async-listen'; import { AxePuppeteer } from '../src/index'; import { startServer, @@ -355,7 +355,9 @@ describe('AxePuppeteer', function () { }, 3000); } }); - addr2 = await testListen(server2); + // async-listen adds trailing forward slash, + // this removes the unnecessary trailing forward slash + addr2 = (await listen(server2)).toString().replace(/\/$/, ''); }); after(() => { diff --git a/packages/puppeteer/test/utils.ts b/packages/puppeteer/test/utils.ts index 46ed60d4..8685049c 100644 --- a/packages/puppeteer/test/utils.ts +++ b/packages/puppeteer/test/utils.ts @@ -1,6 +1,6 @@ import express from 'express'; import { createServer, Server } from 'http'; -import testListen from 'test-listen'; +import listen from 'async-listen'; import { expect } from 'chai'; import type { PuppeteerLaunchOptions } from 'puppeteer'; import { fixturesPath } from 'axe-test-fixtures'; @@ -29,7 +29,9 @@ export async function startServer(): Promise<{ server: Server; addr: string }> { const app: express.Application = express(); app.use(express.static(fixturesPath)); const server: Server = createServer(app); - const addr = await testListen(server); + // async-listen adds trailing forward slash, + // this removes the unnecessary trailing forward slash + const addr = (await listen(server)).toString().replace(/\/$/, ''); return { server, addr }; } diff --git a/packages/webdriverio/package.json b/packages/webdriverio/package.json index 956818b3..8c21a684 100644 --- a/packages/webdriverio/package.json +++ b/packages/webdriverio/package.json @@ -55,7 +55,7 @@ "@types/express": "^4.17.14", "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", "chromedriver": "latest", @@ -66,7 +66,6 @@ "nyc": "^15.1.0", "rimraf": "^5.0.5", "source-map-support": "^0.5.21", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4", diff --git a/packages/webdriverio/test/axe-webdriverio.spec.ts b/packages/webdriverio/test/axe-webdriverio.spec.ts index 6590ddd8..e932e25b 100644 --- a/packages/webdriverio/test/axe-webdriverio.spec.ts +++ b/packages/webdriverio/test/axe-webdriverio.spec.ts @@ -1,6 +1,6 @@ import * as webdriverio from 'webdriverio'; import express from 'express'; -import testListen from 'test-listen'; +import listen from 'async-listen'; import { assert } from 'chai'; import chromedriver from 'chromedriver'; import path from 'path'; @@ -96,7 +96,9 @@ describe('@axe-core/webdriverio', () => { let binaryPath; app.use(express.static(fixturesPath)); server = createServer(app); - addr = await testListen(server); + // async-listen adds trailing forward slash, + // this removes the unnecessary trailing forward slash + addr = (await listen(server)).toString().replace(/\/$/, ''); if ( fs.existsSync(`C:/Program Files/Google/Chrome/Application/chrome.exe`) ) { diff --git a/packages/webdriverjs/package.json b/packages/webdriverjs/package.json index 2576388a..0fbdaf5b 100644 --- a/packages/webdriverjs/package.json +++ b/packages/webdriverjs/package.json @@ -72,7 +72,7 @@ "@types/mocha": "^10.0.0", "@types/node": "^20.8.10", "@types/selenium-webdriver": "^4.1.5", - "@types/test-listen": "^1.1.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.6", "chromedriver": "latest", @@ -81,7 +81,6 @@ "nyc": "^15.1.0", "rimraf": "^5.0.5", "selenium-webdriver": "^4.8.1", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "tsup": "^7.2.0", "typescript": "^4.8.4" diff --git a/packages/webdriverjs/test/axe-webdriverjs.spec.ts b/packages/webdriverjs/test/axe-webdriverjs.spec.ts index ed27baaf..897fbc54 100644 --- a/packages/webdriverjs/test/axe-webdriverjs.spec.ts +++ b/packages/webdriverjs/test/axe-webdriverjs.spec.ts @@ -2,7 +2,7 @@ import 'mocha'; import type { AxeResults, Result } from 'axe-core'; import type { WebDriver } from 'selenium-webdriver'; import express from 'express'; -import testListen from 'test-listen'; +import listen from 'async-listen'; import { assert } from 'chai'; import path from 'path'; import fs from 'fs'; @@ -44,7 +44,9 @@ describe('@axe-core/webdriverjs', () => { const app = express(); app.use(express.static(fixturesPath)); server = createServer(app); - addr = await testListen(server); + // async-listen adds trailing forward slash, + // this removes the unnecessary trailing forward slash + addr = (await listen(server)).toString().replace(/\/$/, ''); }); beforeEach(async () => { diff --git a/test/wdio/package.json b/test/wdio/package.json index 4027cc10..c3b19aa3 100644 --- a/test/wdio/package.json +++ b/test/wdio/package.json @@ -14,11 +14,11 @@ "@wdio/local-runner": "^8.20.0", "@wdio/mocha-framework": "^8.20.0", "@wdio/spec-reporter": "^8.20.0", + "async-listen": "^3.0.1", "axe-test-fixtures": "github:dequelabs/axe-test-fixtures#v1", "chai": "^4.3.10", "express": "^4.18.2", "mocha": "^10.2.0", - "test-listen": "^1.1.0", "ts-node": "^10.9.1", "typescript": "^5.2.2" } diff --git a/test/wdio/wdio-globals.spec.ts b/test/wdio/wdio-globals.spec.ts index b003c5d6..d40f2fce 100644 --- a/test/wdio/wdio-globals.spec.ts +++ b/test/wdio/wdio-globals.spec.ts @@ -4,7 +4,7 @@ import { assert } from 'chai'; import express from 'express'; import { fixturesPath } from 'axe-test-fixtures'; import { Server, createServer } from 'http'; -import testListen from 'test-listen'; +import listen from 'async-listen'; describe('@wdio/globals', () => { let server: Server; @@ -14,7 +14,9 @@ describe('@wdio/globals', () => { const app = express(); app.use(express.static(fixturesPath)); server = createServer(app); - addr = await testListen(server); + // async-listen adds trailing forward slash, + // this removes the unnecessary trailing forward slash + addr = (await listen(server)).toString().replace(/\/$/, ''); }); beforeEach(() => {