Skip to content

Commit

Permalink
fix: ESM only import issue chalk v5, use v4 (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes authored Apr 5, 2024
1 parent c4f3382 commit 5abe73a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 87 deletions.
89 changes: 9 additions & 80 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@next/env": "^14.1.4",
"@paralleldrive/cuid2": "^2.2.2",
"@vercel/blob": "^0.22.1",
"chalk": "^5.3.0",
"chalk": "^4.1.2",
"chokidar": "^3.6.0",
"magicast": "^0.3.3",
"symlink-dir": "^5.2.1",
Expand Down
8 changes: 5 additions & 3 deletions tests/components/video-loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { test, mock } from 'node:test';
import { defaultLoader, createVideoRequest } from '../../src/components/video-loader.js';

test('createVideoRequest', async () => {
const globalFetch = global.fetch;

mock.method(global, 'fetch', () => {
// @ts-ignore
global.fetch = () => {
return { ok: true, status: 200, json: async () => ({ status: 'ready' }) };
});
};

const loader = ({ config, src, width, height }: any) => {
config.path = 'https://example.com/api/video';
Expand All @@ -21,5 +23,5 @@ test('createVideoRequest', async () => {
const request = createVideoRequest(loader, props, callback);
await request(new AbortController().signal);

mock.reset();
global.fetch = globalFetch;
});
9 changes: 6 additions & 3 deletions tests/components/video.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ test('renders mux-player with string source', async () => {

let count = 0;

mock.method(global, 'fetch', async () => {
const globalFetch = global.fetch;

// @ts-ignore
global.fetch = () => {
return {
ok: true,
status: 200,
Expand All @@ -77,7 +80,7 @@ test('renders mux-player with string source', async () => {
};
}
};
});
};

const wrapper = create(<Video src="https://storage.googleapis.com/muxdemofiles/mux.mp4" />);

Expand All @@ -92,5 +95,5 @@ test('renders mux-player with string source', async () => {
'https://stream.mux.com/jxEf6XiJs6JY017pSzpv8Hd6tTbdAOecHTq4FiFAn564.m3u8'
);

mock.reset();
global.fetch = globalFetch;
});

0 comments on commit 5abe73a

Please sign in to comment.