diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 24f72b1bc4..f0da47774a 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -24,6 +24,17 @@ jobs: test: name: Tests runs-on: ${{ inputs.runs-on }} + + services: + verdaccio: + image: verdaccio/verdaccio:5 + ports: + - 4873:4873 + + strategy: + matrix: + node-version: [20] + steps: - if: ${{ runner.os == 'Windows' }} name: Setup Git @@ -70,7 +81,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: ${{ matrix.node-version }} - name: Install Dependencies timeout-minutes: 5 run: | @@ -96,6 +107,7 @@ jobs: TLS_POSTGRES_DATABASE_URL: ${{ secrets.TLS_POSTGRES_DATABASE_URL }} TEST_INFO_STRIPE: ${{ secrets.TEST_INFO_STRIPE }} SHELLOPTS: igncr + VERDACCIO_PORT: 4873 run: | node packages/bun-internal-test/src/runner.node.mjs $(which bun) - if: ${{ always() }} diff --git a/test/cli/install/registry/bun-install-registry.test.ts b/test/cli/install/registry/bun-install-registry.test.ts index 356ed18e9a..d11efec802 100644 --- a/test/cli/install/registry/bun-install-registry.test.ts +++ b/test/cli/install/registry/bun-install-registry.test.ts @@ -5,7 +5,6 @@ import { mkdtempSync, realpathSync } from "fs"; import { rm, writeFile, mkdir, exists, cp } from "fs/promises"; import { readdirSorted } from "../dummy.registry"; import { tmpdir } from "os"; -import { fork, ChildProcess } from "child_process"; import { beforeAll, afterAll, beforeEach, afterEach, test, expect, describe } from "bun:test"; expect.extend({ @@ -13,32 +12,9 @@ expect.extend({ toHaveBins, }); -var verdaccioServer: ChildProcess; var testCounter: number = 0; -var port: number = 4873; var packageDir: string; -beforeAll(async () => { - verdaccioServer = fork( - require.resolve("verdaccio/bin/verdaccio"), - ["-c", join(import.meta.dir, "verdaccio.yaml"), "-l", `${port}`], - { silent: true, execPath: "bun" }, - ); - - await new Promise(done => { - verdaccioServer.on("message", (msg: { verdaccio_started: boolean }) => { - if (msg.verdaccio_started) { - console.log("Verdaccio started"); - done(); - } - }); - }); -}); - -afterAll(() => { - verdaccioServer.kill(); -}); - beforeEach(async () => { packageDir = mkdtempSync(join(realpathSync(tmpdir()), "bun-install-registry-" + testCounter++ + "-")); env.BUN_INSTALL_CACHE_DIR = join(packageDir, ".bun-cache"); @@ -48,7 +24,7 @@ beforeEach(async () => { ` [install] cache = false -registry = "http://localhost:${port}/" +registry = "http://localhost:${env.VERDACCIO_PORT}/" `, ); });