From 26c72bf7ecd216a30742919c4681f71ed42e3f33 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 12 Nov 2024 21:49:49 -0800 Subject: [PATCH] test-js-with-puppeteer: Run with node --experimental-strip-types. Signed-off-by: Anders Kaseorg --- tools/test-js-with-puppeteer | 7 +------ web/e2e-tests/lib/common.ts | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/test-js-with-puppeteer b/tools/test-js-with-puppeteer index 4bfec91204..6c8cc65fb3 100755 --- a/tools/test-js-with-puppeteer +++ b/tools/test-js-with-puppeteer @@ -63,12 +63,7 @@ options = parser.parse_args() def run_single_test(test_file: str, test_number: int, total_tests: int) -> int: - cmd = [ - os.path.join(ZULIP_PATH, "node_modules/.bin/ts-node"), - "--script-mode", - "--transpile-only", - test_file, - ] + cmd = ["node", "--experimental-strip-types", "--no-warnings=ExperimentalWarning", test_file] test_name = os.path.basename(test_file) cmd_str = shlex.join(cmd) diff --git a/web/e2e-tests/lib/common.ts b/web/e2e-tests/lib/common.ts index de606c6e2a..5f0d5c50b3 100644 --- a/web/e2e-tests/lib/common.ts +++ b/web/e2e-tests/lib/common.ts @@ -2,6 +2,7 @@ import assert from "node:assert/strict"; import "css.escape"; import path from "node:path"; import timersPromises from "node:timers/promises"; +import * as url from "node:url"; import ErrorStackParser from "error-stack-parser"; import type {Browser, ConsoleMessage, ConsoleMessageLocation, ElementHandle, Page} from "puppeteer"; @@ -11,7 +12,7 @@ import StackTraceGPS from "stacktrace-gps"; import {test_credentials} from "../../../var/puppeteer/test_credentials.js"; -const root_dir = path.resolve(__dirname, "../../.."); +const root_dir = url.fileURLToPath(new URL("../../..", import.meta.url)); const puppeteer_dir = path.join(root_dir, "var/puppeteer"); type Message = Record & {