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

Add JSC/Bun test suite #2348

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
33 changes: 32 additions & 1 deletion .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,39 @@ jobs:
flag-name: run-${{ matrix.test_number }}
parallel: true

test-jsc:

runs-on: ubuntu-latest

needs: build

env:
YARN_IGNORE_NODE: 1

steps:

- name: 'Checkout the repository'
uses: actions/checkout@v4

- name: Install bun
uses: oven-sh/setup-bun@v2

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install

- name: Download build
uses: actions/download-artifact@v4
with:
name: build

- name: Test with Node.js ${{ matrix.node-version }}
run: bun run --bun test

finish:
needs: test
needs: [test, test-jsc]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
Expand Down
2 changes: 1 addition & 1 deletion lib/core.ts
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but please put this fix in a separate PR

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { IAudioMetadata, INativeTagDict, IOptions, IPicture, IPrivateOption

export type { IFileInfo } from 'strtok3';

export { type IAudioMetadata, type IOptions, type ITag, type INativeTagDict, type ICommonTagsResult, type IFormat, type IPicture, type IRatio, type IChapter, type ILyricsTag, LyricsContentType, TimestampFormat, IMetadataEventTag, IMetadataEvent } from './type.js';
export { type IAudioMetadata, type IOptions, type ITag, type INativeTagDict, type ICommonTagsResult, type IFormat, type IPicture, type IRatio, type IChapter, type ILyricsTag, LyricsContentType, TimestampFormat, type IMetadataEventTag, type IMetadataEvent } from './type.js';

export type * from './ParseError.js'

Expand Down
6 changes: 3 additions & 3 deletions package.json
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't upgrade dependencies with this PR.

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"@tokenizer/token": "^0.3.0",
"content-type": "^1.0.5",
"debug": "^4.4.0",
"file-type": "^19.6.0",
"file-type": "^20.0.1",
"link": "^2.1.1",
"media-typer": "^1.1.0",
"strtok3": "^10.2.0",
Expand All @@ -123,15 +123,15 @@
"@types/debug": "^4.1.12",
"@types/media-typer": "^1.1.3",
"@types/mocha": "^10.0.10",
"@types/node": "^22.12.0",
"@types/node": "^22.13.0",
"c8": "^10.1.3",
"chai": "^5.1.2",
"chai-as-promised": "^8.0.1",
"del-cli": "^6.0.0",
"mime": "^4.0.6",
"mocha": "^11.1.0",
"remark-cli": "^12.0.1",
"remark-preset-lint-consistent": "^6.0.0",
"remark-preset-lint-consistent": "^6.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.7.3"
},
Expand Down
6 changes: 6 additions & 0 deletions test/metadata-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface IParser {
}

const [nodeMajorVersion] = process.versions.node.split('.').map(Number);
const isBun = Boolean(process.versions.bun);

