Compare commits

...

2 Commits

Author SHA1 Message Date
Dylan Conway
f2a5d0dc92 Merge branch 'main' into dylan/verdaccio-github-actions 2024-04-29 17:23:41 -07:00
Dylan Conway
2e285e8151 maybe work 2024-04-29 17:21:52 -07:00
2 changed files with 14 additions and 26 deletions

View File

@@ -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() }}

View File

@@ -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<void>(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}/"
`,
);
});