diff --git a/src/picker/components/Picker/Picker.js b/src/picker/components/Picker/Picker.js index a13bace..ebc13a7 100644 --- a/src/picker/components/Picker/Picker.js +++ b/src/picker/components/Picker/Picker.js @@ -197,7 +197,7 @@ export function createRoot (shadowRoot, props) { // mount logic if (!state.emojiVersion) { detectEmojiSupportLevel().then(level => { - // Can't actually test emoji support in Jest/JSDom, emoji never render in color in Cairo + // Can't actually test emoji support in Jest/Vitest/JSDom, emoji never render in color in Cairo /* istanbul ignore next */ if (!level) { state.message = state.i18n.emojiUnsupportedMessage @@ -312,7 +312,7 @@ export function createRoot (shadowRoot, props) { const { database } = state const favs = (await Promise.all(MOST_COMMONLY_USED_EMOJI.map(unicode => ( database.getEmojiByUnicodeOrName(unicode) - )))).filter(Boolean) // filter because in Jest tests we don't have all the emoji in the DB + )))).filter(Boolean) // filter because in Jest/Vitest tests we don't have all the emoji in the DB state.defaultFavoriteEmojis = favs } diff --git a/src/picker/utils/testColorEmojiSupported.js b/src/picker/utils/testColorEmojiSupported.js index 784365b..6346423 100644 --- a/src/picker/utils/testColorEmojiSupported.js +++ b/src/picker/utils/testColorEmojiSupported.js @@ -8,7 +8,7 @@ import { FONT_FAMILY } from '../constants' import { versionsAndTestEmoji } from '../../../bin/versionsAndTestEmoji' -// only used in jest tests +// only used in jest/vitest tests let simulateCanvasError = false export function setSimulateCanvasError (value) { simulateCanvasError = value @@ -51,7 +51,7 @@ export function testColorEmojiSupported (text) { .map(([emoji]) => emoji) .includes(text) } - return true // avoid using canvas in jest + return true // avoid using canvas in jest/vitest } // Render white and black and then compare them to each other and ensure they're the same // color, and neither one is black. This shows that the emoji was rendered in color. diff --git a/src/picker/utils/widthCalculator.js b/src/picker/utils/widthCalculator.js index c96cfe3..12ccad9 100644 --- a/src/picker/utils/widthCalculator.js +++ b/src/picker/utils/widthCalculator.js @@ -6,7 +6,7 @@ import { requestAnimationFrame } from './requestAnimationFrame' export let resizeObserverSupported = typeof ResizeObserver === 'function' -// only used in jest tests +// only used in jest/vitest tests export const resetResizeObserverSupported = () => { resizeObserverSupported = typeof ResizeObserver === 'function' } diff --git a/test/spec/picker/errors.test.js b/test/spec/picker/errors.test.js index f626d99..32cff57 100644 --- a/test/spec/picker/errors.test.js +++ b/test/spec/picker/errors.test.js @@ -19,7 +19,6 @@ describe('errors', () => { await tick(40) }) - // seems not possible to do test('throws error when setting the database', async () => { const picker = new Picker({ dataSource: ALL_EMOJI, locale: 'en' }) document.body.appendChild(picker) @@ -32,7 +31,6 @@ describe('errors', () => { await tick(20) }) - // can't seem to get jest to ignore these expected errors test('offline shows an error', async () => { const dataSource = 'error.json'