diff --git a/.github/workflows/check-e2e.yml b/.github/workflows/check-e2e.yml index 814510f12..7f8ba0883 100644 --- a/.github/workflows/check-e2e.yml +++ b/.github/workflows/check-e2e.yml @@ -40,7 +40,6 @@ jobs: run: | mkdir -p tests/artifacts; ./scripts/install-binaries; - ./scripts/install-binaries --show-path >> $GITHUB_PATH; - name: Run Playwright tests run: | diff --git a/scripts/install-binaries b/scripts/install-binaries index 3c6f53ade..ec859bb51 100755 --- a/scripts/install-binaries +++ b/scripts/install-binaries @@ -69,24 +69,4 @@ do fi done -RADICLE_HOME=${RAD_HOME:-"${HOME}/.radicle/bin"} - -# Add a separator between binaries download and PATH instructions. echo - -if [[ ":$PATH:" != *":$BINARY_PATH:"* ]]; then - if [[ ":$PATH:" == *":$RADICLE_HOME:"* ]]; then - echo "⚠️ You already have a radicle bin folder in your PATH variable." - echo - echo "To ensure you are using the correct test binaries, run the following command:" - else - echo "Before running the tests, make sure your PATH variable is set up correctly by running:" - fi - - echo " 👉 export PATH=$BINARY_PATH:\$PATH" - -else - echo "✅ $BINARY_PATH is already in your PATH variable." -fi - - diff --git a/tests/support/fixtures.ts b/tests/support/fixtures.ts index 9f55b4186..8db878bbc 100644 --- a/tests/support/fixtures.ts +++ b/tests/support/fixtures.ts @@ -5,24 +5,19 @@ import type { PeerManager, RadiclePeer } from "./peerManager.js"; import * as Fs from "node:fs/promises"; import * as FsSync from "node:fs"; import * as Path from "node:path"; -import { dirname } from "node:path"; -import { fileURLToPath } from "node:url"; import { test as base, expect, type ViewportSize } from "@playwright/test"; import * as Process from "./process.js"; import * as issue from "@tests/support/cobs/issue.js"; import * as logLabel from "@tests/support/logLabel.js"; import * as patch from "@tests/support/cobs/patch.js"; -import { createOptions } from "@tests/support/support.js"; +import { createOptions, supportDir, tmpDir } from "@tests/support/support.js"; import { createPeerManager } from "@tests/support/peerManager.js"; import { createProject } from "@tests/support/project.js"; export { expect }; -const filename = fileURLToPath(import.meta.url); -export const supportDir = dirname(filename); -export const tmpDir = Path.resolve(supportDir, "..", "./tmp"); -export const fixturesDir = Path.resolve(supportDir, "..", "./fixtures"); +const fixturesDir = Path.resolve(supportDir, "..", "./fixtures"); type ViewportTypes = "iPhoneXR" | "Desktop"; diff --git a/tests/support/globalSetup.ts b/tests/support/globalSetup.ts index 6bd51eb24..893ec3f8a 100644 --- a/tests/support/globalSetup.ts +++ b/tests/support/globalSetup.ts @@ -12,10 +12,9 @@ import { createSourceBrowsingFixture, gitOptions, startPalmHttpd, - supportDir, - tmpDir, } from "@tests/support/fixtures.js"; import { createPeerManager } from "@tests/support/peerManager.js"; +import { heartwoodShortSha, tmpDir } from "./support"; const workspacePaths = [Path.join(tmpDir, "peers"), Path.join(tmpDir, "repos")]; @@ -69,13 +68,10 @@ export default async function globalSetup(_config: FullConfig): Promise { // Assert that the `rad` CLI is installed and has the correct version. async function assertRadInstalled(): Promise { - const versionConstraint = ( - await Fs.readFile(`${supportDir}/heartwood-version`, "utf8") - ).substring(0, 7); const { stdout: version } = await execa("rad", ["--version"]); - if (!version.includes(versionConstraint)) { + if (!version.includes(heartwoodShortSha)) { throw new Error( - `rad version ${version} does not satisfy ${versionConstraint}`, + `rad version ${version} does not satisfy ${heartwoodShortSha}`, ); } } diff --git a/tests/support/support.ts b/tests/support/support.ts index 67d017795..85dd28bf2 100644 --- a/tests/support/support.ts +++ b/tests/support/support.ts @@ -1,5 +1,8 @@ import type { Options } from "execa"; import * as Crypto from "node:crypto"; +import { fileURLToPath } from "node:url"; +import * as Path from "node:path"; +import * as Fs from "node:fs/promises"; // Generate string of 12 random characters with 8 bits of entropy. export function randomTag(): string { @@ -13,3 +16,17 @@ export function createOptions(projectFolder: string, days: number): Options { env: { RAD_COMMIT_TIME: (1671211684 + days * 86400).toString() }, }; } + +const filename = fileURLToPath(import.meta.url); +export const supportDir = Path.dirname(filename); +export const tmpDir = Path.resolve(supportDir, "..", "./tmp"); +export const fixturesDir = Path.resolve(supportDir, "..", "./fixtures"); + +export const heartwoodShortSha = ( + await Fs.readFile(`${supportDir}/heartwood-version`, "utf8") +).substring(0, 7); + +process.env.PATH = [ + Path.join(tmpDir, "bin", heartwoodShortSha), + process.env.PATH, +].join(Path.delimiter); diff --git a/tsconfig.json b/tsconfig.json index 29e51cf7e..ff20bd2c8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "exclude": ["node_modules/*"], "compilerOptions": { "target": "es2020", - "module": "es2020", + "module": "es2022", "types": ["vite/client"], "sourceMap": true, "baseUrl": "./",