Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bun-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.3.14
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
- uses: oven-sh/setup-bun@v2
with:
cache: yarn
node-version-file: ".nvmrc"
- run: yarn install
- run: yarn build
- run: yarn test
bun-version-file: ".bun-version"
- run: bun install
- run: bun run build
- run: bun test
9 changes: 4 additions & 5 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
- uses: oven-sh/setup-bun@v2
with:
cache: yarn
node-version-file: ".nvmrc"
- run: yarn install
- run: yarn build
bun-version-file: ".bun-version"
- run: bun install
- run: bun run build
- uses: actions/upload-artifact@v7
with:
name: dist
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
app-id: ${{ vars.FRECKLE_AUTOMATION_APP_ID }}
private-key: ${{ secrets.FRECKLE_AUTOMATION_PRIVATE_KEY }}

- uses: oven-sh/setup-bun@v2
with:
bun-version-file: ".bun-version"

- uses: cycjimmy/semantic-release-action@v6.0.0
with:
extra_plugins: |
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .releaserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins:

# Update dist, in case Dependabot PRs merged without doing so
- - "@semantic-release/exec"
- prepareCmd: "yarn install && yarn run build"
- prepareCmd: "bun install && bun run build"

- - "@semantic-release/git"
- assets: "dist/index.js"
Expand Down
316 changes: 316 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "tsc && ncc build lib/main.js && sed -i 's/\\x0D$//' ./dist/index.js",
"format": "prettier --write \"**/*.ts\"",
"format-check": "prettier --check \"**/*.ts\"",
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
"test": "bun test",
"readme": "npx action-docs -u && prettier --write README.md"
},
"repository": {
Expand All @@ -26,14 +26,12 @@
"shellwords-ts": "^3.0.1"
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/bun": "^1.3.14",
"@types/js-yaml": "^4.0.9",
"@types/node": "^24.13.3",
"@vercel/ncc": "^0.44.1",
"action-docs": "^2.5.1",
"jest": "^30.4.2",
"prettier": "^3.9.6",
"ts-jest": "^29.4.12",
"ts-node": "^10.9.2",
"typescript": "^7.0.2"
}
Expand Down
2 changes: 1 addition & 1 deletion src/dirty-files.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { describe, expect, test } from "bun:test";

import { parseGitStatus, isInterestingFile } from "./dirty-files.js";

Expand Down
2 changes: 1 addition & 1 deletion src/envsubst.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { describe, expect, test } from "bun:test";

import { envsubst } from "./envsubst.js";

Expand Down
2 changes: 1 addition & 1 deletion src/get-cache-keys.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { expect, test } from "bun:test";

import { getCacheKeys } from "./get-cache-keys.js";

Expand Down
2 changes: 1 addition & 1 deletion src/parse-stack-path.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { expect, test } from "bun:test";

import { parseStackPath } from "./parse-stack-path.js";

Expand Down
2 changes: 1 addition & 1 deletion src/parse-stack-query.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { expect, test } from "bun:test";

import { parseStackQuery } from "./parse-stack-query.js";

Expand Down
8 changes: 6 additions & 2 deletions src/stack-cli.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { ExecOptions } from "@actions/exec";
import { jest } from "@jest/globals";
import { beforeEach, describe, expect, mock, test } from "bun:test";

import { ExecDelegate, StackCLI } from "./stack-cli.js";

const exec: ExecDelegate = {
exec: jest.fn((command: string, args: string[], options?: ExecOptions) =>
exec: mock((command: string, args: string[], options?: ExecOptions) =>
Promise.resolve(0),
),
};

beforeEach(() => {
mock.clearAllMocks();
});

describe("StackCLI", () => {
test("Respects --resolver given", async () => {
const stackCLI = new StackCLI(["--resolver", "lts"], false, exec);
Expand Down
2 changes: 1 addition & 1 deletion src/stack-yaml.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { jest } from "@jest/globals";
import { describe, expect, jest, test } from "bun:test";

import { parseStackYaml, getStackDirectories } from "./stack-yaml.js";
import { StackCLI } from "./stack-cli.js";
Expand Down
28 changes: 16 additions & 12 deletions src/with-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from "@actions/core";
import { jest } from "@jest/globals";
import { beforeEach, expect, mock, spyOn, test } from "bun:test";

import { getCacheKeys } from "./get-cache-keys.js";
import {
Expand All @@ -9,11 +9,15 @@ import {
} from "./with-cache.js";

const cache: CacheDelegate = {
restoreCache: jest.fn(() => Promise.resolve("")),
saveCache: jest.fn(() => Promise.resolve(0)),
restoreCache: mock(() => Promise.resolve("")),
saveCache: mock(() => Promise.resolve(0)),
};

const restoreCacheMock = jest.spyOn(cache, "restoreCache");
const restoreCacheMock = spyOn(cache, "restoreCache");

beforeEach(() => {
mock.clearAllMocks();
});

async function testFunction(): Promise<number> {
return 42;
Expand Down Expand Up @@ -119,15 +123,15 @@ test("withCache does not save on error", async () => {
const cacheKeys = getCacheKeys(["a-b", "c", "d"]);
restoreCacheMock.mockImplementation(simulateCacheMiss);

await expect(async () => {
await withCache(
await expect(
withCache(
cachePaths,
cacheKeys,
testFunctionThrows,
{ ...DEFAULT_CACHE_OPTIONS, silent: true },
cache,
);
}).rejects.toThrow();
),
).rejects.toThrow();

expect(cache.restoreCache).toHaveBeenCalledWith(
cachePaths,
Expand All @@ -144,8 +148,8 @@ test("withCache can be configured to save on error", async () => {
const cacheKeys = getCacheKeys(["a-b", "c", "d"]);
restoreCacheMock.mockImplementation(simulateCacheMiss);

await expect(async () => {
await withCache(
await expect(
withCache(
cachePaths,
cacheKeys,
testFunctionThrows,
Expand All @@ -155,8 +159,8 @@ test("withCache can be configured to save on error", async () => {
silent: true,
},
cache,
);
}).rejects.toThrow();
),
).rejects.toThrow();

expect(cache.restoreCache).toHaveBeenCalledWith(
cachePaths,
Expand Down
Loading
Loading