test: fix vitest
This commit is contained in:
parent
f6830885d7
commit
3b30ee3130
1 changed files with 5 additions and 0 deletions
|
@ -23,6 +23,11 @@ import { WorkerMultiDispatch } from '@/scripts/worker-multi-dispatch';
|
||||||
import { extractAvgColorFromBlurhash } from '@/scripts/extract-avg-color-from-blurhash';
|
import { extractAvgColorFromBlurhash } from '@/scripts/extract-avg-color-from-blurhash';
|
||||||
|
|
||||||
const workerPromise = new Promise<WorkerMultiDispatch | null>(resolve => {
|
const workerPromise = new Promise<WorkerMultiDispatch | null>(resolve => {
|
||||||
|
// テスト環境で Web Worker インスタンスは作成できない
|
||||||
|
if (import.meta.env.MODE === 'test') {
|
||||||
|
resolve(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const testWorker = new TestWebGL2();
|
const testWorker = new TestWebGL2();
|
||||||
testWorker.addEventListener('message', event => {
|
testWorker.addEventListener('message', event => {
|
||||||
if (event.data.result) {
|
if (event.data.result) {
|
||||||
|
|
Loading…
Reference in a new issue