Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix running unit tests with Bun #1211

Merged
merged 1 commit into from
Feb 2, 2025
Merged
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
9 changes: 1 addition & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,7 @@ jobs:
name: build

- name: Unit tests with Bun ${{ matrix.bun-version }}
run: yarn run test-coverage

- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
flag-name: run-bun-${{ matrix.test_number }}
parallel: true
run: bun run bun:test

finish:
needs:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"lint": "yarn run lint-md && yarn run lint-ts",
"fix": "yarn run biome lint --write",
"test": "mocha",
"bun:test": "bun run --bun test",
"test-coverage": "c8 yarn run test",
"send-codacy": "c8 report --reporter=text-lcov | codacy-coverage",
"start": "yarn run compile && yarn run lint && yarn run cover-test"
Expand Down
18 changes: 15 additions & 3 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import mocha from 'mocha';
import { stringToUint8Array } from 'uint8array-extras';

import { DelayedStream, makeReadableByteFileStream } from './util.js';
import process from 'node:process';

use(chaiAsPromised);

Expand Down Expand Up @@ -918,7 +919,10 @@ describe('Matrix tests', () => {
}
});

it('abort async operation using `abort()`', async () => {
it('abort async operation using `abort()`', async function() {
if (process.versions.bun) {
this.skip(); // Fails with Bun 1.2
}
const fileReadStream = await getTokenizerWithData('123', tokenizerType, 500);
try {
const promise = fileReadStream.readToken(new Token.StringType(3, 'utf-8'), 0);
Expand All @@ -929,14 +933,22 @@ describe('Matrix tests', () => {
}
});

it('abort async operation using `close()`', async () => {
it('abort async operation using `close()`', async function() {
if (process.versions.bun) {
this.skip(); // Fails with Bun 1.2
}
const fileReadStream = await getTokenizerWithData('123', tokenizerType, 500);
const promise = fileReadStream.readToken(new Token.StringType(3, 'utf-8'), 0);
await fileReadStream.close();
await expect(promise).to.be.rejectedWith(Error);
});

it('abort async operation using `AbortController`', async () => {
it('abort async operation using `AbortController`', async function() {

if (process.versions.bun) {
this.skip(); // Fails with Bun 1.2
}

const abortController = new AbortController();
const fileReadStream = await getTokenizerWithData('123', tokenizerType, 500, abortController.signal);
try {
Expand Down
Loading