diff options
Diffstat (limited to 'packages/bun-ecosystem')
-rw-r--r-- | packages/bun-ecosystem/.gitignore | 3 | ||||
-rw-r--r-- | packages/bun-ecosystem/README.md | 7 | ||||
-rwxr-xr-x | packages/bun-ecosystem/bun.lockb | bin | 8536 -> 0 bytes | |||
-rw-r--r-- | packages/bun-ecosystem/package.json | 15 | ||||
-rw-r--r-- | packages/bun-ecosystem/src/packages.ts | 69 | ||||
-rw-r--r-- | packages/bun-ecosystem/src/runner.ts | 92 | ||||
-rw-r--r-- | packages/bun-ecosystem/tsconfig.json | 16 |
7 files changed, 0 insertions, 202 deletions
diff --git a/packages/bun-ecosystem/.gitignore b/packages/bun-ecosystem/.gitignore deleted file mode 100644 index 2817d4e0b..000000000 --- a/packages/bun-ecosystem/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -node_modules -tmp diff --git a/packages/bun-ecosystem/README.md b/packages/bun-ecosystem/README.md deleted file mode 100644 index 2ed8df0c7..000000000 --- a/packages/bun-ecosystem/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# bun-ecosystem - -A registry to test `npm` packages using Bun. This can be used as a tool to find bugs in Bun by running the test suites of these packages. In the future, we will run theses tests to catch regressions between releases. - -```sh -bun run test -``` diff --git a/packages/bun-ecosystem/bun.lockb b/packages/bun-ecosystem/bun.lockb Binary files differdeleted file mode 100755 index 4eb6aded1..000000000 --- a/packages/bun-ecosystem/bun.lockb +++ /dev/null diff --git a/packages/bun-ecosystem/package.json b/packages/bun-ecosystem/package.json deleted file mode 100644 index 190314a31..000000000 --- a/packages/bun-ecosystem/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "bun-ecosystem-ci", - "private": true, - "dependencies": { - "globby": "^13.1.3" - }, - "devDependencies": { - "bun-types": "canary", - "prettier": "^2.8.2" - }, - "scripts": { - "format": "prettier --write src", - "test": "bun run src/runner.ts" - } -} diff --git a/packages/bun-ecosystem/src/packages.ts b/packages/bun-ecosystem/src/packages.ts deleted file mode 100644 index 677bfdf16..000000000 --- a/packages/bun-ecosystem/src/packages.ts +++ /dev/null @@ -1,69 +0,0 @@ -export type Package = { - readonly name: string; - readonly repository: string; - readonly cwd?: string; - readonly tests?: { - readonly style: "jest" | "ava" | "tape" | "custom"; - readonly include: string[]; - readonly exclude?: string[]; - readonly disabled?: boolean; - }; -}; - -export const packages: Package[] = [ - { - name: "lodash", - repository: github("lodash/lodash"), - tests: { - style: "jest", - include: ["test/*.js"], - exclude: [ - "debounce.test.js", // hangs runner - "size.test.js", // require('vm').runInNewContext() - "merge.test.js", // failing - ], - }, - }, - { - name: "chalk", - repository: github("chalk/chalk"), - tests: { - style: "ava", - include: ["test/*.js"], - }, - }, - { - name: "request", - repository: github("request/request"), - tests: { - style: "tape", - include: ["tests/*.js"], - }, - }, - { - name: "commander", - repository: github("tj/commander.js"), - tests: { - style: "jest", - include: ["tests/*.js"], - }, - }, - { - name: "express", - repository: github("expressjs/express"), - tests: { - style: "jest", - include: ["test/**/*.js"], - exclude: [ - "test/res.sendStatus.js", // https://github.com/oven-sh/bun/issues/887 - "test/Route.js", // https://github.com/oven-sh/bun/issues/2030 - ], - // Most tests fail due to lack of "http2" - disabled: true, - }, - }, -]; - -function github(repository: string): string { - return `git@github.com:${repository}.git`; -} diff --git a/packages/bun-ecosystem/src/runner.ts b/packages/bun-ecosystem/src/runner.ts deleted file mode 100644 index f95174808..000000000 --- a/packages/bun-ecosystem/src/runner.ts +++ /dev/null @@ -1,92 +0,0 @@ -import type { Package } from "./packages"; -import { packages } from "./packages"; -import { existsSync, copyFileSync } from "node:fs"; -import { dirname, join } from "node:path"; -import { globby } from "globby"; - -for (const pkg of packages) { - try { - await loadPackage(pkg, "tmp"); - } catch (error) { - console.error(pkg.name, error); - } -} - -async function loadPackage(pkg: Package, cwd?: string): Promise<void> { - await gitClone({ - cwd, - repository: pkg.repository, - name: pkg.name, - }); - const dir = join(cwd ?? "", pkg.name, pkg.cwd ?? ""); - await spawn({ - cwd: dir, - cmd: ["bun", "install"], - }); - if (!pkg.tests || pkg.tests.style !== "jest") { - return; - } - const files = await globby(pkg.tests.include, { - cwd: dir, - ignore: pkg.tests.exclude ?? [crypto.randomUUID()], - onlyFiles: true, - caseSensitiveMatch: false, - }); - if (!files.length) { - throw new Error("No tests found"); - } - for (const file of files) { - let path = file; - if (!file.includes(".test.")) { - const ext = path.lastIndexOf("."); - path = file.substring(0, ext) + ".test" + file.substring(ext); - copyFileSync(join(dir, file), join(dir, path)); - } - await spawn({ - cwd: dir, - cmd: ["bun", "test", path], - }); - } -} - -type GitCloneOptions = { - repository: string; - cwd?: string; - name?: string; -}; - -async function gitClone(options: GitCloneOptions): Promise<void> { - const name = options.name ?? dirname(options.repository); - const cwd = options.cwd ?? process.cwd(); - const path = join(cwd, name); - if (existsSync(path)) { - await spawn({ - cwd: path, - cmd: ["git", "pull"], - }); - } else { - const url = `${options.repository}`; - await spawn({ - cwd, - cmd: ["git", "clone", "--single-branch", "--depth", "1", url, name], - }); - } -} - -type SpawnOptions = { - cwd: string; - cmd: string[]; -}; - -async function spawn({ cwd, cmd }: SpawnOptions) { - const { exited } = await Bun.spawn({ - cwd, - cmd, - stdout: "inherit", - stderr: "inherit", - }); - const exitCode = await exited; - if (exitCode !== 0) { - throw new Error(`"${cmd.join(" ")}" exited with ${exitCode}`); - } -} diff --git a/packages/bun-ecosystem/tsconfig.json b/packages/bun-ecosystem/tsconfig.json deleted file mode 100644 index 1b2f41220..000000000 --- a/packages/bun-ecosystem/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ESNext"], - "module": "ESNext", - "target": "ESNext", - "moduleResolution": "node", - "types": ["bun-types"], - "esModuleInterop": true, - "allowJs": true, - "strict": true, - "resolveJsonModule": true - }, - "include": [ - "src" - ] -} |