forked from binaryjs/js-binarypack
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`pack` will return a `Promise` when it packs a `Blob` Switching to `bun test`. `jsdom` is annoying.
- Loading branch information
1 parent
9a2efa9
commit 84f4fc3
Showing
24 changed files
with
1,698 additions
and
16,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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 | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { expect, describe, it } from "@jest/globals"; | ||
|
||
import { packAndUnpack } from "./util"; | ||
|
||
import data, { blob, objWithBlob } from "./data"; | ||
import { pack, unpack } from "../lib/binarypack"; | ||
|
||
describe("Blobs", () => { | ||
it("replaces Blobs with ArrayBuffer ", async () => { | ||
expect(await packAndUnpack(blob)).toStrictEqual(await blob.arrayBuffer()); | ||
}); | ||
it("replaces Blobs with ArrayBuffer in objects ", async () => { | ||
const objWithAB = { | ||
...objWithBlob, | ||
blob: await objWithBlob.blob.arrayBuffer(), | ||
}; | ||
expect(await packAndUnpack(objWithBlob)).toStrictEqual(objWithAB); | ||
}); | ||
it("keep Text decodable", async () => { | ||
for (const commit of data) { | ||
const json = JSON.stringify(commit); | ||
const blob = new Blob([json], { type: "application/json" }); | ||
const decoded = new TextDecoder().decode( | ||
await packAndUnpack<ArrayBuffer>(blob), | ||
); | ||
expect(decoded).toStrictEqual(json); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.