Skip to content

Commit

Permalink
fix: re-add Blob support
Browse files Browse the repository at this point in the history
Switching to `bun test`. `jsdom` is annoying.

BREAKING CHANGE: Blobs require making the `pack` interface async
  • Loading branch information
jonasgloning committed Dec 1, 2023
1 parent 9a2efa9 commit 12f0e75
Show file tree
Hide file tree
Showing 23 changed files with 1,614 additions and 16,076 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/bun.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Bun CI

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun test
- run: bun run check
58 changes: 29 additions & 29 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
# # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI
# name: Node.js CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
# on:
# push:
# branches: ["master"]
# pull_request:
# branches: ["master"]

jobs:
build:
runs-on: ubuntu-latest
# jobs:
# build:
# runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
# strategy:
# matrix:
# node-version: [16.x, 18.x, 20.x]
# # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build
- run: npm run coverage
- name: Publish code coverage to CodeClimate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
# steps:
# - uses: actions/checkout@v3
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: ${{ matrix.node-version }}
# cache: "npm"
# - run: npm ci
# - run: npm run build
# - run: npm run coverage
# - name: Publish code coverage to CodeClimate
# uses: paambaati/[email protected]
# env:
# CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
21 changes: 7 additions & 14 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
# From https://til.simonwillison.net/github-actions/prettier-github-actions
name: Check JavaScript for conformance with Prettier

on:
push:
pull_request:

jobs:
prettier:
biome:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- uses: actions/cache@v3
name: Configure npm caching
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/workflows/prettier.yml') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Run prettier
run: |-
npx prettier --check .
- name: Checkout
uses: actions/checkout@v4
- name: Setup Biome
uses: biomejs/setup-biome@v1
- name: Run Biome
run: biome ci .
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: npm ci
run: bun install --frozen-lockfile
- name: Build
run: npm run build
run: bun run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
run: npx semantic-release
run: bun run semantic-release
Empty file removed .npmignore
Empty file.
6 changes: 0 additions & 6 deletions .prettierignore

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierrc.toml

This file was deleted.

6 changes: 1 addition & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"standard.semistandard": true,
"standard.usePackageJson": true,
"standard.autoFixOnSave": true,
"javascript.validate.enable": false,
"eslint.autoFixOnSave": true
"editor.defaultFormatter": "biomejs.biome"
}
15 changes: 15 additions & 0 deletions __test__/blobs.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { expect, describe, it } from "@jest/globals";

import { packAndUnpack } from "./util";

import { objWithBlob } from "./data";

describe("Blobs", () => {
it("replaces Blobs with ArrayBuffer ", async () => {
const objWithAB = {
...objWithBlob,
blob: await objWithBlob.blob.arrayBuffer(),
};
expect(await packAndUnpack(objWithBlob)).toStrictEqual(objWithAB);
});
});
4 changes: 2 additions & 2 deletions __test__/bugs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ describe("Bugs", () => {
});
describe("Numbers", () => {
it("gives back wrong value on INT64_MAX ", async () => {
expect(await packAndUnpack(0x7fffffffffffffff)).toBe(
-9223372036854776000,
expect(await packAndUnpack(0x7fffffffffffffff)).not.toEqual(
0x7fffffffffffffff,
);
});
});
Expand Down
Loading

0 comments on commit 12f0e75

Please sign in to comment.