/**
* Helps to loop through different input styles
Expand All @@ -39,6 +40,11 @@ export const Parsers: IParser[] = [
description: 'parseWebStream',
webStream: true,
initParser: async (skipTest, filePath: string, mimeType?: string, options?: IOptions) => {
// TODO - figure out why this never resolves in JSC / Bun
if(isBun){
skipTest();
return;
}
const webStream = await makeReadableByteFileStream(filePath);
try {
return await mm.parseWebStream(webStream.stream, {mimeType: mimeType, size: webStream.fileSize}, options);
Expand Down
23 changes: 23 additions & 0 deletions test/test-javascriptcore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { assert } from 'chai';
import path from 'node:path';

import { samplePath } from './util.js';
import { Parsers } from "./metadata-parsers.js";

describe('JavaScriptCore', () => {

const mp3SamplePath = path.join(samplePath, 'mp3');

it('should parse mp3s correctly', async () => {
const filePath = path.join(mp3SamplePath, 'lame-peak.mp3');

Parsers.forEach(parser => {
it(parser.description, async function(){
const { format, common } = await parser.initParser(() => this.skip(), filePath);
assert.isNotNull(format, 'format');
assert.isNotNull(common, 'common');
});
});
});

});
99 changes: 38 additions & 61 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -328,20 +328,24 @@ __metadata:
languageName: node
linkType: hard

"@sec-ant/readable-stream@npm:^0.4.1":
version: 0.4.1
resolution: "@sec-ant/readable-stream@npm:0.4.1"
checksum: 10c0/64e9e9cf161e848067a5bf60cdc04d18495dc28bb63a8d9f8993e4dd99b91ad34e4b563c85de17d91ffb177ec17a0664991d2e115f6543e73236a906068987af
languageName: node
linkType: hard

"@sindresorhus/merge-streams@npm:^2.1.0":
version: 2.3.0
resolution: "@sindresorhus/merge-streams@npm:2.3.0"
checksum: 10c0/69ee906f3125fb2c6bb6ec5cdd84e8827d93b49b3892bce8b62267116cc7e197b5cccf20c160a1d32c26014ecd14470a72a5e3ee37a58f1d6dadc0db1ccf3894
languageName: node
linkType: hard

"@tokenizer/inflate@npm:^0.2.6":
version: 0.2.6
resolution: "@tokenizer/inflate@npm:0.2.6"
dependencies:
debug: "npm:^4.3.7"
fflate: "npm:^0.8.2"
token-types: "npm:^6.0.0"
checksum: 10c0/7c0e5e85c86fd3dbe4210d26fa16a2121d04ca053eeb2c42826846e85650c585621ca80e587107410a1e664b50ba37fd645e973863aafa9dee594efbab104619
languageName: node
linkType: hard

"@tokenizer/token@npm:^0.3.0":
version: 0.3.0
resolution: "@tokenizer/token@npm:0.3.0"
Expand Down Expand Up @@ -521,12 +525,12 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^22.12.0":
version: 22.12.0
resolution: "@types/node@npm:22.12.0"
"@types/node@npm:^22.13.0":
version: 22.13.0
resolution: "@types/node@npm:22.13.0"
dependencies:
undici-types: "npm:~6.20.0"
checksum: 10c0/be220706732d95db2ed1c441c1e64cab90bf9a47519ce6f4c79cc5a9ec9d5c517131a149a9ac30afac1a30103e67e3a00d453ba7c1b0141608a3a7ba6397c303
checksum: 10c0/9cf6358b2863ae7bf9588ca1cc3d87f6a6289c3880e95a046a188760666870e2c12502df8b0a473bec8aa8ffee85e025d60382a6104b10f197120793235b2c22
languageName: node
linkType: hard

Expand Down Expand Up @@ -990,7 +994,7 @@ __metadata:
languageName: node
linkType: hard

"debug@npm:^4.4.0":
"debug@npm:^4.3.7, debug@npm:^4.4.0":
version: 4.4.0
resolution: "debug@npm:4.4.0"
dependencies:
Expand Down Expand Up @@ -1199,15 +1203,22 @@ __metadata:
languageName: node
linkType: hard

"file-type@npm:^19.6.0":
version: 19.6.0
resolution: "file-type@npm:19.6.0"
"fflate@npm:^0.8.2":
version: 0.8.2
resolution: "fflate@npm:0.8.2"
checksum: 10c0/03448d630c0a583abea594835a9fdb2aaf7d67787055a761515bf4ed862913cfd693b4c4ffd5c3f3b355a70cf1e19033e9ae5aedcca103188aaff91b8bd6e293
languageName: node
linkType: hard

"file-type@npm:^20.0.1":
version: 20.0.1
resolution: "file-type@npm:20.0.1"
dependencies:
get-stream: "npm:^9.0.1"
strtok3: "npm:^9.0.1"
"@tokenizer/inflate": "npm:^0.2.6"
strtok3: "npm:^10.2.0"
token-types: "npm:^6.0.0"
uint8array-extras: "npm:^1.3.0"
checksum: 10c0/ae90ab618d0e759f26806024eb25ade851406301d2deae4b2dca6e9df0de13b4be575114a5f8129e73f6de537644a45fc4eb7cfa8b7dad63316b01b0e6f3bd2e
uint8array-extras: "npm:^1.4.0"
checksum: 10c0/e4888e228c70c6461d6292df6fc7d2af6c301927612f60abc7d9dea49e3de0eb498a8ab9bbb54bf1e63752aa8dc62649fefd8423b64f4910ab04f61be8df6193
languageName: node
linkType: hard

Expand Down Expand Up @@ -1300,16 +1311,6 @@ __metadata:
languageName: node
linkType: hard

"get-stream@npm:^9.0.1":
version: 9.0.1
resolution: "get-stream@npm:9.0.1"
dependencies:
"@sec-ant/readable-stream": "npm:^0.4.1"
is-stream: "npm:^4.0.1"
checksum: 10c0/d70e73857f2eea1826ac570c3a912757dcfbe8a718a033fa0c23e12ac8e7d633195b01710e0559af574cbb5af101009b42df7b6f6b29ceec8dbdf7291931b948
languageName: node
linkType: hard

"glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2":
version: 5.1.2
resolution: "glob-parent@npm:5.1.2"
Expand Down Expand Up @@ -1578,13 +1579,6 @@ __metadata:
languageName: node
linkType: hard

"is-stream@npm:^4.0.1":
version: 4.0.1
resolution: "is-stream@npm:4.0.1"
checksum: 10c0/2706c7f19b851327ba374687bc4a3940805e14ca496dc672b9629e744d143b1ad9c6f1b162dece81c7bfbc0f83b32b61ccc19ad2e05aad2dd7af347408f60c7f
languageName: node
linkType: hard

"is-unicode-supported@npm:^0.1.0":
version: 0.1.0
resolution: "is-unicode-supported@npm:0.1.0"
Expand Down Expand Up @@ -2338,20 +2332,20 @@ __metadata:
"@types/debug": "npm:^4.1.12"
"@types/media-typer": "npm:^1.1.3"
"@types/mocha": "npm:^10.0.10"
"@types/node": "npm:^22.12.0"
"@types/node": "npm:^22.13.0"
c8: "npm:^10.1.3"
chai: "npm:^5.1.2"
chai-as-promised: "npm:^8.0.1"
content-type: "npm:^1.0.5"
debug: "npm:^4.4.0"
del-cli: "npm:^6.0.0"
file-type: "npm:^19.6.0"
file-type: "npm:^20.0.1"
link: "npm:^2.1.1"
media-typer: "npm:^1.1.0"
mime: "npm:^4.0.6"
mocha: "npm:^11.1.0"
remark-cli: "npm:^12.0.1"
remark-preset-lint-consistent: "npm:^6.0.0"
remark-preset-lint-consistent: "npm:^6.0.1"
strtok3: "npm:^10.2.0"
token-types: "npm:^6.0.0"
ts-node: "npm:^10.9.2"
Expand Down Expand Up @@ -2548,13 +2542,6 @@ __metadata:
languageName: node
linkType: hard

"peek-readable@npm:^5.3.1":
version: 5.4.2
resolution: "peek-readable@npm:5.4.2"
checksum: 10c0/283d87d5e5f469b1a3f009faa9c1c736a55fd577947208f3834c59b3ca314ce0b2c05c490181feaebddfb8bb9c3245f9b6d44c2fc06ccaea60b9091bb48a0c90
languageName: node
linkType: hard

"peek-readable@npm:^6.1.0":
version: 6.1.0
resolution: "peek-readable@npm:6.1.0"
Expand Down Expand Up @@ -2889,9 +2876,9 @@ __metadata:
languageName: node
linkType: hard

"remark-preset-lint-consistent@npm:^6.0.0":
version: 6.0.0
resolution: "remark-preset-lint-consistent@npm:6.0.0"
"remark-preset-lint-consistent@npm:^6.0.1":
version: 6.0.1
resolution: "remark-preset-lint-consistent@npm:6.0.1"
dependencies:
remark-lint: "npm:^10.0.0"
remark-lint-blockquote-indentation: "npm:^4.0.0"
Expand All @@ -2908,7 +2895,7 @@ __metadata:
remark-lint-strong-marker: "npm:^4.0.0"
remark-lint-table-cell-padding: "npm:^5.0.0"
unified: "npm:^11.0.0"
checksum: 10c0/f20064bc2dab161fa463a82186b107ac9596cf9e8c308e6cf41de94a5039fe601498de7cff8dc74459d0f0a4247424cc1398407fe2f7404dfebb9e6dd2c62180
checksum: 10c0/08755494b4097cc11c3f8f354346f8b9319aacdef91c877f19a6ca2722b4de59d636d859bdb129d3a16eb50a7bf594ad3215d560c9063452da28a09d37c2cc37
languageName: node
linkType: hard

Expand Down Expand Up @@ -3189,16 +3176,6 @@ __metadata:
languageName: node
linkType: hard

"strtok3@npm:^9.0.1":
version: 9.1.1
resolution: "strtok3@npm:9.1.1"
dependencies:
"@tokenizer/token": "npm:^0.3.0"
peek-readable: "npm:^5.3.1"
checksum: 10c0/ef9cd2a6cd21aec368c7f6fbd1d93548adc2c5b69ee28fa9a4b4e8fb6be6e539f3fcdf21107196e0c3fdff1c433db7e5d0fb8cab132c0b013ed9eef220bdcf2f
languageName: node
linkType: hard

"supports-color@npm:^5.3.0":
version: 5.5.0
resolution: "supports-color@npm:5.5.0"
Expand Down Expand Up @@ -3363,7 +3340,7 @@ __metadata:
languageName: node
linkType: hard

"uint8array-extras@npm:^1.3.0, uint8array-extras@npm:^1.4.0":
"uint8array-extras@npm:^1.4.0":
version: 1.4.0
resolution: "uint8array-extras@npm:1.4.0"
checksum: 10c0/eaffd3388634b7e5e1496073b878dd19136043137d3e7e0d2a453e37f566a5a551e640819e1a6596c6df9b9d1f7b70884cc29db6a357bdd424811f3598d504dd
Expand Down
Loading