diff --git a/.eslintignore b/.eslintignore index fb70fdac0..408c46c34 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,4 +2,5 @@ node_modules/ dist/ build/ -__typetests__/ \ No newline at end of file +__typetests__/ +packages_deprecated/ \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index 3687048a3..853e054b7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -35,11 +35,14 @@ { "files": [ "packages/jest-helpers/**/*.ts{x,}", - "**/__tests__/**/*.ts{x,}" + "**/__tests__/**/*.ts{x,}", + "vitest.setup.ts", + "*.config.ts" ], "rules": { "import/no-extraneous-dependencies": "off", - "react/jsx-key": "off" + "react/jsx-key": "off", + "import/no-relative-packages": "off" } } ] diff --git a/.github/renovate.json b/.github/renovate.json index 4fe316691..0bd3e1960 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -15,6 +15,7 @@ "reviewersSampleSize": 2, "semanticCommitScope": "deps", "semanticCommitType": "chore", + "ignorePaths": ["packages_deprecated/**/package.json"], "packageRules": [ { "matchDepTypes": ["engines", "peerDependencies"], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf83ca6ac..623d4bf1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,10 @@ jobs: - run: pnpm run build - run: pnpm run test:coverage - uses: codecov/codecov-action@v4.3.0 + with: + files: packages/**/coverage/cobertura-coverage.xml + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true test-types: runs-on: ubuntu-22.04 diff --git a/.gitignore b/.gitignore index 7b475ad48..2a09aaa78 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,13 @@ yarn-debug.log* yarn-error.log* *.log +# turbo +packages/*/.turbo +packages/*/dist +#vite +vite.config.ts.* +vitest.config.ts.* # Yalc yalc.lock diff --git a/package.json b/package.json index 3880dee6f..b94944985 100644 --- a/package.json +++ b/package.json @@ -21,26 +21,23 @@ "@changesets/cli": "2.27.1", "@commitlint/cli": "19.2.2", "@commitlint/config-conventional": "19.2.2", - "@jest/globals": "29.7.0", "@scaleway/eslint-config-react": "workspace:*", "@scaleway/tsconfig": "workspace:*", "@testing-library/jest-dom": "6.4.2", "@testing-library/react": "15.0.2", "@types/jest": "29.5.12", "@types/node": "20.12.7", - "@types/react-dom": "18.2.25", "@types/react": "18.2.79", + "@types/react-dom": "18.2.25", "@vitejs/plugin-react": "4.2.1", + "@vitest/coverage-istanbul": "^1.5.1", "browserslist": "4.23.0", "builtin-modules": "3.3.0", "cross-env": "7.0.3", "esbuild-plugin-browserslist": "0.11.1", "eslint": "8.57.0", + "happy-dom": "^14.7.1", "husky": "9.0.11", - "jest-environment-jsdom": "29.7.0", - "jest-junit": "16.0.0", - "jest-localstorage-mock": "2.4.26", - "jest": "29.7.0", "lint-staged": "15.2.2", "mockdate": "3.0.5", "prettier": "3.2.5", @@ -48,6 +45,8 @@ "tstyche": "1.1.0 ", "typescript": "5.4.5", "vite": "5.2.10", + "vitest": "1.5.0", + "vitest-localstorage-mock": "0.1.2", "wait-for-expect": "3.0.2" }, "scripts": { @@ -56,8 +55,7 @@ "build": "pnpm recursive run build", "commit": "npx git-cz -a", "format": "prettier --write '**/*.{ts,tsx,js,json,md,mdx}'", - "test": "TZ=UTC jest", - "test:watch": "pnpm run test --watch", + "test": "pnpm recursive run test:unit", "test:coverage": "pnpm run test --coverage", "test:types": "tstyche", "release": "pnpm build && pnpm changeset publish", diff --git a/packages/changesets-renovate/__mocks__/simple-git.ts b/packages/changesets-renovate/__mocks__/simple-git.ts new file mode 100644 index 000000000..b5b51bedf --- /dev/null +++ b/packages/changesets-renovate/__mocks__/simple-git.ts @@ -0,0 +1,20 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { vi } from 'vitest' + +export const defaultGitValues = { + branch: () => ({ + current: '', + }), + show: () => {}, + diffSummary: () => {}, + revparse: () => {}, + add: () => {}, + commit: () => {}, + push: () => {}, +} + +export const mockSimpleGit = vi.fn(() => defaultGitValues) + +const simpleGit = () => mockSimpleGit() + +export { simpleGit } diff --git a/packages/changesets-renovate/package.json b/packages/changesets-renovate/package.json index e8b266c16..4b5e8ef88 100644 --- a/packages/changesets-renovate/package.json +++ b/packages/changesets-renovate/package.json @@ -29,7 +29,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/changesets-renovate/src/__tests__/__snapshots__/generate-changeset.test.ts.snap b/packages/changesets-renovate/src/__tests__/__snapshots__/generate-changeset.test.ts.snap new file mode 100644 index 000000000..7bac09101 --- /dev/null +++ b/packages/changesets-renovate/src/__tests__/__snapshots__/generate-changeset.test.ts.snap @@ -0,0 +1,47 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`generate changeset file > should generate changeset file, but skip commit and push 1`] = ` +[MockFunction spy] { + "calls": [ + [ + ".changeset/renovate-test.md", + "--- +'packageName': patch +--- + +Updated dependency \`package\` to \`version\`. +Updated dependency \`package2\` to \`version2\`. +", + ], + ], + "results": [ + { + "type": "return", + "value": undefined, + }, + ], +} +`; + +exports[`generate changeset file > should generate changeset file, commit and push 1`] = ` +[MockFunction spy] { + "calls": [ + [ + ".changeset/renovate-test.md", + "--- +'packageName': patch +--- + +Updated dependency \`package\` to \`version\`. +Updated dependency \`package2\` to \`version2\`. +", + ], + ], + "results": [ + { + "type": "return", + "value": undefined, + }, + ], +} +`; diff --git a/packages/changesets-renovate/src/__tests__/generate-changeset.ts b/packages/changesets-renovate/src/__tests__/generate-changeset.test.ts similarity index 79% rename from packages/changesets-renovate/src/__tests__/generate-changeset.ts rename to packages/changesets-renovate/src/__tests__/generate-changeset.test.ts index 6dc4171c6..c6fb131f3 100644 --- a/packages/changesets-renovate/src/__tests__/generate-changeset.ts +++ b/packages/changesets-renovate/src/__tests__/generate-changeset.test.ts @@ -1,32 +1,23 @@ -import { - afterEach, - beforeEach, - describe, - expect, - it, - jest, -} from '@jest/globals' import fs from 'node:fs/promises' -import { simpleGit } from 'simple-git' +import { beforeEach, describe, expect, it, vi } from 'vitest' import { run } from '..' +import { defaultGitValues, mockSimpleGit } from '../../__mocks__/simple-git' -jest.mock('simple-git') -jest.mock('node:fs/promises') +vi.mock('node:fs/promises') beforeEach(() => { - jest.spyOn(console, 'log') -}) - -afterEach(() => { - jest.resetAllMocks() + vi.spyOn(console, 'log') }) describe('generate changeset file', () => { it('should skip if not in renovate branch', async () => { - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ + ...defaultGitValues, branch: () => ({ current: 'main', }), + show: () => undefined, + diffSummary: () => undefined, }) await run() @@ -35,7 +26,8 @@ describe('generate changeset file', () => { }) it('should skip if .changeset is already modified', async () => { - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ + ...defaultGitValues, branch: () => ({ current: 'renovate/test', }), @@ -46,6 +38,7 @@ describe('generate changeset file', () => { }, ], }), + show: () => undefined, }) await run() @@ -56,13 +49,15 @@ describe('generate changeset file', () => { }) it('should skip no package.json files have been modified', async () => { - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ + ...defaultGitValues, branch: () => ({ current: 'renovate/test', }), diffSummary: () => ({ files: [], }), + show: () => undefined, }) await run() @@ -76,12 +71,12 @@ describe('generate changeset file', () => { const rev = 'test' const fileName = `.changeset/renovate-${rev}.md` const file = 'test/package.json' - const revparse = jest.fn().mockReturnValue(rev) - const add = jest.fn() - const commit = jest.fn() - const push = jest.fn() + const revparse = vi.fn().mockReturnValue(rev) + const add = vi.fn() + const commit = vi.fn() + const push = vi.fn() - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ branch: () => ({ current: 'renovate/test', }), @@ -102,11 +97,11 @@ describe('generate changeset file', () => { push, }) - fs.readFile = jest - .fn() + fs.readFile = vi + .fn() .mockResolvedValueOnce(`{}`) .mockResolvedValueOnce(`{"name":"packageName","version":"1.0.0"}`) - fs.writeFile = jest.fn() + fs.writeFile = vi.fn() await run() @@ -121,12 +116,12 @@ describe('generate changeset file', () => { const rev = 'test' const fileName = `.changeset/renovate-${rev}.md` const file = 'test/package.json' - const revparse = jest.fn().mockReturnValue(rev) - const add = jest.fn() - const commit = jest.fn() - const push = jest.fn() + const revparse = vi.fn().mockReturnValue(rev) + const add = vi.fn() + const commit = vi.fn() + const push = vi.fn() - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ branch: () => ({ current: 'renovate/test', }), @@ -147,11 +142,11 @@ describe('generate changeset file', () => { push, }) - fs.readFile = jest - .fn() + fs.readFile = vi + .fn() .mockResolvedValueOnce(`{}`) .mockResolvedValueOnce(`{"name":"packageName","version":"1.0.0"}`) - fs.writeFile = jest.fn() + fs.writeFile = vi.fn() process.env['SKIP_COMMIT'] = 'TRUE' await run() @@ -168,7 +163,8 @@ describe('generate changeset file', () => { it('should ignore workspace package.json', async () => { const file = 'package.json' - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ + ...defaultGitValues, branch: () => ({ current: 'renovate/test', }), @@ -185,11 +181,11 @@ describe('generate changeset file', () => { `, }) - fs.readFile = jest - .fn() + fs.readFile = vi + .fn() .mockResolvedValueOnce(`{}`) .mockResolvedValueOnce(`{"name":"packageName","workspaces":[]}`) - fs.writeFile = jest.fn() + fs.writeFile = vi.fn() await run() @@ -200,7 +196,8 @@ describe('generate changeset file', () => { it('should ignore version package.json', async () => { const file = 'package.json' - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ + ...defaultGitValues, branch: () => ({ current: 'renovate/test', }), @@ -217,11 +214,11 @@ describe('generate changeset file', () => { `, }) - fs.readFile = jest - .fn() + fs.readFile = vi + .fn() .mockResolvedValueOnce(`{}`) .mockResolvedValueOnce(`{"name":"packageName"}`) - fs.writeFile = jest.fn() + fs.writeFile = vi.fn() await run() @@ -232,7 +229,8 @@ describe('generate changeset file', () => { it('should ignore changeset ignored packages', async () => { const file = 'test/package.json' - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ + ...defaultGitValues, branch: () => ({ current: 'renovate/test', }), @@ -249,11 +247,11 @@ describe('generate changeset file', () => { `, }) - fs.readFile = jest - .fn() + fs.readFile = vi + .fn() .mockResolvedValueOnce(`{"ignore":["packageName"]}`) .mockResolvedValueOnce(`{"name":"packageName","version":"1.0.0"}`) - fs.writeFile = jest.fn() + fs.writeFile = vi.fn() await run() @@ -264,7 +262,8 @@ describe('generate changeset file', () => { it('should ignore changeset ignored packages with star', async () => { const file = 'test/package.json' - ;(simpleGit as jest.Mock).mockReturnValue({ + mockSimpleGit.mockReturnValue({ + ...defaultGitValues, branch: () => ({ current: 'renovate/test', }), @@ -281,11 +280,11 @@ describe('generate changeset file', () => { `, }) - fs.readFile = jest - .fn() + fs.readFile = vi + .fn() .mockResolvedValueOnce(`{"ignore":["@example/*"]}`) .mockResolvedValueOnce(`{"name":"@example/test","version":"1.0.0"}`) - fs.writeFile = jest.fn() + fs.writeFile = vi.fn() await run() diff --git a/packages/changesets-renovate/src/index.ts b/packages/changesets-renovate/src/index.ts index ddff67d10..98d9e9244 100644 --- a/packages/changesets-renovate/src/index.ts +++ b/packages/changesets-renovate/src/index.ts @@ -3,6 +3,8 @@ import fs from 'node:fs/promises' import { simpleGit } from 'simple-git' +console.debug('simpleGit', simpleGit) + async function getChangesetIgnoredPackages(): Promise { const changesetConfig = JSON.parse( await fs.readFile('.changeset/config.json', 'utf8'), diff --git a/packages/changesets-renovate/vite.config.ts b/packages/changesets-renovate/vite.config.ts index 316338abd..ebb3d2ce2 100644 --- a/packages/changesets-renovate/vite.config.ts +++ b/packages/changesets-renovate/vite.config.ts @@ -1,6 +1,3 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' @@ -8,4 +5,7 @@ export default mergeConfig(defineConfig(defaultConfig), { build: { target: ['node20'], }, + test: { + setupFiles: ['./vitest.setup.ts'], + }, }) diff --git a/packages/changesets-renovate/vitest.setup.ts b/packages/changesets-renovate/vitest.setup.ts new file mode 100644 index 000000000..f8eccd3e0 --- /dev/null +++ b/packages/changesets-renovate/vitest.setup.ts @@ -0,0 +1,3 @@ +import { vi } from 'vitest' + +vi.mock('simple-git') diff --git a/packages/cookie-consent/package.json b/packages/cookie-consent/package.json index 43303a168..4b149c0d8 100644 --- a/packages/cookie-consent/package.json +++ b/packages/cookie-consent/package.json @@ -20,7 +20,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "keywords": [ "react", diff --git a/packages/cookie-consent/src/CookieConsentProvider/__tests__/index.tsx b/packages/cookie-consent/src/CookieConsentProvider/__tests__/index.test.tsx similarity index 91% rename from packages/cookie-consent/src/CookieConsentProvider/__tests__/index.tsx rename to packages/cookie-consent/src/CookieConsentProvider/__tests__/index.test.tsx index 416d40d1c..b6684d604 100644 --- a/packages/cookie-consent/src/CookieConsentProvider/__tests__/index.tsx +++ b/packages/cookie-consent/src/CookieConsentProvider/__tests__/index.test.tsx @@ -1,8 +1,8 @@ -// useSegmentIntegrations tests have been splitted in multiple files because of https://github.com/facebook/jest/issues/8987 -import { describe, expect, it, jest } from '@jest/globals' +// useSegmentIntegrations tests have been splitted in multiple files because of https://github.com/facebook/vi/issues/8987 import { act, renderHook } from '@testing-library/react' import cookie from 'cookie' import type { ComponentProps, ReactNode } from 'react' +import { describe, expect, it, vi } from 'vitest' import { CookieConsentProvider, useCookieConsent } from '..' import type { Integrations } from '../types' import type { useSegmentIntegrations } from '../useSegmentIntegrations' @@ -44,28 +44,21 @@ const integrations: Integrations = [ }, ] -const mockUseSegmentIntegrations = jest.fn< - () => ReturnType +const mockUseSegmentIntegrations = vi.fn< + [], + ReturnType >(() => ({ integrations, isLoaded: true, })) -jest.mock('../useSegmentIntegrations', () => ({ +vi.mock('../useSegmentIntegrations', () => ({ useSegmentIntegrations: () => mockUseSegmentIntegrations(), })) describe('CookieConsent - CookieConsentProvider', () => { - beforeEach(() => { - jest.clearAllMocks() - }) - - afterAll(() => { - jest.restoreAllMocks() - }) - it('useCookieConsent should throw without provider', () => { - const spy = jest.spyOn(console, 'error') + const spy = vi.spyOn(console, 'error') spy.mockImplementation(() => {}) expect(() => renderHook(() => useCookieConsent())).toThrow( @@ -133,7 +126,7 @@ describe('CookieConsent - CookieConsentProvider', () => { }) it('should save consent correctly', () => { - const spy = jest.spyOn(cookie, 'serialize') + const spy = vi.spyOn(cookie, 'serialize') const { result } = renderHook(() => useCookieConsent(), { wrapper: wrapper({ isConsentRequired: true, @@ -201,9 +194,9 @@ describe('CookieConsent - CookieConsentProvider', () => { }) it('should not need consent if hash cookie is set', () => { - jest - .spyOn(cookie, 'parse') - .mockImplementation(() => ({ _scw_rgpd_hash: '913003917' })) + vi.spyOn(cookie, 'parse').mockImplementation(() => ({ + _scw_rgpd_hash: '913003917', + })) const { result } = renderHook(() => useCookieConsent(), { wrapper: wrapper({ isConsentRequired: true, @@ -224,7 +217,7 @@ describe('CookieConsent - CookieConsentProvider', () => { }) it('should not need consent if hash cookie is set and some categories already approved', () => { - jest.spyOn(cookie, 'parse').mockImplementation(() => ({ + vi.spyOn(cookie, 'parse').mockImplementation(() => ({ _scw_rgpd_hash: '913003917', _scw_rgpd_marketing: 'true', })) diff --git a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/emptyConfig.tsx b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/emptyConfig.test.tsx similarity index 90% rename from packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/emptyConfig.tsx rename to packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/emptyConfig.test.tsx index b1c349b9f..e76a29998 100644 --- a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/emptyConfig.tsx +++ b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/emptyConfig.test.tsx @@ -1,5 +1,5 @@ -import { describe, expect, it } from '@jest/globals' import { renderHook, waitFor } from '@testing-library/react' +import { describe, expect, it } from 'vitest' import { useSegmentIntegrations } from '../../useSegmentIntegrations' describe('CookieConsent - useSegmentIntegrations', () => { diff --git a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/fetchError.tsx b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/fetchError.test.tsx similarity index 83% rename from packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/fetchError.tsx rename to packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/fetchError.test.tsx index 79e92bd5c..c9eb2d504 100644 --- a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/fetchError.tsx +++ b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/fetchError.test.tsx @@ -1,8 +1,10 @@ -import { describe, expect, it, jest } from '@jest/globals' import { renderHook, waitFor } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' import { useSegmentIntegrations } from '../../useSegmentIntegrations' -globalThis.fetch = jest.fn(() => Promise.resolve({ ok: false })) +globalThis.fetch = vi.fn(() => + Promise.resolve({ ok: false } as unknown as Response), +) describe('CookieConsent - useSegmentIntegrations', () => { it('should call segment and return empty array if any error occurs in the response', async () => { diff --git a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/networkError.tsx b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/networkError.test.tsx similarity index 83% rename from packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/networkError.tsx rename to packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/networkError.test.tsx index 412cee30e..f0f391067 100644 --- a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/networkError.tsx +++ b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/networkError.test.tsx @@ -1,8 +1,8 @@ -import { describe, expect, it, jest } from '@jest/globals' import { renderHook, waitFor } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' import { useSegmentIntegrations } from '../../useSegmentIntegrations' -globalThis.fetch = jest.fn(() => Promise.reject(new Error('randomError'))) +globalThis.fetch = vi.fn(() => Promise.reject(new Error('randomError'))) describe('CookieConsent - useSegmentIntegrations', () => { it('should call segment and return empty array if any error occurs in the fetch', async () => { diff --git a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.tsx b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.test.tsx similarity index 97% rename from packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.tsx rename to packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.test.tsx index 431380fcc..5d29689c5 100644 --- a/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.tsx +++ b/packages/cookie-consent/src/CookieConsentProvider/__tests__/useSegmentIntegrations/working.test.tsx @@ -1,8 +1,8 @@ -import { describe, expect, it, jest } from '@jest/globals' import { renderHook, waitFor } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' import { useSegmentIntegrations } from '../../useSegmentIntegrations' -globalThis.fetch = jest.fn(() => +globalThis.fetch = vi.fn(() => Promise.resolve({ ok: true, json: () => @@ -53,7 +53,7 @@ globalThis.fetch = jest.fn(() => category: 'Analytics', }, ]), - }), + } as unknown as Response), ) describe('CookieConsent - useSegmentIntegrations', () => { diff --git a/packages/cookie-consent/vite.config.ts b/packages/cookie-consent/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/cookie-consent/vite.config.ts +++ b/packages/cookie-consent/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/cookie-consent/vitest.setup.ts b/packages/cookie-consent/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/cookie-consent/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/jest-helpers/tsconfig.build.json b/packages/jest-helpers/tsconfig.build.json deleted file mode 100644 index 744c16721..000000000 --- a/packages/jest-helpers/tsconfig.build.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": false, - "emitDeclarationOnly": true, - "rootDir": "src", - "outDir": "dist" - }, - "exclude": [ - "*.config.ts", - "*.setup.ts", - "**/__tests__", - "**/__mocks__", - "src/**/*.test.tsx" - ] -} diff --git a/packages/jest-helpers/vite.config.ts b/packages/jest-helpers/vite.config.ts deleted file mode 100644 index d742859e6..000000000 --- a/packages/jest-helpers/vite.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ -/* eslint-disable-next-line import/no-extraneous-dependencies */ -import { defineConfig, mergeConfig } from 'vite' -import { defaultConfig } from '../../vite.config' - -export default mergeConfig(defineConfig(defaultConfig), { - build: { - target: ['node20'], - }, -}) diff --git a/packages/outdated-browser/package.json b/packages/outdated-browser/package.json index 87b7be192..1c19468c5 100644 --- a/packages/outdated-browser/package.json +++ b/packages/outdated-browser/package.json @@ -21,7 +21,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/outdated-browser/src/__tests__/__snapshots__/index.test.ts.snap b/packages/outdated-browser/src/__tests__/__snapshots__/index.test.ts.snap new file mode 100644 index 000000000..f85c323cc --- /dev/null +++ b/packages/outdated-browser/src/__tests__/__snapshots__/index.test.ts.snap @@ -0,0 +1,67 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`@outdated-browser > render banner if SUPPORTED_BROWSER is defined and does not match userAgent 1`] = ` +"
+ + + + + + +
+

Your web browser is out of date. This might results in unexpected behavior.

+

Update your browser for a better user experience.

+
+ +
" +`; + +exports[`@outdated-browser > render nothing if SUPPORTED_BROWSER is defined and does not match userAgent and user click on button 1`] = `""`; + +exports[`@outdated-browser > render nothing if SUPPORTED_BROWSER is defined and does not match userAgent and user has already ignored banner 1`] = `""`; + +exports[`@outdated-browser > render nothing if SUPPORTED_BROWSER is defined and match userAgent 1`] = `""`; + +exports[`@outdated-browser > render nothing if SUPPORTED_BROWSER is nil 1`] = `""`; diff --git a/packages/outdated-browser/src/__tests__/index.ts b/packages/outdated-browser/src/__tests__/index.test.ts similarity index 93% rename from packages/outdated-browser/src/__tests__/index.ts rename to packages/outdated-browser/src/__tests__/index.test.ts index 51f13ff5d..c0fb1dd43 100644 --- a/packages/outdated-browser/src/__tests__/index.ts +++ b/packages/outdated-browser/src/__tests__/index.test.ts @@ -1,15 +1,7 @@ -import { - afterEach, - beforeAll, - describe, - expect, - jest, - test, -} from '@jest/globals' - /** - * @jest-environment jsdom + * @vitest-environment jsdom */ +import { afterEach, beforeAll, describe, expect, test, vi } from 'vitest' const localStorageMock = (() => { let store: Record = {} @@ -47,8 +39,8 @@ describe('@outdated-browser', () => { }) afterEach(() => { - jest.resetModules() - jest.restoreAllMocks() + vi.resetModules() + vi.restoreAllMocks() sessionStorage.clear() // Clear dom for next test const htmlDocument = document.getElementsByTagName('html')[0] diff --git a/packages/outdated-browser/vite.config.ts b/packages/outdated-browser/vite.config.ts index a915b0170..4a9ad33f5 100644 --- a/packages/outdated-browser/vite.config.ts +++ b/packages/outdated-browser/vite.config.ts @@ -1,7 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + // environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/outdated-browser/vitest.setup.ts b/packages/outdated-browser/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/outdated-browser/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/random-name/package.json b/packages/random-name/package.json index bb52158b7..bd9b4f7a0 100644 --- a/packages/random-name/package.json +++ b/packages/random-name/package.json @@ -24,7 +24,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/random-name/src/__tests__/index.ts b/packages/random-name/src/__tests__/index.test.ts similarity index 94% rename from packages/random-name/src/__tests__/index.ts rename to packages/random-name/src/__tests__/index.test.ts index 33ceea3af..3dd816aba 100644 --- a/packages/random-name/src/__tests__/index.ts +++ b/packages/random-name/src/__tests__/index.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from '@jest/globals' +import { describe, expect, it } from 'vitest' import randomName from '..' describe('randomName', () => { diff --git a/packages/random-name/vite.config.ts b/packages/random-name/vite.config.ts index c1e5bf22e..3471083c8 100644 --- a/packages/random-name/vite.config.ts +++ b/packages/random-name/vite.config.ts @@ -9,4 +9,8 @@ export default mergeConfig(defineConfig(defaultConfig), { formats: ['es', 'cjs'], }, }, + // test: { + // environment: 'jsdom', + // setupFiles: ['./vitest.setup.ts'], + // }, }) diff --git a/packages/regex/package.json b/packages/regex/package.json index 5b085634c..751e1d24a 100644 --- a/packages/regex/package.json +++ b/packages/regex/package.json @@ -24,7 +24,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/regex/src/__tests__/index.ts b/packages/regex/src/__tests__/index.test.ts similarity index 99% rename from packages/regex/src/__tests__/index.ts rename to packages/regex/src/__tests__/index.test.ts index d24df7fc3..af0298618 100644 --- a/packages/regex/src/__tests__/index.ts +++ b/packages/regex/src/__tests__/index.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from '@jest/globals' +import { describe, expect, test } from 'vitest' import { absoluteLinuxPath, absolutePath, diff --git a/packages/regex/vite.config.ts b/packages/regex/vite.config.ts index d742859e6..432a4e771 100644 --- a/packages/regex/vite.config.ts +++ b/packages/regex/vite.config.ts @@ -1,6 +1,3 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ -/* eslint-disable-next-line import/no-extraneous-dependencies */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' diff --git a/packages/use-dataloader/package.json b/packages/use-dataloader/package.json index d8fbfb53f..9e85276ff 100644 --- a/packages/use-dataloader/package.json +++ b/packages/use-dataloader/package.json @@ -24,7 +24,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/use-dataloader/src/__tests__/DataLoaderProvider.test.tsx b/packages/use-dataloader/src/__tests__/DataLoaderProvider.test.tsx index 7d2ff6e43..3ac8b2066 100644 --- a/packages/use-dataloader/src/__tests__/DataLoaderProvider.test.tsx +++ b/packages/use-dataloader/src/__tests__/DataLoaderProvider.test.tsx @@ -1,6 +1,6 @@ -import { describe, expect, jest, test } from '@jest/globals' import { render, renderHook, screen, waitFor } from '@testing-library/react' import type { ReactNode } from 'react' +import { describe, expect, test, vi } from 'vitest' import DataLoaderProvider, { useDataLoaderContext } from '../DataLoaderProvider' import { KEY_IS_NOT_STRING_ERROR, StatusEnum } from '../constants' @@ -39,7 +39,7 @@ describe('DataLoaderProvider', () => { }) test('should add request', async () => { - const method = jest.fn(fakePromise) + const method = vi.fn(fakePromise) const { result, rerender } = renderHook(useDataLoaderContext, { wrapper, }) @@ -81,7 +81,7 @@ describe('DataLoaderProvider', () => { }) test('should add request with cache key prefix', async () => { - const method = jest.fn(fakePromise) + const method = vi.fn(fakePromise) const { result } = renderHook(useDataLoaderContext, { wrapper: wrapperWithCacheKey, }) @@ -106,7 +106,7 @@ describe('DataLoaderProvider', () => { }) test('should add request with result is null', async () => { - const method = jest.fn(fakeNullPromise) + const method = vi.fn(fakeNullPromise) const { result } = renderHook(useDataLoaderContext, { wrapper, }) @@ -142,7 +142,7 @@ describe('DataLoaderProvider', () => { }) test('should add request with bad key', () => { - const method = jest.fn(fakePromise) + const method = vi.fn(fakePromise) const { result } = renderHook(useDataLoaderContext, { wrapper, }) @@ -157,7 +157,7 @@ describe('DataLoaderProvider', () => { }) test('should delay max concurrent request', async () => { - const method = jest.fn( + const method = vi.fn( () => new Promise(resolve => { setTimeout(() => resolve(true), 100) diff --git a/packages/use-dataloader/src/__tests__/dataloader.test.ts b/packages/use-dataloader/src/__tests__/dataloader.test.ts index 8709e5fff..053e89260 100644 --- a/packages/use-dataloader/src/__tests__/dataloader.test.ts +++ b/packages/use-dataloader/src/__tests__/dataloader.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, jest, test } from '@jest/globals' +import { describe, expect, test, vi } from 'vitest' import waitForExpect from 'wait-for-expect' import { StatusEnum } from '../constants' import DataLoader from '../dataloader' @@ -31,8 +31,8 @@ const fakeLongErrorPromise = () => describe('Dataloader class', () => { test('should create instance then load then destroy', async () => { - const method = jest.fn(fakeSuccessPromise) - const notifyChanges = jest.fn() + const method = vi.fn(fakeSuccessPromise) + const notifyChanges = vi.fn() const instance = new DataLoader({ key: 'test-destroy', method, @@ -46,8 +46,8 @@ describe('Dataloader class', () => { }) test('should create instance then load multiple times', async () => { - const method = jest.fn(fakeSuccessPromise) - const notifyChanges = jest.fn() + const method = vi.fn(fakeSuccessPromise) + const notifyChanges = vi.fn() const instance = new DataLoader({ key: 'test-load', method, @@ -67,8 +67,8 @@ describe('Dataloader class', () => { }) test('should create instance with cancel', () => { - const notify = jest.fn() - const method = jest.fn(fakeSuccessPromise) + const notify = vi.fn() + const method = vi.fn(fakeSuccessPromise) const instance = new DataLoader({ key: 'test-cancel', method, @@ -87,8 +87,8 @@ describe('Dataloader class', () => { }) test('should create instance without cancel', async () => { - const notify = jest.fn() - const method = jest.fn(fakeSuccessPromise) + const notify = vi.fn() + const method = vi.fn(fakeSuccessPromise) const instance = new DataLoader({ key: 'test-without-cancel', method, @@ -103,8 +103,8 @@ describe('Dataloader class', () => { }) test('should create instance with null data', async () => { - const method = jest.fn(fakeNullPromise) - const notifyChanges = jest.fn() + const method = vi.fn(fakeNullPromise) + const notifyChanges = vi.fn() const instance = new DataLoader({ key: 'test-null', method, @@ -115,8 +115,8 @@ describe('Dataloader class', () => { expect(instance.getData()).toBe(null) }) test('should create instance with undefined data', async () => { - const method = jest.fn(fakeUndefinedPromise) - const notifyChanges = jest.fn() + const method = vi.fn(fakeUndefinedPromise) + const notifyChanges = vi.fn() const instance = new DataLoader({ key: 'test-undefined', @@ -129,9 +129,9 @@ describe('Dataloader class', () => { }) test('should create instance with error', async () => { - const method = jest.fn(fakeErrorPromise) - const notifyChanges = jest.fn() - const onError = jest.fn() + const method = vi.fn(fakeErrorPromise) + const notifyChanges = vi.fn() + const onError = vi.fn() const instance = new DataLoader({ key: 'test-error', @@ -144,8 +144,8 @@ describe('Dataloader class', () => { }) test('should create instance with cancel', async () => { - const method = jest.fn(fakeSuccessPromise) - const notifyChanges = jest.fn() + const method = vi.fn(fakeSuccessPromise) + const notifyChanges = vi.fn() const instance = new DataLoader({ key: 'test-cancel', @@ -161,9 +161,9 @@ describe('Dataloader class', () => { }) test('should create instance with error and cancel', async () => { - const method = jest.fn(fakeLongErrorPromise) - const notifyChanges = jest.fn() - const onError = jest.fn() + const method = vi.fn(fakeLongErrorPromise) + const notifyChanges = vi.fn() + const onError = vi.fn() const instance = new DataLoader({ key: 'test-error-cancel', @@ -179,8 +179,8 @@ describe('Dataloader class', () => { }) test('should launch multiple dataloader', async () => { - const method = jest.fn(fakeErrorPromise) - const notifyChanges = jest.fn() + const method = vi.fn(fakeErrorPromise) + const notifyChanges = vi.fn() const instances = Array.from({ length: 5 }, (_, index) => index).map( index => diff --git a/packages/use-dataloader/src/__tests__/helpers.test.ts b/packages/use-dataloader/src/__tests__/helpers.test.ts index 10c106cf5..e3a462586 100644 --- a/packages/use-dataloader/src/__tests__/helpers.test.ts +++ b/packages/use-dataloader/src/__tests__/helpers.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from '@jest/globals' +import { describe, expect, test } from 'vitest' import { marshalQueryKey } from '../helpers' describe('marshalQueryKey', () => { diff --git a/packages/use-dataloader/src/__tests__/useDataLoader.test.tsx b/packages/use-dataloader/src/__tests__/useDataLoader.test.tsx index 21d5e5690..fde31fa91 100644 --- a/packages/use-dataloader/src/__tests__/useDataLoader.test.tsx +++ b/packages/use-dataloader/src/__tests__/useDataLoader.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable no-console */ -import { describe, expect, jest, test } from '@jest/globals' import { renderHook, waitFor } from '@testing-library/react' import type { ReactNode } from 'react' +import { describe, expect, test, vi } from 'vitest' import DataLoaderProvider, { useDataLoaderContext } from '../DataLoaderProvider' import type { KeyType, UseDataLoaderConfig } from '../types' import { useDataLoader } from '../useDataLoader' @@ -26,7 +26,7 @@ const initialProps = { keepPreviousData: true, }, key: 'test', - method: jest.fn(fakeSuccessPromise), + method: vi.fn(fakeSuccessPromise), } const wrapper = ({ children }: { children?: ReactNode }) => ( {children} @@ -70,17 +70,9 @@ describe('useDataLoader', () => { ['number', 10], ].flat() - const method = jest.fn( - () => - new Promise(resolve => { - setTimeout(() => resolve(true), PROMISE_TIMEOUT + 150) - }), - ) - const initProps = { ...initialProps, key, - method, } const { result, rerender } = renderHook( @@ -93,8 +85,9 @@ describe('useDataLoader', () => { expect(result.current.data).toBe(undefined) expect(result.current.isLoading).toBe(true) expect(result.current.previousData).toBe(undefined) - expect(initialProps.method).toBeCalledTimes(1) - await waitFor(() => expect(result.current.isSuccess).toBe(true)) + await waitFor(() => { + expect(result.current.isSuccess).toBe(true) + }) expect(initialProps.method).toBeCalledTimes(1) expect(result.current.data).toBe(true) expect(result.current.isLoading).toBe(false) @@ -109,12 +102,19 @@ describe('useDataLoader', () => { }) test('should render correctly without request enabled then enable it', async () => { - const method = jest.fn( - () => + let resolveIt = false + const method = vi.fn(() => { + const promiseFn = () => new Promise(resolve => { - setTimeout(() => resolve(true), PROMISE_TIMEOUT) - }), - ) + setInterval(() => { + if (resolveIt) { + resolve(true) + } + }, PROMISE_TIMEOUT) + }) + + return promiseFn() + }) const testProps = { config: { enabled: false, @@ -135,8 +135,9 @@ describe('useDataLoader', () => { testProps.config.enabled = true rerender({ ...testProps }) await waitFor(() => expect(result.current.isLoading).toBe(true)) - expect(method).toBeCalledTimes(1) expect(result.current.data).toBe(undefined) + resolveIt = true + expect(method).toBeCalledTimes(1) await waitFor(() => expect(result.current.isSuccess).toBe(true)) expect(result.current.isLoading).toBe(false) expect(result.current.previousData).toBe(undefined) @@ -187,6 +188,24 @@ describe('useDataLoader', () => { }) test('should render and cache correctly with cacheKeyPrefix', async () => { + let resolveIt = false + const method = vi.fn(() => { + const promiseFn = () => + new Promise(resolve => { + setInterval(() => { + if (resolveIt) { + resolve(true) + } + }, PROMISE_TIMEOUT) + }) + + return promiseFn() + }) + + const initProps = { + ...initialProps, + method, + } const { result } = renderHook( props => [ useDataLoader(props.key, props.method, props.config), @@ -196,21 +215,24 @@ describe('useDataLoader', () => { }), ], { - initialProps, + initialProps: initProps, wrapper: wrapperWithCacheKey, }, ) expect(result.current[0]?.data).toBe(undefined) expect(result.current[0]?.isLoading).toBe(true) + resolveIt = true expect(result.current[1]?.data).toBe(undefined) expect(result.current[1]?.isIdle).toBe(true) await waitFor(() => expect(result.current[0]?.isSuccess).toBe(true)) expect(result.current[0]?.data).toBe(true) - result.current[1]?.reload().catch(undefined) + resolveIt = false + result.current[1]?.reload().catch(() => null) await waitFor(() => expect(result.current[1]?.isLoading).toBe(true)) expect(result.current[1]?.data).toBe(undefined) + resolveIt = true await waitFor(() => expect(result.current[1]?.isSuccess).toBe(true)) expect(result.current[1]?.data).toBe(true) @@ -232,8 +254,8 @@ describe('useDataLoader', () => { await waitFor(() => expect(result.current.isSuccess).toBe(true)) expect(result.current.data).toBe(true) expect(result.current.isLoading).toBe(false) - result.current.reload().catch(undefined) - result.current.reload().catch(undefined) + result.current.reload().catch(() => null) + result.current.reload().catch(() => null) await waitFor(() => expect(result.current.isLoading).toBe(true)) expect(result.current.data).toBe(true) await waitFor(() => expect(result.current.isSuccess).toBe(true)) @@ -279,7 +301,7 @@ describe('useDataLoader', () => { pollingInterval: 1000, }, key: 'test-6', - method: jest.fn( + method: vi.fn( () => new Promise(resolve => { setTimeout(() => resolve(true), PROMISE_TIMEOUT) @@ -287,7 +309,7 @@ describe('useDataLoader', () => { ), } as UseDataLoaderHookProps - const method2 = jest.fn( + const method2 = vi.fn( () => new Promise(resolve => { setTimeout(() => resolve(2), PROMISE_TIMEOUT) @@ -361,7 +383,7 @@ describe('useDataLoader', () => { pollingInterval: undefined, }, key: 'test-needpolling-no-interval', - method: jest.fn( + method: vi.fn( () => new Promise(resolve => { setTimeout(() => resolve(true), PROMISE_TIMEOUT) @@ -391,7 +413,7 @@ describe('useDataLoader', () => { pollingInterval: 1000, }, key: 'test-needpolling-no-interval', - method: jest.fn( + method: vi.fn( () => new Promise(resolve => { setTimeout(() => resolve(true), PROMISE_TIMEOUT) @@ -422,7 +444,7 @@ describe('useDataLoader', () => { pollingInterval: PROMISE_TIMEOUT, }, key: 'test-needpolling-no-interval', - method: jest.fn( + method: vi.fn( () => new Promise(resolve => { setTimeout(() => resolve(true), PROMISE_TIMEOUT) @@ -453,7 +475,7 @@ describe('useDataLoader', () => { pollingInterval: PROMISE_TIMEOUT, }, key: 'test-needpolling-no-interval', - method: jest.fn( + method: vi.fn( () => new Promise(resolve => { setTimeout(() => resolve(true), PROMISE_TIMEOUT) @@ -479,11 +501,29 @@ describe('useDataLoader', () => { }) test('should render correctly with enabled off', async () => { + let resolveIt = false + const method = vi.fn(() => { + const promiseFn = () => + new Promise(resolve => { + setInterval(() => { + if (resolveIt) { + resolve(true) + } + }, PROMISE_TIMEOUT) + }) + + return promiseFn() + }) + + const initProps = { + ...initialProps, + method, + } const { result } = renderHook( props => useDataLoader(props.key, props.method, props.config), { initialProps: { - ...initialProps, + ...initProps, config: { enabled: false, }, @@ -494,15 +534,16 @@ describe('useDataLoader', () => { ) expect(result.current.data).toBe(undefined) expect(result.current.isIdle).toBe(true) - result.current.reload().catch(undefined) + result.current.reload().catch(() => null) await waitFor(() => expect(result.current.isLoading).toBe(true)) expect(result.current.data).toBe(undefined) + resolveIt = true await waitFor(() => expect(result.current.isSuccess).toBe(true)) expect(result.current.data).toBe(true) }) test('should call onSuccess', async () => { - const onSuccess = jest.fn() + const onSuccess = vi.fn() const { result } = renderHook( props => useDataLoader(props.key, props.method, props.config), { @@ -524,8 +565,8 @@ describe('useDataLoader', () => { }) test('should call onError', async () => { - const onSuccess = jest.fn() - const onError = jest.fn() + const onSuccess = vi.fn() + const onError = vi.fn() const error = new Error('Test error') const { result } = renderHook( props => useDataLoader(props.key, props.method, props.config), @@ -558,10 +599,10 @@ describe('useDataLoader', () => { }) test('should override onError from Provider', async () => { - const onSuccess = jest.fn() - const onError = jest.fn() + const onSuccess = vi.fn() + const onError = vi.fn() const error = new Error('Test error') - const onErrorProvider = jest.fn() + const onErrorProvider = vi.fn() const { result } = renderHook( props => useDataLoader(props.key, props.method, props.config), { @@ -594,9 +635,9 @@ describe('useDataLoader', () => { }) test('should call onError from Provider', async () => { - const onSuccess = jest.fn() + const onSuccess = vi.fn() const error = new Error('Test error') - const onErrorProvider = jest.fn() + const onErrorProvider = vi.fn() const { result } = renderHook( props => useDataLoader(props.key, props.method, props.config), { @@ -630,8 +671,8 @@ describe('useDataLoader', () => { test('should clear error on new response', async () => { let success = false - const onSuccess = jest.fn() - const onError = jest.fn(() => { + const onSuccess = vi.fn() + const onError = vi.fn(() => { success = true }) const error = new Error('Test error') @@ -668,7 +709,7 @@ describe('useDataLoader', () => { expect(onError).toBeCalledTimes(1) expect(onSuccess).toBeCalledTimes(0) - result.current.reload().catch(undefined) + result.current.reload().catch(() => null) await waitFor(() => expect(result.current.isSuccess).toBe(true)) expect(result.current.data).toBe(true) expect(result.current.error).toBe(undefined) @@ -676,7 +717,7 @@ describe('useDataLoader', () => { }) test('should use cached data', async () => { - const fakePromise = jest.fn(initialProps.method) + const fakePromise = vi.fn(initialProps.method) const testDate = new Date() const { result } = renderHook( props => [ @@ -711,7 +752,7 @@ describe('useDataLoader', () => { await waitFor(() => expect(result.current[0]?.isSuccess).toBe(true)) expect(result.current[0]?.data).toBe(true) - result.current[1]?.reload().catch(undefined) + result.current[1]?.reload().catch(() => null) await waitFor(() => expect(result.current[1]?.isLoading).toBe(true)) expect(result.current[1]?.data).toBe(true) @@ -724,7 +765,7 @@ describe('useDataLoader', () => { }) test('should be reloaded from dataloader context', async () => { - const mockedFn = jest.fn( + const mockedFn = vi.fn( () => new Promise(resolve => { setTimeout(() => { @@ -760,7 +801,7 @@ describe('useDataLoader', () => { expect(result.current[0].data).toBe(true) expect(mockedFn).toBeCalledTimes(1) - result.current[1].reloadAll().catch(undefined) + result.current[1].reloadAll().catch(() => null) await waitFor(() => expect(result.current[0].isLoading).toBe(true)) expect(result.current[0].data).toBe(true) expect(Object.values(result.current[1].getReloads()).length).toBe(1) @@ -780,7 +821,7 @@ describe('useDataLoader', () => { enabled: false, }, key: 'test-datalifetime', - method: jest.fn(fakeSuccessPromise), + method: vi.fn(fakeSuccessPromise), } const { result, rerender } = renderHook( props => [ @@ -809,6 +850,13 @@ describe('useDataLoader', () => { }) test('should render correctly with dataLifetime dont prevent double call', async () => { + const method = vi.fn( + () => + new Promise(resolve => { + setTimeout(() => resolve(true), PROMISE_TIMEOUT + 10) + }), + ) + const testingProps = { config: { enabled: true, @@ -817,7 +865,7 @@ describe('useDataLoader', () => { enabled: false, }, key: 'test-no-datalifetime', - method: jest.fn(fakeSuccessPromise), + method, } const { result, rerender } = renderHook( props => [ diff --git a/packages/use-dataloader/vite.config.ts b/packages/use-dataloader/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-dataloader/vite.config.ts +++ b/packages/use-dataloader/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-dataloader/vitest.setup.ts b/packages/use-dataloader/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/use-dataloader/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/use-growthbook/__mocks__/@growthbook/growthbook-react.tsx b/packages/use-growthbook/__mocks__/@growthbook/growthbook-react.tsx new file mode 100644 index 000000000..38330960c --- /dev/null +++ b/packages/use-growthbook/__mocks__/@growthbook/growthbook-react.tsx @@ -0,0 +1,21 @@ +import type { GrowthBook as GBType } from '@growthbook/growthbook-react' +import type { ReactNode } from 'react' +import { vi } from 'vitest' + +export const getAttributes = vi.fn<[], ReturnType>() +export const setAttributes = vi.fn<[], ReturnType>( + () => Promise.resolve(), +) + +export const GrowthBook = vi.fn(() => ({ + loadFeatures: vi.fn<[], ReturnType>(), + getAttributes, + setAttributes, +})) +export const GrowthBookProvider = ({ children }: { children: ReactNode }) => + children + +export const useGrowthBook = vi.fn() + +console.debug('GrowthBook Mock', GrowthBookProvider) +// export { GrowthBook, GrowthBookProvider, useGrowthBook } diff --git a/packages/use-growthbook/package.json b/packages/use-growthbook/package.json index b6632d4c1..93ded3b6f 100644 --- a/packages/use-growthbook/package.json +++ b/packages/use-growthbook/package.json @@ -23,7 +23,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/use-growthbook/src/__mocks__/@growthbook/growthbook-react.tsx b/packages/use-growthbook/src/__mocks__/@growthbook/growthbook-react.tsx deleted file mode 100644 index b4c4cd248..000000000 --- a/packages/use-growthbook/src/__mocks__/@growthbook/growthbook-react.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import type { GrowthBook as GBType } from '@growthbook/growthbook-react' -import { jest } from '@jest/globals' -import type { ReactNode } from 'react' - -const GrowthBook = jest.fn(() => ({ - loadFeatures: jest.fn(), - getAttributes: jest.fn(), - setAttributes: jest.fn(() => Promise.resolve()), -})) -const GrowthBookProvider = ({ children }: { children: ReactNode }) => children - -const useGrowthBook = jest.fn() - -export { GrowthBook, GrowthBookProvider, useGrowthBook } diff --git a/packages/use-growthbook/src/__tests__/AbTestProvider.tsx b/packages/use-growthbook/src/__tests__/AbTestProvider.test.tsx similarity index 88% rename from packages/use-growthbook/src/__tests__/AbTestProvider.tsx rename to packages/use-growthbook/src/__tests__/AbTestProvider.test.tsx index 5cbfef2aa..d1bf852b6 100644 --- a/packages/use-growthbook/src/__tests__/AbTestProvider.tsx +++ b/packages/use-growthbook/src/__tests__/AbTestProvider.test.tsx @@ -1,7 +1,7 @@ import { GrowthBook } from '@growthbook/growthbook-react' -import { beforeEach, describe, expect, it, jest } from '@jest/globals' import { render } from '@testing-library/react' import type { ComponentProps } from 'react' +import { describe, expect, it, vi } from 'vitest' import { AbTestProvider } from '../AbTestProvider' type TrackingCallback = ComponentProps< @@ -11,12 +11,9 @@ type TrackingCallback = ComponentProps< type ErrorCallback = ComponentProps['errorCallback'] describe('AbTestProvider', () => { - const trackingCallback = jest.fn() + const trackingCallback = vi.fn<[], TrackingCallback>() const errorCallback: ErrorCallback = () => null - beforeEach(() => { - jest.clearAllMocks() - }) it('should init GrowthBook once', () => { render( { - let getAttributes: () => Attributes - let setAttributes: (attributes: Attributes) => Promise - beforeEach(() => { - getAttributes = jest.fn<() => Attributes>().mockReturnValue({ foo: 'bar' }) - setAttributes = jest.fn(() => Promise.resolve()) + getAttributes.mockReturnValue({ foo: 'bar' }) - jest.spyOn(growthbook, 'useGrowthBook').mockReturnValue({ + useGrowthBook.mockReturnValue({ getAttributes, setAttributes, - } as ReturnType) + }) }) it('should allow to get attributes from GrowthBook', () => { diff --git a/packages/use-growthbook/vite.config.ts b/packages/use-growthbook/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-growthbook/vite.config.ts +++ b/packages/use-growthbook/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-growthbook/vitest.setup.ts b/packages/use-growthbook/vitest.setup.ts new file mode 100644 index 000000000..b37010e68 --- /dev/null +++ b/packages/use-growthbook/vitest.setup.ts @@ -0,0 +1,12 @@ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect, vi } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) + +vi.mock('@growthbook/growthbook-react') diff --git a/packages/use-gtm/tsconfig.json b/packages/use-gtm/tsconfig.json deleted file mode 100644 index 7c2b0759a..000000000 --- a/packages/use-gtm/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"] -} diff --git a/packages/use-gtm/vite.config.ts b/packages/use-gtm/vite.config.ts deleted file mode 100644 index a9bed28d6..000000000 --- a/packages/use-gtm/vite.config.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ -import { defineConfig, mergeConfig } from 'vite' -import { defaultConfig } from '../../vite.config' - -export default mergeConfig(defineConfig(defaultConfig), {}) diff --git a/packages/use-i18n/package.json b/packages/use-i18n/package.json index cf22e6541..f36ab3b1a 100644 --- a/packages/use-i18n/package.json +++ b/packages/use-i18n/package.json @@ -38,7 +38,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "dependencies": { "@formatjs/ecma402-abstract": "1.18.2", diff --git a/packages/use-i18n/src/__tests__/__snapshots__/formatDate.test.ts.snap b/packages/use-i18n/src/__tests__/__snapshots__/formatDate.test.ts.snap new file mode 100644 index 000000000..e8e363b79 --- /dev/null +++ b/packages/use-i18n/src/__tests__/__snapshots__/formatDate.test.ts.snap @@ -0,0 +1,247 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`formatDate > should return passed object if not valid date 1`] = ` +{ + "not": "a valid date", +} +`; + +exports[`formatDate > should work with custom format and locale de 1`] = `"Donnerstag, 13. F 20 n. Chr., 16:28:00 Koordinierte Weltzeit"`; + +exports[`formatDate > should work with custom format and locale de 2`] = `"Donnerstag, 13. F 20 n. Chr., 15:28:00 Koordinierte Weltzeit"`; + +exports[`formatDate > should work with custom format and locale de 3`] = `"Donnerstag, 13. F 20 n. Chr., 15:28:00 Koordinierte Weltzeit"`; + +exports[`formatDate > should work with custom format and locale en 1`] = `"Thursday, F 13, 20 AD, 04:28:00 PM Coordinated Universal Time"`; + +exports[`formatDate > should work with custom format and locale en 2`] = `"Thursday, F 13, 20 AD, 03:28:00 PM Coordinated Universal Time"`; + +exports[`formatDate > should work with custom format and locale en 3`] = `"Thursday, F 13, 20 AD, 03:28:00 PM Coordinated Universal Time"`; + +exports[`formatDate > should work with custom format and locale es 1`] = `"jueves, 13 F 20 d. C., 16:28:00 (tiempo universal coordinado)"`; + +exports[`formatDate > should work with custom format and locale es 2`] = `"jueves, 13 F 20 d. C., 15:28:00 (tiempo universal coordinado)"`; + +exports[`formatDate > should work with custom format and locale es 3`] = `"jueves, 13 F 20 d. C., 15:28:00 (tiempo universal coordinado)"`; + +exports[`formatDate > should work with custom format and locale fr 1`] = `"jeudi 13 F 20 ap. J.-C. 16:28:00 temps universel coordonné"`; + +exports[`formatDate > should work with custom format and locale fr 2`] = `"jeudi 13 F 20 ap. J.-C. 15:28:00 temps universel coordonné"`; + +exports[`formatDate > should work with custom format and locale fr 3`] = `"jeudi 13 F 20 ap. J.-C. 15:28:00 temps universel coordonné"`; + +exports[`formatDate > should work with custom format and locale ro 1`] = `"joi, 13 F 20 d.Hr., 16:28:00 Timpul universal coordonat"`; + +exports[`formatDate > should work with custom format and locale ro 2`] = `"joi, 13 F 20 d.Hr., 15:28:00 Timpul universal coordonat"`; + +exports[`formatDate > should work with custom format and locale ro 3`] = `"joi, 13 F 20 d.Hr., 15:28:00 Timpul universal coordonat"`; + +exports[`formatDate > should work with format "hour", for date = "2020-02-13T15:28:00.000Z" and locale "de" 1`] = `"13. Februar 2020 um 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "2020-02-13T15:28:00.000Z" and locale "en" 1`] = `"February 13, 2020 at 3:28 PM"`; + +exports[`formatDate > should work with format "hour", for date = "2020-02-13T15:28:00.000Z" and locale "es" 1`] = `"13 de febrero de 2020, 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "2020-02-13T15:28:00.000Z" and locale "fr" 1`] = `"13 février 2020 à 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "2020-02-13T15:28:00.000Z" and locale "ro" 1`] = `"13 februarie 2020 la 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "1581607680000" and locale "de" 1`] = `"13. Februar 2020 um 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "1581607680000" and locale "en" 1`] = `"February 13, 2020 at 3:28 PM"`; + +exports[`formatDate > should work with format "hour", for date = "1581607680000" and locale "es" 1`] = `"13 de febrero de 2020, 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "1581607680000" and locale "fr" 1`] = `"13 février 2020 à 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "1581607680000" and locale "ro" 1`] = `"13 februarie 2020 la 15:28"`; + +exports[`formatDate > should work with format "hour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "de" 1`] = `"13. Februar 2020 um 16:28"`; + +exports[`formatDate > should work with format "hour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "en" 1`] = `"February 13, 2020 at 4:28 PM"`; + +exports[`formatDate > should work with format "hour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "es" 1`] = `"13 de febrero de 2020, 16:28"`; + +exports[`formatDate > should work with format "hour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "fr" 1`] = `"13 février 2020 à 16:28"`; + +exports[`formatDate > should work with format "hour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "ro" 1`] = `"13 februarie 2020 la 16:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "2020-02-13T15:28:00.000Z" and locale "de" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "2020-02-13T15:28:00.000Z" and locale "en" 1`] = `"3:28 PM"`; + +exports[`formatDate > should work with format "hourOnly", for date = "2020-02-13T15:28:00.000Z" and locale "es" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "2020-02-13T15:28:00.000Z" and locale "fr" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "2020-02-13T15:28:00.000Z" and locale "ro" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "1581607680000" and locale "de" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "1581607680000" and locale "en" 1`] = `"3:28 PM"`; + +exports[`formatDate > should work with format "hourOnly", for date = "1581607680000" and locale "es" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "1581607680000" and locale "fr" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "1581607680000" and locale "ro" 1`] = `"15:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "new Date(2020, 1, 13, 16, 28)" and locale "de" 1`] = `"16:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "new Date(2020, 1, 13, 16, 28)" and locale "en" 1`] = `"4:28 PM"`; + +exports[`formatDate > should work with format "hourOnly", for date = "new Date(2020, 1, 13, 16, 28)" and locale "es" 1`] = `"16:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "new Date(2020, 1, 13, 16, 28)" and locale "fr" 1`] = `"16:28"`; + +exports[`formatDate > should work with format "hourOnly", for date = "new Date(2020, 1, 13, 16, 28)" and locale "ro" 1`] = `"16:28"`; + +exports[`formatDate > should work with format "long", for date = "2020-02-13T15:28:00.000Z" and locale "de" 1`] = `"13. Februar 2020"`; + +exports[`formatDate > should work with format "long", for date = "2020-02-13T15:28:00.000Z" and locale "en" 1`] = `"February 13, 2020"`; + +exports[`formatDate > should work with format "long", for date = "2020-02-13T15:28:00.000Z" and locale "es" 1`] = `"13 de febrero de 2020"`; + +exports[`formatDate > should work with format "long", for date = "2020-02-13T15:28:00.000Z" and locale "fr" 1`] = `"13 février 2020"`; + +exports[`formatDate > should work with format "long", for date = "2020-02-13T15:28:00.000Z" and locale "ro" 1`] = `"13 februarie 2020"`; + +exports[`formatDate > should work with format "long", for date = "1581607680000" and locale "de" 1`] = `"13. Februar 2020"`; + +exports[`formatDate > should work with format "long", for date = "1581607680000" and locale "en" 1`] = `"February 13, 2020"`; + +exports[`formatDate > should work with format "long", for date = "1581607680000" and locale "es" 1`] = `"13 de febrero de 2020"`; + +exports[`formatDate > should work with format "long", for date = "1581607680000" and locale "fr" 1`] = `"13 février 2020"`; + +exports[`formatDate > should work with format "long", for date = "1581607680000" and locale "ro" 1`] = `"13 februarie 2020"`; + +exports[`formatDate > should work with format "long", for date = "new Date(2020, 1, 13, 16, 28)" and locale "de" 1`] = `"13. Februar 2020"`; + +exports[`formatDate > should work with format "long", for date = "new Date(2020, 1, 13, 16, 28)" and locale "en" 1`] = `"February 13, 2020"`; + +exports[`formatDate > should work with format "long", for date = "new Date(2020, 1, 13, 16, 28)" and locale "es" 1`] = `"13 de febrero de 2020"`; + +exports[`formatDate > should work with format "long", for date = "new Date(2020, 1, 13, 16, 28)" and locale "fr" 1`] = `"13 février 2020"`; + +exports[`formatDate > should work with format "long", for date = "new Date(2020, 1, 13, 16, 28)" and locale "ro" 1`] = `"13 februarie 2020"`; + +exports[`formatDate > should work with format "numeric", for date = "2020-02-13T15:28:00.000Z" and locale "de" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "2020-02-13T15:28:00.000Z" and locale "en" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "2020-02-13T15:28:00.000Z" and locale "es" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "2020-02-13T15:28:00.000Z" and locale "fr" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "2020-02-13T15:28:00.000Z" and locale "ro" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "1581607680000" and locale "de" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "1581607680000" and locale "en" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "1581607680000" and locale "es" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "1581607680000" and locale "fr" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "1581607680000" and locale "ro" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "new Date(2020, 1, 13, 16, 28)" and locale "de" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "new Date(2020, 1, 13, 16, 28)" and locale "en" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "new Date(2020, 1, 13, 16, 28)" and locale "es" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "new Date(2020, 1, 13, 16, 28)" and locale "fr" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numeric", for date = "new Date(2020, 1, 13, 16, 28)" and locale "ro" 1`] = `"2020-02-13"`; + +exports[`formatDate > should work with format "numericHour", for date = "2020-02-13T15:28:00.000Z" and locale "de" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "2020-02-13T15:28:00.000Z" and locale "en" 1`] = `"2020-02-13 3:28 PM"`; + +exports[`formatDate > should work with format "numericHour", for date = "2020-02-13T15:28:00.000Z" and locale "es" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "2020-02-13T15:28:00.000Z" and locale "fr" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "2020-02-13T15:28:00.000Z" and locale "ro" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "1581607680000" and locale "de" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "1581607680000" and locale "en" 1`] = `"2020-02-13 3:28 PM"`; + +exports[`formatDate > should work with format "numericHour", for date = "1581607680000" and locale "es" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "1581607680000" and locale "fr" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "1581607680000" and locale "ro" 1`] = `"2020-02-13 15:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "de" 1`] = `"2020-02-13 16:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "en" 1`] = `"2020-02-13 4:28 PM"`; + +exports[`formatDate > should work with format "numericHour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "es" 1`] = `"2020-02-13 16:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "fr" 1`] = `"2020-02-13 16:28"`; + +exports[`formatDate > should work with format "numericHour", for date = "new Date(2020, 1, 13, 16, 28)" and locale "ro" 1`] = `"2020-02-13 16:28"`; + +exports[`formatDate > should work with format "short", for date = "2020-02-13T15:28:00.000Z" and locale "de" 1`] = `"13. Feb. 2020"`; + +exports[`formatDate > should work with format "short", for date = "2020-02-13T15:28:00.000Z" and locale "en" 1`] = `"Feb 13, 2020"`; + +exports[`formatDate > should work with format "short", for date = "2020-02-13T15:28:00.000Z" and locale "es" 1`] = `"13 feb 2020"`; + +exports[`formatDate > should work with format "short", for date = "2020-02-13T15:28:00.000Z" and locale "fr" 1`] = `"13 févr. 2020"`; + +exports[`formatDate > should work with format "short", for date = "2020-02-13T15:28:00.000Z" and locale "ro" 1`] = `"13 feb. 2020"`; + +exports[`formatDate > should work with format "short", for date = "1581607680000" and locale "de" 1`] = `"13. Feb. 2020"`; + +exports[`formatDate > should work with format "short", for date = "1581607680000" and locale "en" 1`] = `"Feb 13, 2020"`; + +exports[`formatDate > should work with format "short", for date = "1581607680000" and locale "es" 1`] = `"13 feb 2020"`; + +exports[`formatDate > should work with format "short", for date = "1581607680000" and locale "fr" 1`] = `"13 févr. 2020"`; + +exports[`formatDate > should work with format "short", for date = "1581607680000" and locale "ro" 1`] = `"13 feb. 2020"`; + +exports[`formatDate > should work with format "short", for date = "new Date(2020, 1, 13, 16, 28)" and locale "de" 1`] = `"13. Feb. 2020"`; + +exports[`formatDate > should work with format "short", for date = "new Date(2020, 1, 13, 16, 28)" and locale "en" 1`] = `"Feb 13, 2020"`; + +exports[`formatDate > should work with format "short", for date = "new Date(2020, 1, 13, 16, 28)" and locale "es" 1`] = `"13 feb 2020"`; + +exports[`formatDate > should work with format "short", for date = "new Date(2020, 1, 13, 16, 28)" and locale "fr" 1`] = `"13 févr. 2020"`; + +exports[`formatDate > should work with format "short", for date = "new Date(2020, 1, 13, 16, 28)" and locale "ro" 1`] = `"13 feb. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "2020-02-13T15:28:00.000Z" and locale "de" 1`] = `"Feb. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "2020-02-13T15:28:00.000Z" and locale "en" 1`] = `"Feb 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "2020-02-13T15:28:00.000Z" and locale "es" 1`] = `"feb 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "2020-02-13T15:28:00.000Z" and locale "fr" 1`] = `"févr. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "2020-02-13T15:28:00.000Z" and locale "ro" 1`] = `"feb. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "1581607680000" and locale "de" 1`] = `"Feb. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "1581607680000" and locale "en" 1`] = `"Feb 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "1581607680000" and locale "es" 1`] = `"feb 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "1581607680000" and locale "fr" 1`] = `"févr. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "1581607680000" and locale "ro" 1`] = `"feb. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "new Date(2020, 1, 13, 16, 28)" and locale "de" 1`] = `"Feb. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "new Date(2020, 1, 13, 16, 28)" and locale "en" 1`] = `"Feb 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "new Date(2020, 1, 13, 16, 28)" and locale "es" 1`] = `"feb 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "new Date(2020, 1, 13, 16, 28)" and locale "fr" 1`] = `"févr. 2020"`; + +exports[`formatDate > should work with format "shortWithoutDay", for date = "new Date(2020, 1, 13, 16, 28)" and locale "ro" 1`] = `"feb. 2020"`; diff --git a/packages/use-i18n/src/__tests__/__snapshots__/formatUnit.test.ts.snap b/packages/use-i18n/src/__tests__/__snapshots__/formatUnit.test.ts.snap new file mode 100644 index 000000000..ee7a3db61 --- /dev/null +++ b/packages/use-i18n/src/__tests__/__snapshots__/formatUnit.test.ts.snap @@ -0,0 +1,1143 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`formatUnit > should return empty string for unknown unit 1`] = `""`; + +exports[`formatUnit > should work with { unit: 'bit' } 1`] = `"12,56 b"`; + +exports[`formatUnit > should work with { unit: 'bit-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with { unit: 'bit-per-second' } 1`] = `"12,56 bps"`; + +exports[`formatUnit > should work with { unit: 'bit-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with { unit: 'bits-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with { unit: 'bits-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with { unit: 'byte' } 1`] = `"12,56 o"`; + +exports[`formatUnit > should work with { unit: 'byte-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with { unit: 'bytes-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with { unit: 'exabit' } 1`] = `"12,56 Eb"`; + +exports[`formatUnit > should work with { unit: 'exabit-humanized' } 1`] = `"0 Eb"`; + +exports[`formatUnit > should work with { unit: 'exabit-per-second' } 1`] = `"12,56 Ebps"`; + +exports[`formatUnit > should work with { unit: 'exabit-per-second-humanized' } 1`] = `"0 Ebps"`; + +exports[`formatUnit > should work with { unit: 'exabyte' } 1`] = `"12,56 Eo"`; + +exports[`formatUnit > should work with { unit: 'exabyte-humanized' } 1`] = `"0 Eo"`; + +exports[`formatUnit > should work with { unit: 'gigabit' } 1`] = `"12,56 Gb"`; + +exports[`formatUnit > should work with { unit: 'gigabit-humanized' } 1`] = `"0 Gb"`; + +exports[`formatUnit > should work with { unit: 'gigabit-per-second' } 1`] = `"12,56 Gbps"`; + +exports[`formatUnit > should work with { unit: 'gigabit-per-second-humanized' } 1`] = `"0 Gbps"`; + +exports[`formatUnit > should work with { unit: 'gigabyte' } 1`] = `"12,56 Go"`; + +exports[`formatUnit > should work with { unit: 'gigabyte-humanized' } 1`] = `"0 Go"`; + +exports[`formatUnit > should work with { unit: 'kilobit' } 1`] = `"12,56 Kb"`; + +exports[`formatUnit > should work with { unit: 'kilobit-humanized' } 1`] = `"0,01 Kb"`; + +exports[`formatUnit > should work with { unit: 'kilobit-per-second' } 1`] = `"12,56 Kbps"`; + +exports[`formatUnit > should work with { unit: 'kilobit-per-second-humanized' } 1`] = `"0,01 Kbps"`; + +exports[`formatUnit > should work with { unit: 'kilobyte' } 1`] = `"12,56 Ko"`; + +exports[`formatUnit > should work with { unit: 'kilobyte-humanized' } 1`] = `"0,01 Ko"`; + +exports[`formatUnit > should work with { unit: 'megabit' } 1`] = `"12,56 Mb"`; + +exports[`formatUnit > should work with { unit: 'megabit-humanized' } 1`] = `"0 Mb"`; + +exports[`formatUnit > should work with { unit: 'megabit-per-second' } 1`] = `"12,56 Mbps"`; + +exports[`formatUnit > should work with { unit: 'megabit-per-second-humanized' } 1`] = `"0 Mbps"`; + +exports[`formatUnit > should work with { unit: 'megabyte' } 1`] = `"12,56 Mo"`; + +exports[`formatUnit > should work with { unit: 'megabyte-humanized' } 1`] = `"0 Mo"`; + +exports[`formatUnit > should work with { unit: 'petabit' } 1`] = `"12,56 Pb"`; + +exports[`formatUnit > should work with { unit: 'petabit-humanized' } 1`] = `"0 Pb"`; + +exports[`formatUnit > should work with { unit: 'petabit-per-second' } 1`] = `"12,56 Pbps"`; + +exports[`formatUnit > should work with { unit: 'petabit-per-second-humanized' } 1`] = `"0 Pbps"`; + +exports[`formatUnit > should work with { unit: 'petabyte' } 1`] = `"12,56 Po"`; + +exports[`formatUnit > should work with { unit: 'petabyte-humanized' } 1`] = `"0 Po"`; + +exports[`formatUnit > should work with { unit: 'terabit' } 1`] = `"12,56 Tb"`; + +exports[`formatUnit > should work with { unit: 'terabit-humanized' } 1`] = `"0 Tb"`; + +exports[`formatUnit > should work with { unit: 'terabit-per-second' } 1`] = `"12,56 Tbps"`; + +exports[`formatUnit > should work with { unit: 'terabit-per-second-humanized' } 1`] = `"0 Tbps"`; + +exports[`formatUnit > should work with { unit: 'terabyte' } 1`] = `"12,56 To"`; + +exports[`formatUnit > should work with { unit: 'terabyte-humanized' } 1`] = `"0 To"`; + +exports[`formatUnit > should work with { unit: 'yottabit' } 1`] = `"12,56 Yb"`; + +exports[`formatUnit > should work with { unit: 'yottabit-humanized' } 1`] = `"0 Yb"`; + +exports[`formatUnit > should work with { unit: 'yottabit-per-second' } 1`] = `"12,56 Ybps"`; + +exports[`formatUnit > should work with { unit: 'yottabit-per-second-humanized' } 1`] = `"0 Ybps"`; + +exports[`formatUnit > should work with { unit: 'yottabyte' } 1`] = `"12,56 Yo"`; + +exports[`formatUnit > should work with { unit: 'yottabyte-humanized' } 1`] = `"0 Yo"`; + +exports[`formatUnit > should work with { unit: 'zettabit' } 1`] = `"12,56 Zb"`; + +exports[`formatUnit > should work with { unit: 'zettabit-humanized' } 1`] = `"0 Zb"`; + +exports[`formatUnit > should work with { unit: 'zettabit-per-second' } 1`] = `"12,56 Zbps"`; + +exports[`formatUnit > should work with { unit: 'zettabit-per-second-humanized' } 1`] = `"0 Zbps"`; + +exports[`formatUnit > should work with { unit: 'zettabyte' } 1`] = `"12,56 Zo"`; + +exports[`formatUnit > should work with { unit: 'zettabyte-humanized' } 1`] = `"0 Zo"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'bit' } 1`] = `"4,294,967,296 b"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'bit-humanized' } 1`] = `"4,294,967,296 b"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'bit-per-second' } 1`] = `"4,294,967,296 bps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'bit-per-second-humanized' } 1`] = `"4,294,967,296 bps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'bits-humanized' } 1`] = `"4 Gb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'bits-per-second-humanized' } 1`] = `"4 Gbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'byte' } 1`] = `"4,294,967,296 B"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'byte-humanized' } 1`] = `"4,294,967,296 B"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'bytes-humanized' } 1`] = `"4 GB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'exabit' } 1`] = `"4,294,967,296 Eb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'exabit-humanized' } 1`] = `"0 Eb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'exabit-per-second' } 1`] = `"4,294,967,296 Ebps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'exabit-per-second-humanized' } 1`] = `"0 Ebps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'exabyte' } 1`] = `"4,294,967,296 EB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'exabyte-humanized' } 1`] = `"0 EB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'gigabit' } 1`] = `"4,294,967,296 Gb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'gigabit-humanized' } 1`] = `"4 Gb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'gigabit-per-second' } 1`] = `"4,294,967,296 Gbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'gigabit-per-second-humanized' } 1`] = `"4 Gbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'gigabyte' } 1`] = `"4,294,967,296 GB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'gigabyte-humanized' } 1`] = `"4 GB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'kilobit' } 1`] = `"4,294,967,296 Kb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'kilobit-humanized' } 1`] = `"4,194,304 Kb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'kilobit-per-second' } 1`] = `"4,294,967,296 Kbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'kilobit-per-second-humanized' } 1`] = `"4,194,304 Kbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'kilobyte' } 1`] = `"4,294,967,296 KB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'kilobyte-humanized' } 1`] = `"4,194,304 KB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'megabit' } 1`] = `"4,294,967,296 Mb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'megabit-humanized' } 1`] = `"4,096 Mb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'megabit-per-second' } 1`] = `"4,294,967,296 Mbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'megabit-per-second-humanized' } 1`] = `"4,096 Mbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'megabyte' } 1`] = `"4,294,967,296 MB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'megabyte-humanized' } 1`] = `"4,096 MB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'petabit' } 1`] = `"4,294,967,296 Pb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'petabit-humanized' } 1`] = `"0 Pb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'petabit-per-second' } 1`] = `"4,294,967,296 Pbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'petabit-per-second-humanized' } 1`] = `"0 Pbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'petabyte' } 1`] = `"4,294,967,296 PB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'petabyte-humanized' } 1`] = `"0 PB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'terabit' } 1`] = `"4,294,967,296 Tb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'terabit-humanized' } 1`] = `"0 Tb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'terabit-per-second' } 1`] = `"4,294,967,296 Tbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'terabit-per-second-humanized' } 1`] = `"0 Tbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'terabyte' } 1`] = `"4,294,967,296 TB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'terabyte-humanized' } 1`] = `"0 TB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'yottabit' } 1`] = `"4,294,967,296 Yb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'yottabit-humanized' } 1`] = `"0 Yb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'yottabit-per-second' } 1`] = `"4,294,967,296 Ybps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'yottabit-per-second-humanized' } 1`] = `"0 Ybps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'yottabyte' } 1`] = `"4,294,967,296 YB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'yottabyte-humanized' } 1`] = `"0 YB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'zettabit' } 1`] = `"4,294,967,296 Zb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'zettabit-humanized' } 1`] = `"0 Zb"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'zettabit-per-second' } 1`] = `"4,294,967,296 Zbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'zettabit-per-second-humanized' } 1`] = `"0 Zbps"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'zettabyte' } 1`] = `"4,294,967,296 ZB"`; + +exports[`formatUnit > should work with base { base: 2, unit: 'zettabyte-humanized' } 1`] = `"0 ZB"`; + +exports[`formatUnit > should work with locale en and { unit: 'bit' } 1`] = `"12.56 b"`; + +exports[`formatUnit > should work with locale en and { unit: 'bit-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with locale en and { unit: 'bit-per-second' } 1`] = `"12.56 bps"`; + +exports[`formatUnit > should work with locale en and { unit: 'bit-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with locale en and { unit: 'bits-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with locale en and { unit: 'bits-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with locale en and { unit: 'byte' } 1`] = `"12.56 B"`; + +exports[`formatUnit > should work with locale en and { unit: 'byte-humanized' } 1`] = `"13 B"`; + +exports[`formatUnit > should work with locale en and { unit: 'bytes-humanized' } 1`] = `"13 B"`; + +exports[`formatUnit > should work with locale en and { unit: 'exabit' } 1`] = `"12.56 Eb"`; + +exports[`formatUnit > should work with locale en and { unit: 'exabit-humanized' } 1`] = `"0 Eb"`; + +exports[`formatUnit > should work with locale en and { unit: 'exabit-per-second' } 1`] = `"12.56 Ebps"`; + +exports[`formatUnit > should work with locale en and { unit: 'exabit-per-second-humanized' } 1`] = `"0 Ebps"`; + +exports[`formatUnit > should work with locale en and { unit: 'exabyte' } 1`] = `"12.56 EB"`; + +exports[`formatUnit > should work with locale en and { unit: 'exabyte-humanized' } 1`] = `"0 EB"`; + +exports[`formatUnit > should work with locale en and { unit: 'gigabit' } 1`] = `"12.56 Gb"`; + +exports[`formatUnit > should work with locale en and { unit: 'gigabit-humanized' } 1`] = `"0 Gb"`; + +exports[`formatUnit > should work with locale en and { unit: 'gigabit-per-second' } 1`] = `"12.56 Gbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'gigabit-per-second-humanized' } 1`] = `"0 Gbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'gigabyte' } 1`] = `"12.56 GB"`; + +exports[`formatUnit > should work with locale en and { unit: 'gigabyte-humanized' } 1`] = `"0 GB"`; + +exports[`formatUnit > should work with locale en and { unit: 'kilobit' } 1`] = `"12.56 Kb"`; + +exports[`formatUnit > should work with locale en and { unit: 'kilobit-humanized' } 1`] = `"0.01 Kb"`; + +exports[`formatUnit > should work with locale en and { unit: 'kilobit-per-second' } 1`] = `"12.56 Kbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'kilobit-per-second-humanized' } 1`] = `"0.01 Kbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'kilobyte' } 1`] = `"12.56 KB"`; + +exports[`formatUnit > should work with locale en and { unit: 'kilobyte-humanized' } 1`] = `"0.01 KB"`; + +exports[`formatUnit > should work with locale en and { unit: 'megabit' } 1`] = `"12.56 Mb"`; + +exports[`formatUnit > should work with locale en and { unit: 'megabit-humanized' } 1`] = `"0 Mb"`; + +exports[`formatUnit > should work with locale en and { unit: 'megabit-per-second' } 1`] = `"12.56 Mbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'megabit-per-second-humanized' } 1`] = `"0 Mbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'megabyte' } 1`] = `"12.56 MB"`; + +exports[`formatUnit > should work with locale en and { unit: 'megabyte-humanized' } 1`] = `"0 MB"`; + +exports[`formatUnit > should work with locale en and { unit: 'petabit' } 1`] = `"12.56 Pb"`; + +exports[`formatUnit > should work with locale en and { unit: 'petabit-humanized' } 1`] = `"0 Pb"`; + +exports[`formatUnit > should work with locale en and { unit: 'petabit-per-second' } 1`] = `"12.56 Pbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'petabit-per-second-humanized' } 1`] = `"0 Pbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'petabyte' } 1`] = `"12.56 PB"`; + +exports[`formatUnit > should work with locale en and { unit: 'petabyte-humanized' } 1`] = `"0 PB"`; + +exports[`formatUnit > should work with locale en and { unit: 'terabit' } 1`] = `"12.56 Tb"`; + +exports[`formatUnit > should work with locale en and { unit: 'terabit-humanized' } 1`] = `"0 Tb"`; + +exports[`formatUnit > should work with locale en and { unit: 'terabit-per-second' } 1`] = `"12.56 Tbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'terabit-per-second-humanized' } 1`] = `"0 Tbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'terabyte' } 1`] = `"12.56 TB"`; + +exports[`formatUnit > should work with locale en and { unit: 'terabyte-humanized' } 1`] = `"0 TB"`; + +exports[`formatUnit > should work with locale en and { unit: 'yottabit' } 1`] = `"12.56 Yb"`; + +exports[`formatUnit > should work with locale en and { unit: 'yottabit-humanized' } 1`] = `"0 Yb"`; + +exports[`formatUnit > should work with locale en and { unit: 'yottabit-per-second' } 1`] = `"12.56 Ybps"`; + +exports[`formatUnit > should work with locale en and { unit: 'yottabit-per-second-humanized' } 1`] = `"0 Ybps"`; + +exports[`formatUnit > should work with locale en and { unit: 'yottabyte' } 1`] = `"12.56 YB"`; + +exports[`formatUnit > should work with locale en and { unit: 'yottabyte-humanized' } 1`] = `"0 YB"`; + +exports[`formatUnit > should work with locale en and { unit: 'zettabit' } 1`] = `"12.56 Zb"`; + +exports[`formatUnit > should work with locale en and { unit: 'zettabit-humanized' } 1`] = `"0 Zb"`; + +exports[`formatUnit > should work with locale en and { unit: 'zettabit-per-second' } 1`] = `"12.56 Zbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'zettabit-per-second-humanized' } 1`] = `"0 Zbps"`; + +exports[`formatUnit > should work with locale en and { unit: 'zettabyte' } 1`] = `"12.56 ZB"`; + +exports[`formatUnit > should work with locale en and { unit: 'zettabyte-humanized' } 1`] = `"0 ZB"`; + +exports[`formatUnit > should work with locale fr and { unit: 'bit' } 1`] = `"12,56 b"`; + +exports[`formatUnit > should work with locale fr and { unit: 'bit-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with locale fr and { unit: 'bit-per-second' } 1`] = `"12,56 bps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'bit-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'bits-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with locale fr and { unit: 'bits-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'byte' } 1`] = `"12,56 o"`; + +exports[`formatUnit > should work with locale fr and { unit: 'byte-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with locale fr and { unit: 'bytes-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with locale fr and { unit: 'exabit' } 1`] = `"12,56 Eb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'exabit-humanized' } 1`] = `"0 Eb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'exabit-per-second' } 1`] = `"12,56 Ebps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'exabit-per-second-humanized' } 1`] = `"0 Ebps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'exabyte' } 1`] = `"12,56 Eo"`; + +exports[`formatUnit > should work with locale fr and { unit: 'exabyte-humanized' } 1`] = `"0 Eo"`; + +exports[`formatUnit > should work with locale fr and { unit: 'gigabit' } 1`] = `"12,56 Gb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'gigabit-humanized' } 1`] = `"0 Gb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'gigabit-per-second' } 1`] = `"12,56 Gbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'gigabit-per-second-humanized' } 1`] = `"0 Gbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'gigabyte' } 1`] = `"12,56 Go"`; + +exports[`formatUnit > should work with locale fr and { unit: 'gigabyte-humanized' } 1`] = `"0 Go"`; + +exports[`formatUnit > should work with locale fr and { unit: 'kilobit' } 1`] = `"12,56 Kb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'kilobit-humanized' } 1`] = `"0,01 Kb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'kilobit-per-second' } 1`] = `"12,56 Kbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'kilobit-per-second-humanized' } 1`] = `"0,01 Kbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'kilobyte' } 1`] = `"12,56 Ko"`; + +exports[`formatUnit > should work with locale fr and { unit: 'kilobyte-humanized' } 1`] = `"0,01 Ko"`; + +exports[`formatUnit > should work with locale fr and { unit: 'megabit' } 1`] = `"12,56 Mb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'megabit-humanized' } 1`] = `"0 Mb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'megabit-per-second' } 1`] = `"12,56 Mbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'megabit-per-second-humanized' } 1`] = `"0 Mbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'megabyte' } 1`] = `"12,56 Mo"`; + +exports[`formatUnit > should work with locale fr and { unit: 'megabyte-humanized' } 1`] = `"0 Mo"`; + +exports[`formatUnit > should work with locale fr and { unit: 'petabit' } 1`] = `"12,56 Pb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'petabit-humanized' } 1`] = `"0 Pb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'petabit-per-second' } 1`] = `"12,56 Pbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'petabit-per-second-humanized' } 1`] = `"0 Pbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'petabyte' } 1`] = `"12,56 Po"`; + +exports[`formatUnit > should work with locale fr and { unit: 'petabyte-humanized' } 1`] = `"0 Po"`; + +exports[`formatUnit > should work with locale fr and { unit: 'terabit' } 1`] = `"12,56 Tb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'terabit-humanized' } 1`] = `"0 Tb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'terabit-per-second' } 1`] = `"12,56 Tbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'terabit-per-second-humanized' } 1`] = `"0 Tbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'terabyte' } 1`] = `"12,56 To"`; + +exports[`formatUnit > should work with locale fr and { unit: 'terabyte-humanized' } 1`] = `"0 To"`; + +exports[`formatUnit > should work with locale fr and { unit: 'yottabit' } 1`] = `"12,56 Yb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'yottabit-humanized' } 1`] = `"0 Yb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'yottabit-per-second' } 1`] = `"12,56 Ybps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'yottabit-per-second-humanized' } 1`] = `"0 Ybps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'yottabyte' } 1`] = `"12,56 Yo"`; + +exports[`formatUnit > should work with locale fr and { unit: 'yottabyte-humanized' } 1`] = `"0 Yo"`; + +exports[`formatUnit > should work with locale fr and { unit: 'zettabit' } 1`] = `"12,56 Zb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'zettabit-humanized' } 1`] = `"0 Zb"`; + +exports[`formatUnit > should work with locale fr and { unit: 'zettabit-per-second' } 1`] = `"12,56 Zbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'zettabit-per-second-humanized' } 1`] = `"0 Zbps"`; + +exports[`formatUnit > should work with locale fr and { unit: 'zettabyte' } 1`] = `"12,56 Zo"`; + +exports[`formatUnit > should work with locale fr and { unit: 'zettabyte-humanized' } 1`] = `"0 Zo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'bit' } 1`] = `"12,56 b"`; + +exports[`formatUnit > should work with locale ro and { unit: 'bit-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with locale ro and { unit: 'bit-per-second' } 1`] = `"12,56 bps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'bit-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'bits-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with locale ro and { unit: 'bits-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'byte' } 1`] = `"12,56 o"`; + +exports[`formatUnit > should work with locale ro and { unit: 'byte-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with locale ro and { unit: 'bytes-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with locale ro and { unit: 'exabit' } 1`] = `"12,56 Eb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'exabit-humanized' } 1`] = `"0 Eb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'exabit-per-second' } 1`] = `"12,56 Ebps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'exabit-per-second-humanized' } 1`] = `"0 Ebps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'exabyte' } 1`] = `"12,56 Eo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'exabyte-humanized' } 1`] = `"0 Eo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'gigabit' } 1`] = `"12,56 Gb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'gigabit-humanized' } 1`] = `"0 Gb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'gigabit-per-second' } 1`] = `"12,56 Gbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'gigabit-per-second-humanized' } 1`] = `"0 Gbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'gigabyte' } 1`] = `"12,56 Go"`; + +exports[`formatUnit > should work with locale ro and { unit: 'gigabyte-humanized' } 1`] = `"0 Go"`; + +exports[`formatUnit > should work with locale ro and { unit: 'kilobit' } 1`] = `"12,56 Kb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'kilobit-humanized' } 1`] = `"0,01 Kb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'kilobit-per-second' } 1`] = `"12,56 Kbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'kilobit-per-second-humanized' } 1`] = `"0,01 Kbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'kilobyte' } 1`] = `"12,56 Ko"`; + +exports[`formatUnit > should work with locale ro and { unit: 'kilobyte-humanized' } 1`] = `"0,01 Ko"`; + +exports[`formatUnit > should work with locale ro and { unit: 'megabit' } 1`] = `"12,56 Mb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'megabit-humanized' } 1`] = `"0 Mb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'megabit-per-second' } 1`] = `"12,56 Mbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'megabit-per-second-humanized' } 1`] = `"0 Mbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'megabyte' } 1`] = `"12,56 Mo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'megabyte-humanized' } 1`] = `"0 Mo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'petabit' } 1`] = `"12,56 Pb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'petabit-humanized' } 1`] = `"0 Pb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'petabit-per-second' } 1`] = `"12,56 Pbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'petabit-per-second-humanized' } 1`] = `"0 Pbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'petabyte' } 1`] = `"12,56 Po"`; + +exports[`formatUnit > should work with locale ro and { unit: 'petabyte-humanized' } 1`] = `"0 Po"`; + +exports[`formatUnit > should work with locale ro and { unit: 'terabit' } 1`] = `"12,56 Tb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'terabit-humanized' } 1`] = `"0 Tb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'terabit-per-second' } 1`] = `"12,56 Tbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'terabit-per-second-humanized' } 1`] = `"0 Tbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'terabyte' } 1`] = `"12,56 To"`; + +exports[`formatUnit > should work with locale ro and { unit: 'terabyte-humanized' } 1`] = `"0 To"`; + +exports[`formatUnit > should work with locale ro and { unit: 'yottabit' } 1`] = `"12,56 Yb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'yottabit-humanized' } 1`] = `"0 Yb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'yottabit-per-second' } 1`] = `"12,56 Ybps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'yottabit-per-second-humanized' } 1`] = `"0 Ybps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'yottabyte' } 1`] = `"12,56 Yo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'yottabyte-humanized' } 1`] = `"0 Yo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'zettabit' } 1`] = `"12,56 Zb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'zettabit-humanized' } 1`] = `"0 Zb"`; + +exports[`formatUnit > should work with locale ro and { unit: 'zettabit-per-second' } 1`] = `"12,56 Zbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'zettabit-per-second-humanized' } 1`] = `"0 Zbps"`; + +exports[`formatUnit > should work with locale ro and { unit: 'zettabyte' } 1`] = `"12,56 Zo"`; + +exports[`formatUnit > should work with locale ro and { unit: 'zettabyte-humanized' } 1`] = `"0 Zo"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'bit' } 1`] = `"12.56 bits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'bit-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'bit-per-second' } 1`] = `"12.56 bits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'bit-per-second-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'bits-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'bits-per-second-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'byte' } 1`] = `"12.56 bytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'byte-humanized' } 1`] = `"13 bytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'bytes-humanized' } 1`] = `"13 bytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'exabit' } 1`] = `"12.56 exabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'exabit-humanized' } 1`] = `"0 exabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'exabit-per-second' } 1`] = `"12.56 exabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'exabit-per-second-humanized' } 1`] = `"0 exabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'exabyte' } 1`] = `"12.56 exabytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'exabyte-humanized' } 1`] = `"0 exabyte"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'gigabit' } 1`] = `"12.56 gigabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'gigabit-humanized' } 1`] = `"0 gigabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'gigabit-per-second' } 1`] = `"12.56 gigabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'gigabit-per-second-humanized' } 1`] = `"0 gigabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'gigabyte' } 1`] = `"12.56 gigabytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'gigabyte-humanized' } 1`] = `"0 gigabyte"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'kilobit' } 1`] = `"12.56 kilobits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'kilobit-humanized' } 1`] = `"0.01 kilobits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'kilobit-per-second' } 1`] = `"12.56 kilobits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'kilobit-per-second-humanized' } 1`] = `"0.01 kilobits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'kilobyte' } 1`] = `"12.56 kilobytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'kilobyte-humanized' } 1`] = `"0.01 kilobytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'megabit' } 1`] = `"12.56 megabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'megabit-humanized' } 1`] = `"0 megabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'megabit-per-second' } 1`] = `"12.56 megabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'megabit-per-second-humanized' } 1`] = `"0 megabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'megabyte' } 1`] = `"12.56 megabytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'megabyte-humanized' } 1`] = `"0 megabyte"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'petabit' } 1`] = `"12.56 petabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'petabit-humanized' } 1`] = `"0 petabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'petabit-per-second' } 1`] = `"12.56 petabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'petabit-per-second-humanized' } 1`] = `"0 petabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'petabyte' } 1`] = `"12.56 petabytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'petabyte-humanized' } 1`] = `"0 petabyte"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'terabit' } 1`] = `"12.56 terabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'terabit-humanized' } 1`] = `"0 terabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'terabit-per-second' } 1`] = `"12.56 terabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'terabit-per-second-humanized' } 1`] = `"0 terabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'terabyte' } 1`] = `"12.56 terabytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'terabyte-humanized' } 1`] = `"0 terabyte"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'yottabit' } 1`] = `"12.56 yottabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'yottabit-humanized' } 1`] = `"0 yottabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'yottabit-per-second' } 1`] = `"12.56 yottabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'yottabit-per-second-humanized' } 1`] = `"0 yottabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'yottabyte' } 1`] = `"12.56 yottabytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'yottabyte-humanized' } 1`] = `"0 yottabyte"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'zettabit' } 1`] = `"12.56 zettabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'zettabit-humanized' } 1`] = `"0 zettabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'zettabit-per-second' } 1`] = `"12.56 zettabits"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'zettabit-per-second-humanized' } 1`] = `"0 zettabit"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'zettabyte' } 1`] = `"12.56 zettabytes"`; + +exports[`formatUnit > should work with long format, locale en and { short: false, unit: 'zettabyte-humanized' } 1`] = `"0 zettabyte"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'bit' } 1`] = `"12,56 bits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'bit-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'bit-per-second' } 1`] = `"12,56 bits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'bit-per-second-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'bits-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'bits-per-second-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'byte' } 1`] = `"12,56 octets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'byte-humanized' } 1`] = `"13 octets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'bytes-humanized' } 1`] = `"13 octets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'exabit' } 1`] = `"12,56 exabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'exabit-humanized' } 1`] = `"0 exabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'exabit-per-second' } 1`] = `"12,56 exabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'exabit-per-second-humanized' } 1`] = `"0 exabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'exabyte' } 1`] = `"12,56 exaoctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'exabyte-humanized' } 1`] = `"0 exaoctet"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'gigabit' } 1`] = `"12,56 gigabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'gigabit-humanized' } 1`] = `"0 gigabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'gigabit-per-second' } 1`] = `"12,56 gigabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'gigabit-per-second-humanized' } 1`] = `"0 gigabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'gigabyte' } 1`] = `"12,56 gigaoctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'gigabyte-humanized' } 1`] = `"0 gigaoctet"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'kilobit' } 1`] = `"12,56 kilobits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'kilobit-humanized' } 1`] = `"0,01 kilobits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'kilobit-per-second' } 1`] = `"12,56 kilobits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'kilobit-per-second-humanized' } 1`] = `"0,01 kilobits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'kilobyte' } 1`] = `"12,56 kilooctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'kilobyte-humanized' } 1`] = `"0,01 kilooctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'megabit' } 1`] = `"12,56 megabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'megabit-humanized' } 1`] = `"0 megabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'megabit-per-second' } 1`] = `"12,56 megabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'megabit-per-second-humanized' } 1`] = `"0 megabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'megabyte' } 1`] = `"12,56 megaoctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'megabyte-humanized' } 1`] = `"0 megaoctet"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'petabit' } 1`] = `"12,56 petabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'petabit-humanized' } 1`] = `"0 petabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'petabit-per-second' } 1`] = `"12,56 petabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'petabit-per-second-humanized' } 1`] = `"0 petabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'petabyte' } 1`] = `"12,56 petaoctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'petabyte-humanized' } 1`] = `"0 petaoctet"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'terabit' } 1`] = `"12,56 terabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'terabit-humanized' } 1`] = `"0 terabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'terabit-per-second' } 1`] = `"12,56 terabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'terabit-per-second-humanized' } 1`] = `"0 terabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'terabyte' } 1`] = `"12,56 teraoctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'terabyte-humanized' } 1`] = `"0 teraoctet"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'yottabit' } 1`] = `"12,56 yottabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'yottabit-humanized' } 1`] = `"0 yottabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'yottabit-per-second' } 1`] = `"12,56 yottabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'yottabit-per-second-humanized' } 1`] = `"0 yottabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'yottabyte' } 1`] = `"12,56 yottaoctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'yottabyte-humanized' } 1`] = `"0 yottaoctet"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'zettabit' } 1`] = `"12,56 zettabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'zettabit-humanized' } 1`] = `"0 zettabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'zettabit-per-second' } 1`] = `"12,56 zettabits"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'zettabit-per-second-humanized' } 1`] = `"0 zettabit"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'zettabyte' } 1`] = `"12,56 zettaoctets"`; + +exports[`formatUnit > should work with long format, locale fr and { short: false, unit: 'zettabyte-humanized' } 1`] = `"0 zettaoctet"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'bit' } 1`] = `"12,56 bits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'bit-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'bit-per-second' } 1`] = `"12,56 bits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'bit-per-second-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'bits-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'bits-per-second-humanized' } 1`] = `"13 bits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'byte' } 1`] = `"12,56 octeți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'byte-humanized' } 1`] = `"13 octeți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'bytes-humanized' } 1`] = `"13 octeți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'exabit' } 1`] = `"12,56 exabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'exabit-humanized' } 1`] = `"0 exabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'exabit-per-second' } 1`] = `"12,56 exabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'exabit-per-second-humanized' } 1`] = `"0 exabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'exabyte' } 1`] = `"12,56 exaocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'exabyte-humanized' } 1`] = `"0 exaoctet"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'gigabit' } 1`] = `"12,56 gigabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'gigabit-humanized' } 1`] = `"0 gigabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'gigabit-per-second' } 1`] = `"12,56 gigabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'gigabit-per-second-humanized' } 1`] = `"0 gigabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'gigabyte' } 1`] = `"12,56 gigaocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'gigabyte-humanized' } 1`] = `"0 gigaoctet"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'kilobit' } 1`] = `"12,56 kilobits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'kilobit-humanized' } 1`] = `"0,01 kilobits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'kilobit-per-second' } 1`] = `"12,56 kilobits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'kilobit-per-second-humanized' } 1`] = `"0,01 kilobits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'kilobyte' } 1`] = `"12,56 kiloocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'kilobyte-humanized' } 1`] = `"0,01 kiloocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'megabit' } 1`] = `"12,56 megabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'megabit-humanized' } 1`] = `"0 megabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'megabit-per-second' } 1`] = `"12,56 megabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'megabit-per-second-humanized' } 1`] = `"0 megabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'megabyte' } 1`] = `"12,56 megaocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'megabyte-humanized' } 1`] = `"0 megaoctet"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'petabit' } 1`] = `"12,56 petabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'petabit-humanized' } 1`] = `"0 petabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'petabit-per-second' } 1`] = `"12,56 petabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'petabit-per-second-humanized' } 1`] = `"0 petabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'petabyte' } 1`] = `"12,56 petaocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'petabyte-humanized' } 1`] = `"0 petaoctet"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'terabit' } 1`] = `"12,56 terabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'terabit-humanized' } 1`] = `"0 terabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'terabit-per-second' } 1`] = `"12,56 terabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'terabit-per-second-humanized' } 1`] = `"0 terabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'terabyte' } 1`] = `"12,56 teraocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'terabyte-humanized' } 1`] = `"0 teraoctet"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'yottabit' } 1`] = `"12,56 yottabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'yottabit-humanized' } 1`] = `"0 yottabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'yottabit-per-second' } 1`] = `"12,56 yottabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'yottabit-per-second-humanized' } 1`] = `"0 yottabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'yottabyte' } 1`] = `"12,56 yottaocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'yottabyte-humanized' } 1`] = `"0 yottaoctet"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'zettabit' } 1`] = `"12,56 zettabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'zettabit-humanized' } 1`] = `"0 zettabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'zettabit-per-second' } 1`] = `"12,56 zettabits"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'zettabit-per-second-humanized' } 1`] = `"0 zettabit"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'zettabyte' } 1`] = `"12,56 zettaocteți"`; + +exports[`formatUnit > should work with long format, locale ro and { short: false, unit: 'zettabyte-humanized' } 1`] = `"0 zettaoctet"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'bit' } 1`] = `"12,56 b"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'bit-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'bit-per-second' } 1`] = `"12,56 bps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'bit-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'bits-humanized' } 1`] = `"13 b"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'bits-per-second-humanized' } 1`] = `"13 bps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'byte' } 1`] = `"12,56 o"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'byte-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'bytes-humanized' } 1`] = `"13 o"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'exabit' } 1`] = `"12,56 Eb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'exabit-humanized' } 1`] = `"0 Eb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'exabit-per-second' } 1`] = `"12,56 Ebps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'exabit-per-second-humanized' } 1`] = `"0 Ebps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'exabyte' } 1`] = `"12,56 Eo"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'exabyte-humanized' } 1`] = `"0 Eo"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'gigabit' } 1`] = `"12,56 Gb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'gigabit-humanized' } 1`] = `"0 Gb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'gigabit-per-second' } 1`] = `"12,56 Gbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'gigabit-per-second-humanized' } 1`] = `"0 Gbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'gigabyte' } 1`] = `"12,56 Go"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'gigabyte-humanized' } 1`] = `"0 Go"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'kilobit' } 1`] = `"12,56 Kb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'kilobit-humanized' } 1`] = `"0,013 Kb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'kilobit-per-second' } 1`] = `"12,56 Kbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'kilobit-per-second-humanized' } 1`] = `"0,013 Kbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'kilobyte' } 1`] = `"12,56 Ko"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'kilobyte-humanized' } 1`] = `"0,013 Ko"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'megabit' } 1`] = `"12,56 Mb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'megabit-humanized' } 1`] = `"0 Mb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'megabit-per-second' } 1`] = `"12,56 Mbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'megabit-per-second-humanized' } 1`] = `"0 Mbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'megabyte' } 1`] = `"12,56 Mo"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'megabyte-humanized' } 1`] = `"0 Mo"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'petabit' } 1`] = `"12,56 Pb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'petabit-humanized' } 1`] = `"0 Pb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'petabit-per-second' } 1`] = `"12,56 Pbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'petabit-per-second-humanized' } 1`] = `"0 Pbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'petabyte' } 1`] = `"12,56 Po"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'petabyte-humanized' } 1`] = `"0 Po"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'terabit' } 1`] = `"12,56 Tb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'terabit-humanized' } 1`] = `"0 Tb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'terabit-per-second' } 1`] = `"12,56 Tbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'terabit-per-second-humanized' } 1`] = `"0 Tbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'terabyte' } 1`] = `"12,56 To"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'terabyte-humanized' } 1`] = `"0 To"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'yottabit' } 1`] = `"12,56 Yb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'yottabit-humanized' } 1`] = `"0 Yb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'yottabit-per-second' } 1`] = `"12,56 Ybps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'yottabit-per-second-humanized' } 1`] = `"0 Ybps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'yottabyte' } 1`] = `"12,56 Yo"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'yottabyte-humanized' } 1`] = `"0 Yo"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'zettabit' } 1`] = `"12,56 Zb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'zettabit-humanized' } 1`] = `"0 Zb"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'zettabit-per-second' } 1`] = `"12,56 Zbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'zettabit-per-second-humanized' } 1`] = `"0 Zbps"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'zettabyte' } 1`] = `"12,56 Zo"`; + +exports[`formatUnit > should work with maximumFractionDigits { maximumFractionDigits: 3, unit: 'zettabyte-humanized' } 1`] = `"0 Zo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'bit' } 1`] = `"12,000 b"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'bit-humanized' } 1`] = `"12,000 b"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'bit-per-second' } 1`] = `"12,000 bps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'bit-per-second-humanized' } 1`] = `"12,000 bps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'bits-humanized' } 1`] = `"12,000 b"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'bits-per-second-humanized' } 1`] = `"12,000 bps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'byte' } 1`] = `"12,000 o"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'byte-humanized' } 1`] = `"12,000 o"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'bytes-humanized' } 1`] = `"12,000 o"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'exabit' } 1`] = `"12,000 Eb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'exabit-humanized' } 1`] = `"0,000 Eb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'exabit-per-second' } 1`] = `"12,000 Ebps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'exabit-per-second-humanized' } 1`] = `"0,000 Ebps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'exabyte' } 1`] = `"12,000 Eo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'exabyte-humanized' } 1`] = `"0,000 Eo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'gigabit' } 1`] = `"12,000 Gb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'gigabit-humanized' } 1`] = `"0,000 Gb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'gigabit-per-second' } 1`] = `"12,000 Gbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'gigabit-per-second-humanized' } 1`] = `"0,000 Gbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'gigabyte' } 1`] = `"12,000 Go"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'gigabyte-humanized' } 1`] = `"0,000 Go"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'kilobit' } 1`] = `"12,000 Kb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'kilobit-humanized' } 1`] = `"0,010 Kb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'kilobit-per-second' } 1`] = `"12,000 Kbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'kilobit-per-second-humanized' } 1`] = `"0,010 Kbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'kilobyte' } 1`] = `"12,000 Ko"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'kilobyte-humanized' } 1`] = `"0,010 Ko"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'megabit' } 1`] = `"12,000 Mb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'megabit-humanized' } 1`] = `"0,000 Mb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'megabit-per-second' } 1`] = `"12,000 Mbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'megabit-per-second-humanized' } 1`] = `"0,000 Mbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'megabyte' } 1`] = `"12,000 Mo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'megabyte-humanized' } 1`] = `"0,000 Mo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'petabit' } 1`] = `"12,000 Pb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'petabit-humanized' } 1`] = `"0,000 Pb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'petabit-per-second' } 1`] = `"12,000 Pbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'petabit-per-second-humanized' } 1`] = `"0,000 Pbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'petabyte' } 1`] = `"12,000 Po"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'petabyte-humanized' } 1`] = `"0,000 Po"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'terabit' } 1`] = `"12,000 Tb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'terabit-humanized' } 1`] = `"0,000 Tb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'terabit-per-second' } 1`] = `"12,000 Tbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'terabit-per-second-humanized' } 1`] = `"0,000 Tbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'terabyte' } 1`] = `"12,000 To"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'terabyte-humanized' } 1`] = `"0,000 To"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'yottabit' } 1`] = `"12,000 Yb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'yottabit-humanized' } 1`] = `"0,000 Yb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'yottabit-per-second' } 1`] = `"12,000 Ybps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'yottabit-per-second-humanized' } 1`] = `"0,000 Ybps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'yottabyte' } 1`] = `"12,000 Yo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'yottabyte-humanized' } 1`] = `"0,000 Yo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'zettabit' } 1`] = `"12,000 Zb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'zettabit-humanized' } 1`] = `"0,000 Zb"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'zettabit-per-second' } 1`] = `"12,000 Zbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'zettabit-per-second-humanized' } 1`] = `"0,000 Zbps"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'zettabyte' } 1`] = `"12,000 Zo"`; + +exports[`formatUnit > should work with minimumFractionDigits { minimumFractionDigits: 3, unit: 'zettabyte-humanized' } 1`] = `"0,000 Zo"`; diff --git a/packages/use-i18n/src/__tests__/formatDate.ts b/packages/use-i18n/src/__tests__/formatDate.test.ts similarity index 97% rename from packages/use-i18n/src/__tests__/formatDate.ts rename to packages/use-i18n/src/__tests__/formatDate.test.ts index a088586cf..baadf92da 100644 --- a/packages/use-i18n/src/__tests__/formatDate.ts +++ b/packages/use-i18n/src/__tests__/formatDate.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from '@jest/globals' +import { describe, expect, test } from 'vitest' import type { FormatDateOptions } from '../formatDate' import formatDate, { supportedFormats } from '../formatDate' diff --git a/packages/use-i18n/src/__tests__/formatUnit.ts b/packages/use-i18n/src/__tests__/formatUnit.test.ts similarity index 96% rename from packages/use-i18n/src/__tests__/formatUnit.ts rename to packages/use-i18n/src/__tests__/formatUnit.test.ts index d19b35e9c..885a3bc07 100644 --- a/packages/use-i18n/src/__tests__/formatUnit.ts +++ b/packages/use-i18n/src/__tests__/formatUnit.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from '@jest/globals' +import { describe, expect, test } from 'vitest' import type { FormatUnitOptions } from '../formatUnit' import formatUnit, { supportedUnits } from '../formatUnit' diff --git a/packages/use-i18n/src/__tests__/usei18n.tsx b/packages/use-i18n/src/__tests__/usei18n.test.tsx similarity index 90% rename from packages/use-i18n/src/__tests__/usei18n.tsx rename to packages/use-i18n/src/__tests__/usei18n.test.tsx index 692b82584..4d3c374c7 100644 --- a/packages/use-i18n/src/__tests__/usei18n.tsx +++ b/packages/use-i18n/src/__tests__/usei18n.test.tsx @@ -1,15 +1,8 @@ -import { - afterEach, - beforeEach, - describe, - expect, - it, - jest, -} from '@jest/globals' import { act, renderHook, waitFor } from '@testing-library/react' import { enGB, fr as frDateFns } from 'date-fns/locale' import mockdate from 'mockdate' import type { ComponentProps, ReactNode } from 'react' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import I18n, { useI18n, useTranslation } from '..' import en from './locales/en' import es from './locales/es' @@ -86,7 +79,7 @@ const wrapper = describe('i18n hook', () => { beforeEach(() => { - jest.spyOn(window, 'navigator', 'get').mockImplementation( + vi.spyOn(window, 'navigator', 'get').mockImplementation( () => ({ language: 'en-US', @@ -98,45 +91,26 @@ describe('i18n hook', () => { afterEach(() => { localStorage.clear() mockdate.reset() - jest.clearAllMocks() }) it('useTranslation should not be defined without I18nProvider', () => { - const orignalConsoleError = console.error - console.error = jest.fn - - try { - renderHook(() => useTranslation(), { - wrapper: ({ children }: { children: ReactNode }) => ( -
{children}
- ), - }) - } catch (error) { - expect((error as Error).message).toBe( - 'useTranslation must be used within a I18nProvider', - ) - } + const spy = vi.spyOn(console, 'error') + spy.mockImplementation(() => {}) - console.error = orignalConsoleError + expect(() => renderHook(() => useTranslation())).toThrow( + new Error('useTranslation must be used within a I18nProvider'), + ) + spy.mockRestore() }) it('useI18n should not be defined without I18nProvider', () => { - const orignalConsoleError = console.error - console.error = jest.fn - - try { - renderHook(() => useI18n(), { - wrapper: ({ children }: { children: ReactNode }) => ( -
{children}
- ), - }) - } catch (error) { - expect((error as Error).message).toBe( - 'useI18n must be used within a I18nProvider', - ) - } + const spy = vi.spyOn(console, 'error') + spy.mockImplementation(() => {}) - console.error = orignalConsoleError + expect(() => renderHook(() => useI18n())).toThrow( + new Error('useI18n must be used within a I18nProvider'), + ) + spy.mockRestore() }) it('should use defaultLoad, useTranslation, switch local and translate', async () => { @@ -311,19 +285,19 @@ describe('i18n hook', () => { describe('getCurrentLocale', () => { it('should set current locale from localStorage', async () => { - jest.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ + vi.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ languages: ['fr'], } as unknown as Navigator) - const mockGetItem = jest.fn().mockImplementation(() => 'en') - const mockSetItem = jest.fn() - const mockRemoveItem = jest.fn() - const localStorageMock = jest + const mockGetItem = vi.fn().mockImplementation(() => 'en') + const mockSetItem = vi.fn() + const mockRemoveItem = vi.fn() + const localStorageMock = vi .spyOn(global, 'localStorage', 'get') .mockReturnValue({ getItem: mockGetItem, setItem: mockSetItem, removeItem: mockRemoveItem, - clear: jest.fn(), + clear: vi.fn(), } as unknown as Storage) const { result } = renderHook(() => useI18n(), { @@ -342,19 +316,19 @@ describe('i18n hook', () => { }) it('should not set current locale from localStorage when this value is not supported', async () => { - jest.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ + vi.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ languages: ['bz'], } as unknown as Navigator) - const mockGetItem = jest.fn().mockImplementation(() => 're') - const mockSetItem = jest.fn() - const mockRemoveItem = jest.fn() - const localStorageMock = jest + const mockGetItem = vi.fn().mockImplementation(() => 're') + const mockSetItem = vi.fn() + const mockRemoveItem = vi.fn() + const localStorageMock = vi .spyOn(global, 'localStorage', 'get') .mockReturnValue({ getItem: mockGetItem, setItem: mockSetItem, removeItem: mockRemoveItem, - clear: jest.fn(), + clear: vi.fn(), } as unknown as Storage) const { result } = renderHook(() => useI18n(), { @@ -373,19 +347,19 @@ describe('i18n hook', () => { }) it('should set current locale from navigator', async () => { - jest.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ + vi.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ languages: ['fr'], } as unknown as Navigator) - const mockGetItem = jest.fn() - const mockSetItem = jest.fn() - const mockRemoveItem = jest.fn() - const localStorageMock = jest + const mockGetItem = vi.fn() + const mockSetItem = vi.fn() + const mockRemoveItem = vi.fn() + const localStorageMock = vi .spyOn(global, 'localStorage', 'get') .mockReturnValueOnce({ getItem: mockGetItem, setItem: mockSetItem, removeItem: mockRemoveItem, - clear: jest.fn(), + clear: vi.fn(), } as unknown as Storage) const { result } = renderHook(() => useI18n(), { @@ -402,19 +376,19 @@ describe('i18n hook', () => { }) it('should set current locale from defaultLocale', async () => { - jest.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ + vi.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ languages: [], } as unknown as Navigator) - const mockGetItem = jest.fn() - const mockSetItem = jest.fn() - const mockRemoveItem = jest.fn() - const localStorageMock = jest + const mockGetItem = vi.fn() + const mockSetItem = vi.fn() + const mockRemoveItem = vi.fn() + const localStorageMock = vi .spyOn(global, 'localStorage', 'get') .mockReturnValueOnce({ getItem: mockGetItem, setItem: mockSetItem, removeItem: mockRemoveItem, - clear: jest.fn(), + clear: vi.fn(), } as unknown as Storage) const { result } = renderHook(() => useI18n(), { @@ -492,7 +466,7 @@ describe('i18n hook', () => { }) it('should call onTranslateError when there is a sync issue to remove/add variable in one traduction of a language', async () => { - const mockOnTranslateError = jest.fn() + const mockOnTranslateError = vi.fn() const { result } = renderHook(() => useI18n(), { wrapper: wrapper({ @@ -585,7 +559,7 @@ describe('i18n hook', () => { await result.current.switchLocale('fr') }) - // https://stackoverflow.com/questions/58769806/identical-strings-not-matching-in-jest + // https://stackoverflow.com/questions/58769806/identical-strings-not-matching-in-vi // https://stackoverflow.com/questions/54242039/intl-numberformat-space-character-does-not-match await waitFor(() => { @@ -830,19 +804,19 @@ describe('i18n hook', () => { }) it('should load correct date-fns based on current local', async () => { - jest.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ + vi.spyOn(global, 'navigator', 'get').mockReturnValueOnce({ languages: ['fr'], } as unknown as Navigator) - const mockGetItem = jest.fn().mockImplementation(() => 'fr') - const mockSetItem = jest.fn() - const mockRemoveItem = jest.fn() - const localStorageMock = jest + const mockGetItem = vi.fn().mockImplementation(() => 'fr') + const mockSetItem = vi.fn() + const mockRemoveItem = vi.fn() + const localStorageMock = vi .spyOn(global, 'localStorage', 'get') .mockReturnValue({ getItem: mockGetItem, setItem: mockSetItem, removeItem: mockRemoveItem, - clear: jest.fn(), + clear: vi.fn(), } as unknown as Storage) const { result } = renderHook(() => useI18n(), { diff --git a/packages/use-i18n/vite.config.ts b/packages/use-i18n/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-i18n/vite.config.ts +++ b/packages/use-i18n/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-i18n/vitest.setup.ts b/packages/use-i18n/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/use-i18n/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/use-media/package.json b/packages/use-media/package.json index 27c202e22..63585dec2 100644 --- a/packages/use-media/package.json +++ b/packages/use-media/package.json @@ -24,7 +24,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/use-media/src/__tests__/useMedia.tsx b/packages/use-media/src/__tests__/useMedia.test.tsx similarity index 75% rename from packages/use-media/src/__tests__/useMedia.tsx rename to packages/use-media/src/__tests__/useMedia.test.tsx index 14d72d07d..edabeb49b 100644 --- a/packages/use-media/src/__tests__/useMedia.tsx +++ b/packages/use-media/src/__tests__/useMedia.test.tsx @@ -1,5 +1,5 @@ -import { describe, expect, it, jest } from '@jest/globals' import { renderHook } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' import { useMedia } from '..' describe('useMedia hook', () => { @@ -16,15 +16,15 @@ describe('useMedia hook', () => { callback() Object.defineProperty(window, 'matchMedia', { - value: jest.fn().mockImplementation((query: string) => ({ + value: vi.fn().mockImplementation((query: string) => ({ addEventListener: mockAddEventListener, - addListener: jest.fn(), - dispatchEvent: jest.fn(), + addListener: vi.fn(), + dispatchEvent: vi.fn(), matches: false, media: query, onchange: null, - removeEventListener: jest.fn(), - removeListener: jest.fn(), + removeEventListener: vi.fn(), + removeListener: vi.fn(), })), writable: true, }) @@ -44,15 +44,15 @@ describe('useMedia hook', () => { } Object.defineProperty(window, 'matchMedia', { - value: jest.fn().mockImplementation((query: string) => ({ + value: vi.fn().mockImplementation((query: string) => ({ addEventListener: mockAddEventListener, - addListener: jest.fn(), - dispatchEvent: jest.fn(), + addListener: vi.fn(), + dispatchEvent: vi.fn(), matches: false, media: query, onchange: null, - removeEventListener: jest.fn(), - removeListener: jest.fn(), + removeEventListener: vi.fn(), + removeListener: vi.fn(), })), writable: true, }) diff --git a/packages/use-media/vite.config.ts b/packages/use-media/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-media/vite.config.ts +++ b/packages/use-media/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-media/vitest.setup.ts b/packages/use-media/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/use-media/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/use-query-params/package.json b/packages/use-query-params/package.json index 3b1fe1db7..3deb99253 100644 --- a/packages/use-query-params/package.json +++ b/packages/use-query-params/package.json @@ -24,7 +24,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/use-query-params/src/__tests__/index.tsx b/packages/use-query-params/src/__tests__/index.test.tsx similarity index 99% rename from packages/use-query-params/src/__tests__/index.tsx rename to packages/use-query-params/src/__tests__/index.test.tsx index a41bb5720..f4c632def 100644 --- a/packages/use-query-params/src/__tests__/index.tsx +++ b/packages/use-query-params/src/__tests__/index.test.tsx @@ -1,10 +1,10 @@ -import { describe, expect, it, test } from '@jest/globals' import { act, renderHook } from '@testing-library/react' import type { History } from 'history' import { createMemoryHistory } from 'history' import type { ReactNode } from 'react' import { useLayoutEffect, useState } from 'react' import { MemoryRouter, Router } from 'react-router-dom' +import { describe, expect, it, test } from 'vitest' import useQueryParams from '..' const wrapper = diff --git a/packages/use-query-params/vite.config.ts b/packages/use-query-params/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-query-params/vite.config.ts +++ b/packages/use-query-params/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-query-params/vitest.setup.ts b/packages/use-query-params/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/use-query-params/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/use-random-name/package.json b/packages/use-random-name/package.json index 56d3d9404..5190cc35d 100644 --- a/packages/use-random-name/package.json +++ b/packages/use-random-name/package.json @@ -23,7 +23,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/use-random-name/src/__tests__/__snapshots__/index.ts.snap b/packages/use-random-name/src/__tests__/__snapshots__/index.ts.snap deleted file mode 100644 index d26e91275..000000000 --- a/packages/use-random-name/src/__tests__/__snapshots__/index.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`useRandomName useTranslation should not be defined without I18nProvider 1`] = `"gracious-hermann"`; diff --git a/packages/use-random-name/src/__tests__/index.test.ts b/packages/use-random-name/src/__tests__/index.test.ts new file mode 100644 index 000000000..bc84f2e5f --- /dev/null +++ b/packages/use-random-name/src/__tests__/index.test.ts @@ -0,0 +1,10 @@ +import { renderHook } from '@testing-library/react' +import { describe, expect, it } from 'vitest' +import useRandomName from '..' + +describe('useRandomName', () => { + it('useRandomName should not be undefined', () => { + const { result } = renderHook(() => useRandomName()) + expect(result.current).not.toBeUndefined() + }) +}) diff --git a/packages/use-random-name/src/__tests__/index.ts b/packages/use-random-name/src/__tests__/index.ts deleted file mode 100644 index 1de9b079c..000000000 --- a/packages/use-random-name/src/__tests__/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { afterAll, beforeAll, describe, expect, it, jest } from '@jest/globals' -import { renderHook } from '@testing-library/react' -import useRandomName from '..' - -describe('useRandomName', () => { - beforeAll(() => { - jest.spyOn(global.Math, 'random').mockReturnValue(0.4155913669444804) - }) - - afterAll(() => { - jest.spyOn(global.Math, 'random').mockRestore() - }) - - it('useTranslation should not be defined without I18nProvider', () => { - const { result } = renderHook(() => useRandomName()) - expect(result.current).toMatchSnapshot() - }) -}) diff --git a/packages/use-random-name/vite.config.ts b/packages/use-random-name/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-random-name/vite.config.ts +++ b/packages/use-random-name/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-random-name/vitest.setup.ts b/packages/use-random-name/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/use-random-name/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/use-segment/.eslintignore b/packages/use-segment/.eslintignore index 3a0b347c0..68f8bbb0d 100644 --- a/packages/use-segment/.eslintignore +++ b/packages/use-segment/.eslintignore @@ -2,3 +2,4 @@ dist/ coverage/ node_modules .reports/ +coverage/ \ No newline at end of file diff --git a/packages/use-segment/package.json b/packages/use-segment/package.json index 146505448..5a06cf41e 100644 --- a/packages/use-segment/package.json +++ b/packages/use-segment/package.json @@ -23,7 +23,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/use-segment/src/__tests__/SegmentProvider.test.tsx b/packages/use-segment/src/__tests__/SegmentProvider.test.tsx index 23b8c05ca..0fe638c88 100644 --- a/packages/use-segment/src/__tests__/SegmentProvider.test.tsx +++ b/packages/use-segment/src/__tests__/SegmentProvider.test.tsx @@ -1,23 +1,15 @@ -import { afterAll, describe, expect, it, jest } from '@jest/globals' import type { Context } from '@segment/analytics-next' import { AnalyticsBrowser } from '@segment/analytics-next' import { render, screen, waitFor } from '@testing-library/react' +import { describe, expect, it, vi } from 'vitest' import SegmentProvider from '..' import type { Analytics } from '../index' const TestChildren = () =>
children
describe('SegmentProvider', () => { - beforeEach(() => { - jest.clearAllMocks() - }) - - afterAll(() => { - jest.restoreAllMocks() - }) - it('Provider should render children when shouldRenderOnlyWhenReady is false', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -44,7 +36,7 @@ describe('SegmentProvider', () => { }) it('Provider should not render children when options are not loaded ', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -72,7 +64,7 @@ describe('SegmentProvider', () => { }) it('Provider should not render children when options are not loaded at first render, but load after options changed', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -120,7 +112,7 @@ describe('SegmentProvider', () => { }) it('Provider should not render children when options are not loaded at first render, but load after options changed even without settings', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) diff --git a/packages/use-segment/src/__tests__/index.tsx b/packages/use-segment/src/__tests__/index.tsx index 6f9bcc7a5..d98ddb015 100644 --- a/packages/use-segment/src/__tests__/index.tsx +++ b/packages/use-segment/src/__tests__/index.tsx @@ -1,8 +1,8 @@ -import { beforeEach, describe, expect, it, jest } from '@jest/globals' import type { Context } from '@segment/analytics-next' import { AnalyticsBrowser } from '@segment/analytics-next' import { renderHook, waitFor } from '@testing-library/react' import type { ReactNode } from 'react' +import { beforeEach, describe, expect, it, vi } from 'vitest' import waitForExpect from 'wait-for-expect' import SegmentProvider, { useSegment } from '..' import type { Analytics, OnEventError, SegmentProviderProps } from '..' @@ -68,16 +68,16 @@ const wrapper = describe('segment hook', () => { beforeEach(() => { - jest.clearAllMocks() + vi.clearAllMocks() }) afterAll(() => { - jest.restoreAllMocks() + vi.restoreAllMocks() }) it('useSegment should not be defined without SegmentProvider', () => { const orignalConsoleError = console.error - console.error = jest.fn + console.error = vi.fn try { renderHook(() => useSegment()) @@ -91,7 +91,7 @@ describe('segment hook', () => { }) it('useSegment should not be ready and not load by default', () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -131,7 +131,7 @@ describe('segment hook', () => { }) it('useSegment should not load but be ready when All integrations disabled', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -152,7 +152,7 @@ describe('segment hook', () => { }) it('useSegment should not load but be ready when all integrations are disabled ', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -181,7 +181,7 @@ describe('segment hook', () => { }) it('useSegment should load when at least one integrations enabled', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -210,7 +210,7 @@ describe('segment hook', () => { }) it('Provider should not load when options are not loaded', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -235,7 +235,7 @@ describe('segment hook', () => { }) it('Provider should load with key', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -261,7 +261,7 @@ describe('segment hook', () => { }) it('Provider should load with key and cdn', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) @@ -287,9 +287,9 @@ describe('segment hook', () => { it('Provider should load and call onError on analytics load error', async () => { const error = new Error('not good') - const mock = jest.spyOn(AnalyticsBrowser, 'load').mockRejectedValue(error) + const mock = vi.spyOn(AnalyticsBrowser, 'load').mockRejectedValue(error) - const onError = jest.fn() + const onError = vi.fn() const settings = { writeKey: 'pleasethrow' } const { result } = renderHook(() => useSegment(), { @@ -315,12 +315,12 @@ describe('segment hook', () => { }) it('Provider call onEventError when an event is trigger with an error', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) - const onEventError = jest.fn() - const onError = jest.fn() + const onEventError = vi.fn() + const onError = vi.fn() const settings = { writeKey: 'pleasethrow' } @@ -349,7 +349,7 @@ describe('segment hook', () => { }) it('Provider should load with settings and initOptions', async () => { - const mock = jest + const mock = vi .spyOn(AnalyticsBrowser, 'load') .mockResolvedValue([{} as Analytics, {} as Context]) diff --git a/packages/use-segment/vite.config.ts b/packages/use-segment/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-segment/vite.config.ts +++ b/packages/use-segment/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-segment/vitest.setup.ts b/packages/use-segment/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/use-segment/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/use-storage/package.json b/packages/use-storage/package.json index d08576bbf..e257c5276 100644 --- a/packages/use-storage/package.json +++ b/packages/use-storage/package.json @@ -24,7 +24,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages/use-storage/src/__tests__/index.client.ts b/packages/use-storage/src/__tests__/index.client.test.ts similarity index 98% rename from packages/use-storage/src/__tests__/index.client.ts rename to packages/use-storage/src/__tests__/index.client.test.ts index 26d61c661..d9cf1ee13 100644 --- a/packages/use-storage/src/__tests__/index.client.ts +++ b/packages/use-storage/src/__tests__/index.client.test.ts @@ -1,9 +1,9 @@ /** - * @jest-environment jsdom + * @vitest-environment jsdom */ -import { afterEach, describe, expect, it } from '@jest/globals' import { act, renderHook } from '@testing-library/react' +import { afterEach, describe, expect, it } from 'vitest' import { useLocalStorage, useSessionStorage } from '..' const KEY = 'test' diff --git a/packages/use-storage/src/__tests__/index.server.ts b/packages/use-storage/src/__tests__/index.server.test.ts similarity index 95% rename from packages/use-storage/src/__tests__/index.server.ts rename to packages/use-storage/src/__tests__/index.server.test.ts index f4ec8f6ce..41143d6b3 100644 --- a/packages/use-storage/src/__tests__/index.server.ts +++ b/packages/use-storage/src/__tests__/index.server.test.ts @@ -1,9 +1,9 @@ /** - * @jest-environment node + * @vitest-environment node */ -import { describe, expect, it } from '@jest/globals' import { act, renderHook } from '@testing-library/react/pure' +import { describe, expect, it } from 'vitest' import { useLocalStorage, useSessionStorage } from '..' const KEY = 'test' diff --git a/packages/use-storage/vite.config.ts b/packages/use-storage/vite.config.ts index a9bed28d6..b4a1bf9dd 100644 --- a/packages/use-storage/vite.config.ts +++ b/packages/use-storage/vite.config.ts @@ -1,6 +1,9 @@ -/* eslint-disable eslint-comments/disable-enable-pair */ -/* eslint-disable import/no-relative-packages */ import { defineConfig, mergeConfig } from 'vite' import { defaultConfig } from '../../vite.config' -export default mergeConfig(defineConfig(defaultConfig), {}) +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages/use-storage/vitest.setup.ts b/packages/use-storage/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages/use-storage/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/packages/jest-helpers/.eslintignore b/packages_deprecated/jest-helpers/.eslintignore similarity index 100% rename from packages/jest-helpers/.eslintignore rename to packages_deprecated/jest-helpers/.eslintignore diff --git a/packages/jest-helpers/.npmignore b/packages_deprecated/jest-helpers/.npmignore similarity index 100% rename from packages/jest-helpers/.npmignore rename to packages_deprecated/jest-helpers/.npmignore diff --git a/packages/jest-helpers/CHANGELOG.md b/packages_deprecated/jest-helpers/CHANGELOG.md similarity index 100% rename from packages/jest-helpers/CHANGELOG.md rename to packages_deprecated/jest-helpers/CHANGELOG.md diff --git a/packages/jest-helpers/README.md b/packages_deprecated/jest-helpers/README.md similarity index 100% rename from packages/jest-helpers/README.md rename to packages_deprecated/jest-helpers/README.md diff --git a/packages/jest-helpers/package.json b/packages_deprecated/jest-helpers/package.json similarity index 100% rename from packages/jest-helpers/package.json rename to packages_deprecated/jest-helpers/package.json diff --git a/packages/jest-helpers/src/__tests__/__snapshots__/index.test.tsx.snap b/packages_deprecated/jest-helpers/src/__tests__/__snapshots__/index.test.tsx.snap similarity index 100% rename from packages/jest-helpers/src/__tests__/__snapshots__/index.test.tsx.snap rename to packages_deprecated/jest-helpers/src/__tests__/__snapshots__/index.test.tsx.snap diff --git a/packages/jest-helpers/src/__tests__/index.test.tsx b/packages_deprecated/jest-helpers/src/__tests__/index.test.tsx similarity index 90% rename from packages/jest-helpers/src/__tests__/index.test.tsx rename to packages_deprecated/jest-helpers/src/__tests__/index.test.tsx index 4bd4c3bd4..826149c0b 100644 --- a/packages/jest-helpers/src/__tests__/index.test.tsx +++ b/packages_deprecated/jest-helpers/src/__tests__/index.test.tsx @@ -1,10 +1,10 @@ -import { beforeAll, describe, expect, it, jest, test } from '@jest/globals' +import { beforeAll, describe, expect, it, test, vi } from 'vitest' import makeHelpers from '..' import type { RenderWithThemeFn } from '../helpers/renderWithTheme' import type { ShouldMatchEmotionSnapshotFn } from '../helpers/shouldMatchEmotionSnapshot' import type { ShouldMatchEmotionSnapshotWithPortalFn } from '../helpers/shouldMatchEmotionSnapshotWithPortal' -describe('@jest-helpers', () => { +describe('@vi-helpers', () => { let renderWithTheme: RenderWithThemeFn let shouldMatchEmotionSnapshot: ShouldMatchEmotionSnapshotFn let shouldMatchEmotionSnapshotWithPortal: ShouldMatchEmotionSnapshotWithPortalFn @@ -32,7 +32,7 @@ describe('@jest-helpers', () => { }) test('should call tranform with shouldMatchEmotionSnapshot', async () => { - const transform = jest.fn() + const transform = vi.fn() await shouldMatchEmotionSnapshot(
, { transform }) expect(transform).toHaveBeenCalledTimes(1) @@ -43,7 +43,7 @@ describe('@jest-helpers', () => { }) it('should call transform with shouldMatchEmotionSnapshot', async () => { - const transform = jest.fn() + const transform = vi.fn() await shouldMatchEmotionSnapshotWithPortal(
, { transform }) expect(transform).toHaveBeenCalledTimes(1) diff --git a/packages/jest-helpers/src/helpers/renderWithTheme.tsx b/packages_deprecated/jest-helpers/src/helpers/renderWithTheme.tsx similarity index 100% rename from packages/jest-helpers/src/helpers/renderWithTheme.tsx rename to packages_deprecated/jest-helpers/src/helpers/renderWithTheme.tsx diff --git a/packages/jest-helpers/src/helpers/shouldMatchEmotionSnapshot.ts b/packages_deprecated/jest-helpers/src/helpers/shouldMatchEmotionSnapshot.ts similarity index 100% rename from packages/jest-helpers/src/helpers/shouldMatchEmotionSnapshot.ts rename to packages_deprecated/jest-helpers/src/helpers/shouldMatchEmotionSnapshot.ts diff --git a/packages/jest-helpers/src/helpers/shouldMatchEmotionSnapshotWithPortal.ts b/packages_deprecated/jest-helpers/src/helpers/shouldMatchEmotionSnapshotWithPortal.ts similarity index 100% rename from packages/jest-helpers/src/helpers/shouldMatchEmotionSnapshotWithPortal.ts rename to packages_deprecated/jest-helpers/src/helpers/shouldMatchEmotionSnapshotWithPortal.ts diff --git a/packages/jest-helpers/src/index.ts b/packages_deprecated/jest-helpers/src/index.ts similarity index 100% rename from packages/jest-helpers/src/index.ts rename to packages_deprecated/jest-helpers/src/index.ts diff --git a/packages/use-gtm/.eslintignore b/packages_deprecated/use-gtm/.eslintignore similarity index 100% rename from packages/use-gtm/.eslintignore rename to packages_deprecated/use-gtm/.eslintignore diff --git a/packages/use-gtm/.eslintrc.cjs b/packages_deprecated/use-gtm/.eslintrc.cjs similarity index 100% rename from packages/use-gtm/.eslintrc.cjs rename to packages_deprecated/use-gtm/.eslintrc.cjs diff --git a/packages/use-gtm/.npmignore b/packages_deprecated/use-gtm/.npmignore similarity index 100% rename from packages/use-gtm/.npmignore rename to packages_deprecated/use-gtm/.npmignore diff --git a/packages/use-gtm/CHANGELOG.md b/packages_deprecated/use-gtm/CHANGELOG.md similarity index 100% rename from packages/use-gtm/CHANGELOG.md rename to packages_deprecated/use-gtm/CHANGELOG.md diff --git a/packages/use-gtm/README.md b/packages_deprecated/use-gtm/README.md similarity index 100% rename from packages/use-gtm/README.md rename to packages_deprecated/use-gtm/README.md diff --git a/packages/use-gtm/package.json b/packages_deprecated/use-gtm/package.json similarity index 87% rename from packages/use-gtm/package.json rename to packages_deprecated/use-gtm/package.json index 66fa32be2..bb3439207 100644 --- a/packages/use-gtm/package.json +++ b/packages_deprecated/use-gtm/package.json @@ -24,7 +24,9 @@ "type:generate": "tsc --declaration -p tsconfig.build.json", "build": "vite build --config vite.config.ts && pnpm run type:generate", "build:profile": "npx vite-bundle-visualizer -c vite.config.ts", - "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx ." + "lint": "eslint --report-unused-disable-directives --cache --cache-strategy content --ext ts,tsx .", + "test:unit": "vitest --run --config vite.config.ts", + "test:unit:coverage": "pnpm test:unit --coverage" }, "repository": { "type": "git", diff --git a/packages_deprecated/use-gtm/src/__tests__/__snapshots__/index.test.tsx.snap b/packages_deprecated/use-gtm/src/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 000000000..69af6aec9 --- /dev/null +++ b/packages_deprecated/use-gtm/src/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,65 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`GTM hook > Provider should call onLoadError if script fail to load 1`] = ` +"" +`; + +exports[`GTM hook > Provider should load env when environment auth is missing 1`] = ` +"" +`; + +exports[`GTM hook > Provider should load when id and environment is provided 1`] = ` +"" +`; + +exports[`GTM hook > Provider should load when id is provided 1`] = ` +"" +`; + +exports[`GTM hook > Provider should load with events when provided 1`] = `undefined`; + +exports[`GTM hook > Provider should not load when no id is provided 1`] = `""`; diff --git a/packages/use-gtm/src/__tests__/__snapshots__/index.tsx.snap b/packages_deprecated/use-gtm/src/__tests__/__snapshots__/index.tsx.snap similarity index 100% rename from packages/use-gtm/src/__tests__/__snapshots__/index.tsx.snap rename to packages_deprecated/use-gtm/src/__tests__/__snapshots__/index.tsx.snap diff --git a/packages/use-gtm/src/__tests__/index.tsx b/packages_deprecated/use-gtm/src/__tests__/index.test.tsx similarity index 95% rename from packages/use-gtm/src/__tests__/index.tsx rename to packages_deprecated/use-gtm/src/__tests__/index.test.tsx index d6fb2f53d..73c6a96cc 100644 --- a/packages/use-gtm/src/__tests__/index.tsx +++ b/packages_deprecated/use-gtm/src/__tests__/index.test.tsx @@ -1,14 +1,7 @@ -import { - afterEach, - beforeEach, - describe, - expect, - it, - jest, -} from '@jest/globals' import { fireEvent, renderHook } from '@testing-library/react' import mockdate from 'mockdate' import type { ReactNode } from 'react' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { SendGTM } from '..' import GTMProvider, { useGTM } from '..' import type { GTMProviderProps } from '../useGTM' @@ -51,12 +44,12 @@ describe('GTM hook', () => { mockdate.reset() document.head.innerHTML = '' window.dataLayer = undefined - jest.restoreAllMocks() + vi.restoreAllMocks() }) it('useGTM should not be defined without GTMProvider', () => { const orignalConsoleError = console.error - console.error = jest.fn + console.error = vi.fn try { renderHook(() => useGTM()) @@ -140,7 +133,7 @@ describe('GTM hook', () => { }) it('Provider should load onLoadError when script fail to load', () => { - const onLoadError = jest.fn() + const onLoadError = vi.fn() renderHook(() => useGTM(), { wrapper: wrapper({ diff --git a/packages/use-gtm/src/index.ts b/packages_deprecated/use-gtm/src/index.ts similarity index 100% rename from packages/use-gtm/src/index.ts rename to packages_deprecated/use-gtm/src/index.ts diff --git a/packages/use-gtm/src/scripts.ts b/packages_deprecated/use-gtm/src/scripts.ts similarity index 100% rename from packages/use-gtm/src/scripts.ts rename to packages_deprecated/use-gtm/src/scripts.ts diff --git a/packages/use-gtm/src/types.ts b/packages_deprecated/use-gtm/src/types.ts similarity index 100% rename from packages/use-gtm/src/types.ts rename to packages_deprecated/use-gtm/src/types.ts diff --git a/packages/use-gtm/src/useGTM.tsx b/packages_deprecated/use-gtm/src/useGTM.tsx similarity index 100% rename from packages/use-gtm/src/useGTM.tsx rename to packages_deprecated/use-gtm/src/useGTM.tsx diff --git a/packages/use-gtm/tsconfig.build.json b/packages_deprecated/use-gtm/tsconfig.build.json similarity index 100% rename from packages/use-gtm/tsconfig.build.json rename to packages_deprecated/use-gtm/tsconfig.build.json diff --git a/packages/jest-helpers/tsconfig.json b/packages_deprecated/use-gtm/tsconfig.json similarity index 100% rename from packages/jest-helpers/tsconfig.json rename to packages_deprecated/use-gtm/tsconfig.json diff --git a/packages_deprecated/use-gtm/vite.config.ts b/packages_deprecated/use-gtm/vite.config.ts new file mode 100644 index 000000000..b4a1bf9dd --- /dev/null +++ b/packages_deprecated/use-gtm/vite.config.ts @@ -0,0 +1,9 @@ +import { defineConfig, mergeConfig } from 'vite' +import { defaultConfig } from '../../vite.config' + +export default mergeConfig(defineConfig(defaultConfig), { + test: { + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'], + }, +}) diff --git a/packages_deprecated/use-gtm/vitest.setup.ts b/packages_deprecated/use-gtm/vitest.setup.ts new file mode 100644 index 000000000..b49124c8b --- /dev/null +++ b/packages_deprecated/use-gtm/vitest.setup.ts @@ -0,0 +1,11 @@ +/* eslint-disable eslint-comments/disable-enable-pair */ +import * as matchers from '@testing-library/jest-dom/matchers' +import '@testing-library/jest-dom/vitest' +import { cleanup } from '@testing-library/react' +import { afterEach, expect } from 'vitest' + +expect.extend(matchers) + +afterEach(() => { + cleanup() +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4cc28f41f..4c19c3b55 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,9 +38,6 @@ importers: '@commitlint/config-conventional': specifier: 19.2.2 version: 19.2.2 - '@jest/globals': - specifier: 29.7.0 - version: 29.7.0 '@scaleway/eslint-config-react': specifier: workspace:* version: link:packages/eslint-config-react @@ -49,7 +46,7 @@ importers: version: link:packages/tsconfig '@testing-library/jest-dom': specifier: 6.4.2 - version: 6.4.2(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0)) + version: 6.4.2(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0))(vitest@1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3)) '@testing-library/react': specifier: 15.0.2 version: 15.0.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -68,6 +65,9 @@ importers: '@vitejs/plugin-react': specifier: 4.2.1 version: 4.2.1(vite@5.2.10(@types/node@20.12.7)) + '@vitest/coverage-istanbul': + specifier: ^1.5.1 + version: 1.5.1(vitest@1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3)) browserslist: specifier: 4.23.0 version: 4.23.0 @@ -83,21 +83,12 @@ importers: eslint: specifier: 8.57.0 version: 8.57.0 + happy-dom: + specifier: ^14.7.1 + version: 14.7.1 husky: specifier: 9.0.11 version: 9.0.11 - jest: - specifier: 29.7.0 - version: 29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0) - jest-environment-jsdom: - specifier: 29.7.0 - version: 29.7.0 - jest-junit: - specifier: 16.0.0 - version: 16.0.0 - jest-localstorage-mock: - specifier: 2.4.26 - version: 2.4.26 lint-staged: specifier: 15.2.2 version: 15.2.2 @@ -119,6 +110,12 @@ importers: vite: specifier: 5.2.10 version: 5.2.10(@types/node@20.12.7) + vitest: + specifier: 1.5.0 + version: 1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3) + vitest-localstorage-mock: + specifier: 0.1.2 + version: 0.1.2(vitest@1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3)) wait-for-expect: specifier: 3.0.2 version: 3.0.2 @@ -191,31 +188,6 @@ importers: specifier: 5.4.5 version: 5.4.5 - packages/jest-helpers: - dependencies: - '@emotion/cache': - specifier: 11.11.0 - version: 11.11.0 - '@emotion/jest': - specifier: 11.11.0 - version: 11.11.0(@types/jest@29.5.12) - '@emotion/react': - specifier: 11.11.4 - version: 11.11.4(@types/react@18.2.79)(react@18.2.0) - '@jest/globals': - specifier: 29.7.0 - version: 29.7.0 - '@testing-library/react': - specifier: 15.0.2 - version: 15.0.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0) - devDependencies: - react: - specifier: 18.2.0 - version: 18.2.0 - react-dom: - specifier: 18.2.0 - version: 18.2.0(react@18.2.0) - packages/outdated-browser: {} packages/random-name: {} @@ -240,12 +212,6 @@ importers: specifier: 18.2.0 version: 18.2.0 - packages/use-gtm: - dependencies: - react: - specifier: 18.x || 18 - version: 18.2.0 - packages/use-i18n: dependencies: '@formatjs/ecma402-abstract': @@ -1145,67 +1111,12 @@ packages: resolution: {integrity: sha512-tpyc+7i6bPG9mvaBbtKUeghfyZSDgWquIDfMgqYtTbmZ9Y9VzEm2je9EYcQ0aoz5o7NvGS+rcDec93yO08MHYA==} engines: {node: '>=v18'} - '@emotion/babel-plugin@11.11.0': - resolution: {integrity: sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ==} - - '@emotion/cache@11.11.0': - resolution: {integrity: sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ==} - - '@emotion/css-prettifier@1.1.3': - resolution: {integrity: sha512-KNv23+VQ+pcw3ebd1vSEl11CQ6SKAG5EQkrinjVGsfw3ZTWe6/tpWQrsvFLqCtU2LRiLPi04KgFCE4A9+crfpQ==} - '@emotion/eslint-plugin@11.11.0': resolution: {integrity: sha512-jCOYqU/0Sqm+g+6D7QuIlG99q8YAF0T7BP98zQF/MPZKfbcm46z5mizXn0YlhZ9AYZfNtZ1DeODXdncYxZzR4Q==} engines: {node: '>=6'} peerDependencies: eslint: 6 || 7 || 8 - '@emotion/hash@0.9.1': - resolution: {integrity: sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ==} - - '@emotion/jest@11.11.0': - resolution: {integrity: sha512-XZlnmdUZ32YjQnInsCFk/plKpkV/NXN1Ab4YoNvXN887MeR3Hr5ZsTyoblIW8AWwdfQiZHHphaPMb56lk6Ofdw==} - peerDependencies: - '@types/jest': ^26.0.14 || ^27.0.0 || ^28.0.0 || ^29.0.0 - enzyme-to-json: ^3.2.1 - peerDependenciesMeta: - '@types/jest': - optional: true - enzyme-to-json: - optional: true - - '@emotion/memoize@0.8.1': - resolution: {integrity: sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA==} - - '@emotion/react@11.11.4': - resolution: {integrity: sha512-t8AjMlF0gHpvvxk5mAtCqR4vmxiGHCeJBaQO6gncUSdklELOgtwjerNY2yuJNfwnc6vi16U/+uMF+afIawJ9iw==} - peerDependencies: - '@types/react': '*' - react: '>=16.8.0' - peerDependenciesMeta: - '@types/react': - optional: true - - '@emotion/serialize@1.1.4': - resolution: {integrity: sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ==} - - '@emotion/sheet@1.2.2': - resolution: {integrity: sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA==} - - '@emotion/unitless@0.8.1': - resolution: {integrity: sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ==} - - '@emotion/use-insertion-effect-with-fallbacks@1.0.1': - resolution: {integrity: sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==} - peerDependencies: - react: '>=16.8.0' - - '@emotion/utils@1.2.1': - resolution: {integrity: sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg==} - - '@emotion/weak-memoize@0.3.1': - resolution: {integrity: sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww==} - '@esbuild/aix-ppc64@0.20.2': resolution: {integrity: sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==} engines: {node: '>=12'} @@ -2245,9 +2156,6 @@ packages: '@types/jest@29.5.12': resolution: {integrity: sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==} - '@types/jsdom@20.0.1': - resolution: {integrity: sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==} - '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} @@ -2284,9 +2192,6 @@ packages: '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} - '@types/tough-cookie@4.0.5': - resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} - '@types/yargs-parser@21.0.3': resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} @@ -2387,6 +2292,26 @@ packages: peerDependencies: vite: ^4.2.0 || ^5.0.0 + '@vitest/coverage-istanbul@1.5.1': + resolution: {integrity: sha512-E8H34Ul4djgxyF6yss767qbfqw+4HrXVfUUufolL9MdK6gVH568aWV/VYQCfnh3+AIwZyjZrdZZH9f2L6zYxig==} + peerDependencies: + vitest: 1.5.1 + + '@vitest/expect@1.5.0': + resolution: {integrity: sha512-0pzuCI6KYi2SIC3LQezmxujU9RK/vwC1U9R0rLuGlNGcOuDWxqWKu6nUdFsX9tH1WU0SXtAxToOsEjeUn1s3hA==} + + '@vitest/runner@1.5.0': + resolution: {integrity: sha512-7HWwdxXP5yDoe7DTpbif9l6ZmDwCzcSIK38kTSIt6CFEpMjX4EpCgT6wUmS0xTXqMI6E/ONmfgRKmaujpabjZQ==} + + '@vitest/snapshot@1.5.0': + resolution: {integrity: sha512-qpv3fSEuNrhAO3FpH6YYRdaECnnRjg9VxbhdtPwPRnzSfHVXnNzzrpX4cJxqiwgRMo7uRMWDFBlsBq4Cr+rO3A==} + + '@vitest/spy@1.5.0': + resolution: {integrity: sha512-vu6vi6ew5N5MMHJjD5PoakMRKYdmIrNJmyfkhRpQt5d9Ewhw9nZ5Aqynbi3N61bvk9UvZ5UysMT6ayIrZ8GA9w==} + + '@vitest/utils@1.5.0': + resolution: {integrity: sha512-BDU0GNL8MWkRkSRdNFvCUCAVOeHaUlVJ9Tx0TYBZyXaaOTmGtUFObzchCivIBrIwKzvZA7A9sCejVhXM2aY98A==} + JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} hasBin: true @@ -2516,6 +2441,9 @@ packages: resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} engines: {node: '>=0.10.0'} + assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + ast-types-flow@0.0.8: resolution: {integrity: sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==} @@ -2612,6 +2540,10 @@ packages: resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} engines: {node: '>=6'} + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} @@ -2635,6 +2567,10 @@ packages: caniuse-lite@1.0.30001610: resolution: {integrity: sha512-QFutAY4NgaelojVMjY63o6XlZyORPaLfyMnsl3HgnWdJUcX6K0oaJymHjH8PT5Gk7sTm8rvC/c5COUQKXqmOMA==} + chai@4.4.1: + resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} + engines: {node: '>=4'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -2658,6 +2594,9 @@ packages: chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + ci-info@3.9.0: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} @@ -2721,6 +2660,9 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + confbox@0.1.7: + resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} + confusing-browser-globals@1.0.11: resolution: {integrity: sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==} @@ -2737,9 +2679,6 @@ packages: engines: {node: '>=16'} hasBin: true - convert-source-map@1.9.0: - resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} - convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} @@ -2894,6 +2833,10 @@ packages: babel-plugin-macros: optional: true + deep-eql@4.1.3: + resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + engines: {node: '>=6'} + deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -3334,6 +3277,9 @@ packages: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} @@ -3399,9 +3345,6 @@ packages: resolution: {integrity: sha512-qWeTREPoT7I0bifpPUXtxkZJ1XJzxWtfoWWkdVGqa+eCr3SHW/Ocp89o8vLvbUuQnadybJpjOKu4V+RwO6sGng==} engines: {node: '>=14.16'} - find-root@1.1.0: - resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==} - find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -3469,6 +3412,9 @@ packages: resolution: {integrity: sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==} engines: {node: '>=18'} + get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -3541,6 +3487,10 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + happy-dom@14.7.1: + resolution: {integrity: sha512-v60Q0evZ4clvMcrAh5/F8EdxDdfHdFrtffz/CNe10jKD+nFweZVxM91tW+UyY2L4AtpgIaXdZ7TQmiO1pfcwbg==} + engines: {node: '>=16.0.0'} + hard-rejection@2.1.0: resolution: {integrity: sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==} engines: {node: '>=6'} @@ -3578,9 +3528,6 @@ packages: history@5.3.0: resolution: {integrity: sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==} - hoist-non-react-statics@3.3.2: - resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==} - hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} @@ -3851,6 +3798,10 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} + istanbul-lib-source-maps@5.0.4: + resolution: {integrity: sha512-wHOoEsNJTVltaJp8eVkm8w+GVkVNHT2YDYo53YdzQEL2gWm1hBX5cGFR9hQJtuGLebidVX7et3+dmDZrmclduw==} + engines: {node: '>=10'} + istanbul-reports@3.1.7: resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==} engines: {node: '>=8'} @@ -3900,15 +3851,6 @@ packages: resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - jest-environment-jsdom@29.7.0: - resolution: {integrity: sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - canvas: ^2.5.0 - peerDependenciesMeta: - canvas: - optional: true - jest-environment-node@29.7.0: resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -3921,18 +3863,10 @@ packages: resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - jest-junit@16.0.0: - resolution: {integrity: sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==} - engines: {node: '>=10.12.0'} - jest-leak-detector@29.7.0: resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - jest-localstorage-mock@2.4.26: - resolution: {integrity: sha512-owAJrYnjulVlMIXOYQIPRCCn3MmqI3GzgfZCXdD3/pmwrIvFMXcKVWZ+aMc44IzaASapg0Z4SEFxR+v5qxDA2w==} - engines: {node: '>=6.16.0'} - jest-matcher-utils@29.7.0: resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -4015,6 +3949,9 @@ packages: js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + js-tokens@9.0.0: + resolution: {integrity: sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==} + js-yaml@3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} hasBin: true @@ -4126,6 +4063,10 @@ packages: resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} engines: {node: '>=6'} + local-pkg@0.5.0: + resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} + engines: {node: '>=14'} + locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -4179,6 +4120,9 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true + loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + lru-cache@10.2.0: resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} engines: {node: 14 || >=16.14} @@ -4197,6 +4141,12 @@ packages: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true + magic-string@0.30.10: + resolution: {integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==} + + magicast@0.3.4: + resolution: {integrity: sha512-TyDF/Pn36bBji9rWKHlZe+PZb6Mx5V8IHCSxk7X4aljM4e/vyDvZZYwHewdVaqiA0nb3ghfHU/6AUpDxWoER2Q==} + make-dir@4.0.0: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} engines: {node: '>=10'} @@ -4273,10 +4223,8 @@ packages: resolution: {integrity: sha512-5H76ANWinB1H3twpJ6JY8uvAtpmFvHNArpilJAjXRKXSDDLPIMoZArw5SH0q9z+lLs8IrMw7Q2VWpWimFKFT1Q==} engines: {node: '>= 8.0.0'} - mkdirp@1.0.4: - resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} - engines: {node: '>=10'} - hasBin: true + mlly@1.6.1: + resolution: {integrity: sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==} mockdate@3.0.5: resolution: {integrity: sha512-iniQP4rj1FhBdBYS/+eQv7j1tadJ9lJtdzgOpvsOHng/GbcDh2Fhdeq+ZRldrPYdXvCyfFUmFeEwEGXZB5I/AQ==} @@ -4418,6 +4366,10 @@ packages: resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + p-limit@5.0.0: + resolution: {integrity: sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==} + engines: {node: '>=18'} + p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -4484,6 +4436,12 @@ packages: resolution: {integrity: sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==} engines: {node: '>=12'} + pathe@1.1.2: + resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + + pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} @@ -4508,6 +4466,9 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} + pkg-types@1.1.0: + resolution: {integrity: sha512-/RpmvKdxKf8uILTtoOhAgf30wYbP2Qw+L9p3Rvshx1JZVX+XQNZQFjlbmGHEGIm4CkVPlSn+NXmIM8+9oWQaSA==} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} @@ -4783,6 +4744,9 @@ packages: resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} engines: {node: '>= 0.4'} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -4824,10 +4788,6 @@ packages: source-map-support@0.5.13: resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} - source-map@0.5.7: - resolution: {integrity: sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==} - engines: {node: '>=0.10.0'} - source-map@0.6.1: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} @@ -4850,10 +4810,6 @@ packages: spdx-license-ids@3.0.17: resolution: {integrity: sha512-sh8PWc/ftMqAAdFiBu6Fy6JUOYjqDJBJvIhpfDMyHrr0Rbp5liZqd4TjtQ/RgfLjKFZb+LMx5hpml5qOWy0qvg==} - specificity@0.4.1: - resolution: {integrity: sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==} - hasBin: true - split-on-first@3.0.0: resolution: {integrity: sha512-qxQJTx2ryR0Dw0ITYyekNQWpz6f8dGd7vffGNflQQ3Iqj9NJ6qiZ7ELpZsJ/QBhIVAiDfXdag3+Gp8RvWa62AA==} engines: {node: '>=12'} @@ -4869,6 +4825,12 @@ packages: resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} engines: {node: '>=10'} + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.7.0: + resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} + stream-transform@2.1.3: resolution: {integrity: sha512-9GHUiM5hMiCi6Y03jD2ARC1ettBXkQBoQAe7nJsPknnI0ow10aXjTnew8QtYQmLjzn974BnmWEAJgCY6ZP1DeQ==} @@ -4935,8 +4897,8 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} - stylis@4.2.0: - resolution: {integrity: sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==} + strip-literal@2.1.0: + resolution: {integrity: sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==} supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} @@ -4978,6 +4940,17 @@ packages: tiny-hashes@1.0.1: resolution: {integrity: sha512-knIN5zj4fl7kW4EBU5sLP20DWUvi/rVouvJezV0UAym2DkQaqm365Nyc8F3QEiOvunNDMxR8UhcXd1d5g+Wg1g==} + tinybench@2.8.0: + resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} + + tinypool@0.8.4: + resolution: {integrity: sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==} + engines: {node: '>=14.0.0'} + + tinyspy@2.2.1: + resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} + engines: {node: '>=14.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -5097,6 +5070,9 @@ packages: engines: {node: '>=14.17'} hasBin: true + ufo@1.5.3: + resolution: {integrity: sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==} + unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} @@ -5155,10 +5131,6 @@ packages: peerDependencies: react: '>=16.13' - uuid@8.3.2: - resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} - hasBin: true - v8-to-istanbul@9.2.0: resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} engines: {node: '>=10.12.0'} @@ -5166,6 +5138,11 @@ packages: validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + vite-node@1.5.0: + resolution: {integrity: sha512-tV8h6gMj6vPzVCa7l+VGq9lwoJjW8Y79vst8QZZGiuRAfijU+EEWuc0kFpmndQrWhMMhet1jdSF+40KSZUqIIw==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + vite@5.2.10: resolution: {integrity: sha512-PAzgUZbP7msvQvqdSD+ErD5qGnSFiGOoWmV5yAKUEI0kdhjbH6nMWVyZQC/hSc4aXwc0oJ9aEdIiF9Oje0JFCw==} engines: {node: ^18.0.0 || >=20.0.0} @@ -5194,6 +5171,64 @@ packages: terser: optional: true + vite@5.2.9: + resolution: {integrity: sha512-uOQWfuZBlc6Y3W/DTuQ1Sr+oIXWvqljLvS881SVmAj00d5RdgShLcuXWxseWPd4HXwiYBFW/vXHfKFeqj9uQnw==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + + vitest-localstorage-mock@0.1.2: + resolution: {integrity: sha512-1oee6iDWhhquzVogssbpwQi6a2F3L+nCKF2+qqyCs5tH0sOYRyTqnsfj2dtmEQiL4xtJkHLn42hEjHGESlsJHw==} + peerDependencies: + vitest: '*' + + vitest@1.5.0: + resolution: {integrity: sha512-d8UKgR0m2kjdxDWX6911uwxout6GHS0XaGH1cksSIVVG8kRlE7G7aBw7myKQCvDI5dT4j7ZMa+l706BIORMDLw==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 1.5.0 + '@vitest/ui': 1.5.0 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + w3c-xmlserializer@4.0.0: resolution: {integrity: sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==} engines: {node: '>=14'} @@ -5260,6 +5295,11 @@ packages: engines: {node: '>= 8'} hasBin: true + why-is-node-running@2.2.2: + resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} + engines: {node: '>=8'} + hasBin: true + wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} @@ -5295,9 +5335,6 @@ packages: resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} engines: {node: '>=12'} - xml@1.0.1: - resolution: {integrity: sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==} - xmlchars@2.2.0: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} @@ -5580,6 +5617,7 @@ snapshots: dependencies: '@babel/core': 7.24.4 '@babel/helper-plugin-utils': 7.24.0 + optional: true '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.24.4)': dependencies: @@ -6169,7 +6207,8 @@ snapshots: '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 - '@bcoe/v8-coverage@0.2.3': {} + '@bcoe/v8-coverage@0.2.3': + optional: true '@changesets/apply-release-plan@7.0.0': dependencies: @@ -6445,85 +6484,10 @@ snapshots: '@types/conventional-commits-parser': 5.0.0 chalk: 5.3.0 - '@emotion/babel-plugin@11.11.0': - dependencies: - '@babel/helper-module-imports': 7.24.3 - '@babel/runtime': 7.24.4 - '@emotion/hash': 0.9.1 - '@emotion/memoize': 0.8.1 - '@emotion/serialize': 1.1.4 - babel-plugin-macros: 3.1.0 - convert-source-map: 1.9.0 - escape-string-regexp: 4.0.0 - find-root: 1.1.0 - source-map: 0.5.7 - stylis: 4.2.0 - - '@emotion/cache@11.11.0': - dependencies: - '@emotion/memoize': 0.8.1 - '@emotion/sheet': 1.2.2 - '@emotion/utils': 1.2.1 - '@emotion/weak-memoize': 0.3.1 - stylis: 4.2.0 - - '@emotion/css-prettifier@1.1.3': - dependencies: - '@emotion/memoize': 0.8.1 - stylis: 4.2.0 - '@emotion/eslint-plugin@11.11.0(eslint@8.57.0)': dependencies: eslint: 8.57.0 - '@emotion/hash@0.9.1': {} - - '@emotion/jest@11.11.0(@types/jest@29.5.12)': - dependencies: - '@babel/runtime': 7.24.4 - '@emotion/css-prettifier': 1.1.3 - chalk: 4.1.2 - specificity: 0.4.1 - stylis: 4.2.0 - optionalDependencies: - '@types/jest': 29.5.12 - - '@emotion/memoize@0.8.1': {} - - '@emotion/react@11.11.4(@types/react@18.2.79)(react@18.2.0)': - dependencies: - '@babel/runtime': 7.24.4 - '@emotion/babel-plugin': 11.11.0 - '@emotion/cache': 11.11.0 - '@emotion/serialize': 1.1.4 - '@emotion/use-insertion-effect-with-fallbacks': 1.0.1(react@18.2.0) - '@emotion/utils': 1.2.1 - '@emotion/weak-memoize': 0.3.1 - hoist-non-react-statics: 3.3.2 - react: 18.2.0 - optionalDependencies: - '@types/react': 18.2.79 - - '@emotion/serialize@1.1.4': - dependencies: - '@emotion/hash': 0.9.1 - '@emotion/memoize': 0.8.1 - '@emotion/unitless': 0.8.1 - '@emotion/utils': 1.2.1 - csstype: 3.1.3 - - '@emotion/sheet@1.2.2': {} - - '@emotion/unitless@0.8.1': {} - - '@emotion/use-insertion-effect-with-fallbacks@1.0.1(react@18.2.0)': - dependencies: - react: 18.2.0 - - '@emotion/utils@1.2.1': {} - - '@emotion/weak-memoize@0.3.1': {} - '@esbuild/aix-ppc64@0.20.2': optional: true @@ -6674,6 +6638,7 @@ snapshots: get-package-type: 0.1.0 js-yaml: 3.14.1 resolve-from: 5.0.0 + optional: true '@istanbuljs/schema@0.1.3': {} @@ -6685,6 +6650,7 @@ snapshots: jest-message-util: 29.7.0 jest-util: 29.7.0 slash: 3.0.0 + optional: true '@jest/core@29.7.0(babel-plugin-macros@3.1.0)': dependencies: @@ -6720,6 +6686,7 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + optional: true '@jest/environment@29.7.0': dependencies: @@ -6727,6 +6694,7 @@ snapshots: '@jest/types': 29.6.3 '@types/node': 20.12.7 jest-mock: 29.7.0 + optional: true '@jest/expect-utils@29.7.0': dependencies: @@ -6738,6 +6706,7 @@ snapshots: jest-snapshot: 29.7.0 transitivePeerDependencies: - supports-color + optional: true '@jest/fake-timers@29.7.0': dependencies: @@ -6747,6 +6716,7 @@ snapshots: jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 + optional: true '@jest/globals@29.7.0': dependencies: @@ -6756,6 +6726,7 @@ snapshots: jest-mock: 29.7.0 transitivePeerDependencies: - supports-color + optional: true '@jest/reporters@29.7.0': dependencies: @@ -6785,6 +6756,7 @@ snapshots: v8-to-istanbul: 9.2.0 transitivePeerDependencies: - supports-color + optional: true '@jest/schemas@29.6.3': dependencies: @@ -6795,6 +6767,7 @@ snapshots: '@jridgewell/trace-mapping': 0.3.25 callsites: 3.1.0 graceful-fs: 4.2.11 + optional: true '@jest/test-result@29.7.0': dependencies: @@ -6802,6 +6775,7 @@ snapshots: '@jest/types': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 collect-v8-coverage: 1.0.2 + optional: true '@jest/test-sequencer@29.7.0': dependencies: @@ -6809,6 +6783,7 @@ snapshots: graceful-fs: 4.2.11 jest-haste-map: 29.7.0 slash: 3.0.0 + optional: true '@jest/transform@29.7.0': dependencies: @@ -6829,6 +6804,7 @@ snapshots: write-file-atomic: 4.0.2 transitivePeerDependencies: - supports-color + optional: true '@jest/types@29.6.3': dependencies: @@ -7014,10 +6990,12 @@ snapshots: '@sinonjs/commons@3.0.1': dependencies: type-detect: 4.0.8 + optional: true '@sinonjs/fake-timers@10.3.0': dependencies: '@sinonjs/commons': 3.0.1 + optional: true '@stdlib/array-float32@0.0.6': dependencies: @@ -7648,7 +7626,7 @@ snapshots: lz-string: 1.5.0 pretty-format: 27.5.1 - '@testing-library/jest-dom@6.4.2(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0))': + '@testing-library/jest-dom@6.4.2(@jest/globals@29.7.0)(@types/jest@29.5.12)(jest@29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0))(vitest@1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3))': dependencies: '@adobe/css-tools': 4.3.3 '@babel/runtime': 7.24.4 @@ -7662,6 +7640,7 @@ snapshots: '@jest/globals': 29.7.0 '@types/jest': 29.5.12 jest: 29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0) + vitest: 1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3) '@testing-library/react@15.0.2(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': dependencies: @@ -7671,7 +7650,8 @@ snapshots: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - '@tootallnate/once@2.0.0': {} + '@tootallnate/once@2.0.0': + optional: true '@types/aria-query@5.0.4': {} @@ -7707,6 +7687,7 @@ snapshots: '@types/graceful-fs@4.1.9': dependencies: '@types/node': 20.12.7 + optional: true '@types/istanbul-lib-coverage@2.0.6': {} @@ -7723,12 +7704,6 @@ snapshots: expect: 29.7.0 pretty-format: 29.7.0 - '@types/jsdom@20.0.1': - dependencies: - '@types/node': 20.12.7 - '@types/tough-cookie': 4.0.5 - parse5: 7.1.2 - '@types/json-schema@7.0.15': {} '@types/json5@0.0.29': {} @@ -7743,7 +7718,8 @@ snapshots: '@types/normalize-package-data@2.4.4': {} - '@types/parse-json@4.0.2': {} + '@types/parse-json@4.0.2': + optional: true '@types/prop-types@15.7.12': {} @@ -7760,8 +7736,6 @@ snapshots: '@types/stack-utils@2.0.3': {} - '@types/tough-cookie@4.0.5': {} - '@types/yargs-parser@21.0.3': {} '@types/yargs@17.0.32': @@ -7908,17 +7882,63 @@ snapshots: transitivePeerDependencies: - supports-color + '@vitest/coverage-istanbul@1.5.1(vitest@1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3))': + dependencies: + debug: 4.3.4 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-instrument: 6.0.2 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 5.0.4 + istanbul-reports: 3.1.7 + magicast: 0.3.4 + picocolors: 1.0.0 + test-exclude: 6.0.0 + vitest: 1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3) + transitivePeerDependencies: + - supports-color + + '@vitest/expect@1.5.0': + dependencies: + '@vitest/spy': 1.5.0 + '@vitest/utils': 1.5.0 + chai: 4.4.1 + + '@vitest/runner@1.5.0': + dependencies: + '@vitest/utils': 1.5.0 + p-limit: 5.0.0 + pathe: 1.1.2 + + '@vitest/snapshot@1.5.0': + dependencies: + magic-string: 0.30.10 + pathe: 1.1.2 + pretty-format: 29.7.0 + + '@vitest/spy@1.5.0': + dependencies: + tinyspy: 2.2.1 + + '@vitest/utils@1.5.0': + dependencies: + diff-sequences: 29.6.3 + estree-walker: 3.0.3 + loupe: 2.3.7 + pretty-format: 29.7.0 + JSONStream@1.3.5: dependencies: jsonparse: 1.3.1 through: 2.3.8 - abab@2.0.6: {} + abab@2.0.6: + optional: true acorn-globals@7.0.1: dependencies: acorn: 8.11.3 acorn-walk: 8.3.2 + optional: true acorn-jsx@5.3.2(acorn@8.11.3): dependencies: @@ -7933,6 +7953,7 @@ snapshots: debug: 4.3.4 transitivePeerDependencies: - supports-color + optional: true ajv@6.12.6: dependencies: @@ -7953,6 +7974,7 @@ snapshots: ansi-escapes@4.3.2: dependencies: type-fest: 0.21.3 + optional: true ansi-escapes@6.2.1: {} @@ -7976,6 +7998,7 @@ snapshots: dependencies: normalize-path: 3.0.0 picomatch: 2.3.1 + optional: true argparse@1.0.10: dependencies: @@ -8065,9 +8088,12 @@ snapshots: arrify@1.0.1: {} + assertion-error@1.1.0: {} + ast-types-flow@0.0.8: {} - asynckit@0.4.0: {} + asynckit@0.4.0: + optional: true available-typed-arrays@1.0.7: dependencies: @@ -8091,6 +8117,7 @@ snapshots: slash: 3.0.0 transitivePeerDependencies: - supports-color + optional: true babel-plugin-istanbul@6.1.1: dependencies: @@ -8101,6 +8128,7 @@ snapshots: test-exclude: 6.0.0 transitivePeerDependencies: - supports-color + optional: true babel-plugin-jest-hoist@29.6.3: dependencies: @@ -8108,12 +8136,14 @@ snapshots: '@babel/types': 7.24.0 '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.20.5 + optional: true babel-plugin-macros@3.1.0: dependencies: '@babel/runtime': 7.24.4 cosmiconfig: 7.1.0 resolve: 1.22.8 + optional: true babel-plugin-polyfill-corejs2@0.4.11(@babel/core@7.24.4): dependencies: @@ -8154,12 +8184,14 @@ snapshots: '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.4) '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.24.4) '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.24.4) + optional: true babel-preset-jest@29.6.3(@babel/core@7.24.4): dependencies: '@babel/core': 7.24.4 babel-plugin-jest-hoist: 29.6.3 babel-preset-current-node-syntax: 1.0.1(@babel/core@7.24.4) + optional: true balanced-match@1.0.2: {} @@ -8194,11 +8226,15 @@ snapshots: bser@2.1.1: dependencies: node-int64: 0.4.0 + optional: true - buffer-from@1.1.2: {} + buffer-from@1.1.2: + optional: true builtin-modules@3.3.0: {} + cac@6.7.14: {} + call-bind@1.0.7: dependencies: es-define-property: 1.0.0 @@ -8217,10 +8253,21 @@ snapshots: camelcase@5.3.1: {} - camelcase@6.3.0: {} + camelcase@6.3.0: + optional: true caniuse-lite@1.0.30001610: {} + chai@4.4.1: + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.3 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.0.8 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 @@ -8239,13 +8286,19 @@ snapshots: chalk@5.3.0: {} - char-regex@1.0.2: {} + char-regex@1.0.2: + optional: true chardet@0.7.0: {} + check-error@1.0.3: + dependencies: + get-func-name: 2.0.2 + ci-info@3.9.0: {} - cjs-module-lexer@1.2.3: {} + cjs-module-lexer@1.2.3: + optional: true cli-cursor@4.0.0: dependencies: @@ -8270,9 +8323,11 @@ snapshots: clone@1.0.4: {} - co@4.6.0: {} + co@4.6.0: + optional: true - collect-v8-coverage@1.0.2: {} + collect-v8-coverage@1.0.2: + optional: true color-convert@1.9.3: dependencies: @@ -8291,6 +8346,7 @@ snapshots: combined-stream@1.0.8: dependencies: delayed-stream: 1.0.0 + optional: true commander@11.1.0: {} @@ -8301,6 +8357,8 @@ snapshots: concat-map@0.0.1: {} + confbox@0.1.7: {} + confusing-browser-globals@1.0.11: {} conventional-changelog-angular@7.0.0: @@ -8318,8 +8376,6 @@ snapshots: meow: 12.1.1 split2: 4.2.0 - convert-source-map@1.9.0: {} - convert-source-map@2.0.0: {} cookie@0.6.0: {} @@ -8342,6 +8398,7 @@ snapshots: parse-json: 5.2.0 path-type: 4.0.0 yaml: 1.10.2 + optional: true cosmiconfig@9.0.0(typescript@5.4.5): dependencies: @@ -8366,6 +8423,7 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + optional: true cross-env@7.0.3: dependencies: @@ -8385,13 +8443,16 @@ snapshots: css.escape@1.5.1: {} - cssom@0.3.8: {} + cssom@0.3.8: + optional: true - cssom@0.5.0: {} + cssom@0.5.0: + optional: true cssstyle@2.3.0: dependencies: cssom: 0.3.8 + optional: true csstype@3.1.3: {} @@ -8417,6 +8478,7 @@ snapshots: abab: 2.0.6 whatwg-mimetype: 3.0.0 whatwg-url: 11.0.0 + optional: true data-view-buffer@1.0.1: dependencies: @@ -8459,17 +8521,24 @@ snapshots: decamelize@1.2.0: {} - decimal.js@10.4.3: {} + decimal.js@10.4.3: + optional: true decode-uri-component@0.4.1: {} dedent@1.5.3(babel-plugin-macros@3.1.0): optionalDependencies: babel-plugin-macros: 3.1.0 + optional: true + + deep-eql@4.1.3: + dependencies: + type-detect: 4.0.8 deep-is@0.1.4: {} - deepmerge@4.3.1: {} + deepmerge@4.3.1: + optional: true defaults@1.0.4: dependencies: @@ -8487,13 +8556,15 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 - delayed-stream@1.0.0: {} + delayed-stream@1.0.0: + optional: true dequal@2.0.3: {} detect-indent@6.1.0: {} - detect-newline@3.1.0: {} + detect-newline@3.1.0: + optional: true diff-sequences@29.6.3: {} @@ -8520,6 +8591,7 @@ snapshots: domexception@4.0.0: dependencies: webidl-conversions: 7.0.0 + optional: true dot-prop@5.3.0: dependencies: @@ -8531,7 +8603,8 @@ snapshots: electron-to-chromium@1.4.736: {} - emittery@0.13.1: {} + emittery@0.13.1: + optional: true emoji-regex@10.3.0: {} @@ -8779,6 +8852,7 @@ snapshots: esutils: 2.0.3 optionalDependencies: source-map: 0.6.1 + optional: true eslint-config-airbnb-base@15.0.0(eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.7.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0))(eslint@8.57.0): dependencies: @@ -8997,6 +9071,10 @@ snapshots: estraverse@5.3.0: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.5 + esutils@2.0.3: {} eventemitter3@5.0.1: {} @@ -9012,6 +9090,7 @@ snapshots: onetime: 5.1.2 signal-exit: 3.0.7 strip-final-newline: 2.0.0 + optional: true execa@8.0.1: dependencies: @@ -9025,7 +9104,8 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 - exit@0.1.2: {} + exit@0.1.2: + optional: true expect@29.7.0: dependencies: @@ -9064,6 +9144,7 @@ snapshots: fb-watchman@2.0.2: dependencies: bser: 2.1.1 + optional: true file-entry-cache@6.0.1: dependencies: @@ -9077,8 +9158,6 @@ snapshots: filter-obj@5.1.0: {} - find-root@1.1.0: {} - find-up@4.1.0: dependencies: locate-path: 5.0.0 @@ -9117,6 +9196,7 @@ snapshots: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 + optional: true fs-extra@7.0.1: dependencies: @@ -9152,6 +9232,8 @@ snapshots: get-east-asian-width@1.2.0: {} + get-func-name@2.0.2: {} + get-intrinsic@1.2.4: dependencies: es-errors: 1.3.0 @@ -9160,9 +9242,11 @@ snapshots: has-symbols: 1.0.3 hasown: 2.0.2 - get-package-type@0.1.0: {} + get-package-type@0.1.0: + optional: true - get-stream@6.0.1: {} + get-stream@6.0.1: + optional: true get-stream@8.0.1: {} @@ -9237,6 +9321,12 @@ snapshots: graphemer@1.4.0: {} + happy-dom@14.7.1: + dependencies: + entities: 4.5.0 + webidl-conversions: 7.0.0 + whatwg-mimetype: 3.0.0 + hard-rejection@2.1.0: {} has-bigints@1.0.2: {} @@ -9265,10 +9355,6 @@ snapshots: dependencies: '@babel/runtime': 7.24.4 - hoist-non-react-statics@3.3.2: - dependencies: - react-is: 16.13.1 - hosted-git-info@2.8.9: {} hosted-git-info@7.0.1: @@ -9278,6 +9364,7 @@ snapshots: html-encoding-sniffer@3.0.0: dependencies: whatwg-encoding: 2.0.0 + optional: true html-escaper@2.0.2: {} @@ -9288,6 +9375,7 @@ snapshots: debug: 4.3.4 transitivePeerDependencies: - supports-color + optional: true https-proxy-agent@5.0.1: dependencies: @@ -9295,10 +9383,12 @@ snapshots: debug: 4.3.4 transitivePeerDependencies: - supports-color + optional: true human-id@1.0.2: {} - human-signals@2.1.0: {} + human-signals@2.1.0: + optional: true human-signals@5.0.0: {} @@ -9311,6 +9401,7 @@ snapshots: iconv-lite@0.6.3: dependencies: safer-buffer: 2.1.2 + optional: true ignore@5.3.1: {} @@ -9323,6 +9414,7 @@ snapshots: dependencies: pkg-dir: 4.2.0 resolve-cwd: 3.0.0 + optional: true import-meta-resolve@4.0.0: {} @@ -9404,7 +9496,8 @@ snapshots: dependencies: get-east-asian-width: 1.2.0 - is-generator-fn@2.1.0: {} + is-generator-fn@2.1.0: + optional: true is-generator-function@1.0.10: dependencies: @@ -9430,7 +9523,8 @@ snapshots: is-plain-obj@1.1.0: {} - is-potential-custom-element-name@1.0.1: {} + is-potential-custom-element-name@1.0.1: + optional: true is-regex@1.1.4: dependencies: @@ -9443,7 +9537,8 @@ snapshots: dependencies: call-bind: 1.0.7 - is-stream@2.0.1: {} + is-stream@2.0.1: + optional: true is-stream@3.0.0: {} @@ -9495,6 +9590,7 @@ snapshots: semver: 6.3.1 transitivePeerDependencies: - supports-color + optional: true istanbul-lib-instrument@6.0.2: dependencies: @@ -9519,6 +9615,15 @@ snapshots: source-map: 0.6.1 transitivePeerDependencies: - supports-color + optional: true + + istanbul-lib-source-maps@5.0.4: + dependencies: + '@jridgewell/trace-mapping': 0.3.25 + debug: 4.3.4 + istanbul-lib-coverage: 3.2.2 + transitivePeerDependencies: + - supports-color istanbul-reports@3.1.7: dependencies: @@ -9538,6 +9643,7 @@ snapshots: execa: 5.1.1 jest-util: 29.7.0 p-limit: 3.1.0 + optional: true jest-circus@29.7.0(babel-plugin-macros@3.1.0): dependencies: @@ -9564,6 +9670,7 @@ snapshots: transitivePeerDependencies: - babel-plugin-macros - supports-color + optional: true jest-cli@29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0): dependencies: @@ -9583,6 +9690,7 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + optional: true jest-config@29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0): dependencies: @@ -9613,6 +9721,7 @@ snapshots: transitivePeerDependencies: - babel-plugin-macros - supports-color + optional: true jest-diff@29.7.0: dependencies: @@ -9624,6 +9733,7 @@ snapshots: jest-docblock@29.7.0: dependencies: detect-newline: 3.1.0 + optional: true jest-each@29.7.0: dependencies: @@ -9632,21 +9742,7 @@ snapshots: jest-get-type: 29.6.3 jest-util: 29.7.0 pretty-format: 29.7.0 - - jest-environment-jsdom@29.7.0: - dependencies: - '@jest/environment': 29.7.0 - '@jest/fake-timers': 29.7.0 - '@jest/types': 29.6.3 - '@types/jsdom': 20.0.1 - '@types/node': 20.12.7 - jest-mock: 29.7.0 - jest-util: 29.7.0 - jsdom: 20.0.3 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate + optional: true jest-environment-node@29.7.0: dependencies: @@ -9656,6 +9752,7 @@ snapshots: '@types/node': 20.12.7 jest-mock: 29.7.0 jest-util: 29.7.0 + optional: true jest-get-type@29.6.3: {} @@ -9674,20 +9771,13 @@ snapshots: walker: 1.0.8 optionalDependencies: fsevents: 2.3.3 - - jest-junit@16.0.0: - dependencies: - mkdirp: 1.0.4 - strip-ansi: 6.0.1 - uuid: 8.3.2 - xml: 1.0.1 + optional: true jest-leak-detector@29.7.0: dependencies: jest-get-type: 29.6.3 pretty-format: 29.7.0 - - jest-localstorage-mock@2.4.26: {} + optional: true jest-matcher-utils@29.7.0: dependencies: @@ -9713,12 +9803,15 @@ snapshots: '@jest/types': 29.6.3 '@types/node': 20.12.7 jest-util: 29.7.0 + optional: true jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): optionalDependencies: jest-resolve: 29.7.0 + optional: true - jest-regex-util@29.6.3: {} + jest-regex-util@29.6.3: + optional: true jest-resolve-dependencies@29.7.0: dependencies: @@ -9726,6 +9819,7 @@ snapshots: jest-snapshot: 29.7.0 transitivePeerDependencies: - supports-color + optional: true jest-resolve@29.7.0: dependencies: @@ -9738,6 +9832,7 @@ snapshots: resolve: 1.22.8 resolve.exports: 2.0.2 slash: 3.0.0 + optional: true jest-runner@29.7.0: dependencies: @@ -9764,6 +9859,7 @@ snapshots: source-map-support: 0.5.13 transitivePeerDependencies: - supports-color + optional: true jest-runtime@29.7.0: dependencies: @@ -9791,6 +9887,7 @@ snapshots: strip-bom: 4.0.0 transitivePeerDependencies: - supports-color + optional: true jest-snapshot@29.7.0: dependencies: @@ -9816,6 +9913,7 @@ snapshots: semver: 7.6.0 transitivePeerDependencies: - supports-color + optional: true jest-util@29.7.0: dependencies: @@ -9834,6 +9932,7 @@ snapshots: jest-get-type: 29.6.3 leven: 3.1.0 pretty-format: 29.7.0 + optional: true jest-watcher@29.7.0: dependencies: @@ -9845,6 +9944,7 @@ snapshots: emittery: 0.13.1 jest-util: 29.7.0 string-length: 4.0.2 + optional: true jest-worker@29.7.0: dependencies: @@ -9852,6 +9952,7 @@ snapshots: jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 + optional: true jest@29.7.0(@types/node@20.12.7)(babel-plugin-macros@3.1.0): dependencies: @@ -9864,6 +9965,7 @@ snapshots: - babel-plugin-macros - supports-color - ts-node + optional: true jiti@1.21.0: {} @@ -9871,6 +9973,8 @@ snapshots: js-tokens@4.0.0: {} + js-tokens@9.0.0: {} + js-yaml@3.14.1: dependencies: argparse: 1.0.10 @@ -9912,6 +10016,7 @@ snapshots: - bufferutil - supports-color - utf-8-validate + optional: true jsesc@0.5.0: {} @@ -9952,7 +10057,8 @@ snapshots: kind-of@6.0.3: {} - kleur@3.0.3: {} + kleur@3.0.3: + optional: true kleur@4.1.5: {} @@ -9962,7 +10068,8 @@ snapshots: dependencies: language-subtag-registry: 0.3.22 - leven@3.1.0: {} + leven@3.1.0: + optional: true levn@0.4.1: dependencies: @@ -10004,6 +10111,11 @@ snapshots: pify: 4.0.1 strip-bom: 3.0.0 + local-pkg@0.5.0: + dependencies: + mlly: 1.6.1 + pkg-types: 1.1.0 + locate-path@5.0.0: dependencies: p-locate: 4.1.0 @@ -10050,6 +10162,10 @@ snapshots: dependencies: js-tokens: 4.0.0 + loupe@2.3.7: + dependencies: + get-func-name: 2.0.2 + lru-cache@10.2.0: {} lru-cache@4.1.5: @@ -10067,6 +10183,16 @@ snapshots: lz-string@1.5.0: {} + magic-string@0.30.10: + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + + magicast@0.3.4: + dependencies: + '@babel/parser': 7.24.4 + '@babel/types': 7.24.0 + source-map-js: 1.2.0 + make-dir@4.0.0: dependencies: semver: 7.6.0 @@ -10074,6 +10200,7 @@ snapshots: makeerror@1.0.12: dependencies: tmpl: 1.0.5 + optional: true map-obj@1.0.1: {} @@ -10104,11 +10231,13 @@ snapshots: braces: 3.0.2 picomatch: 2.3.1 - mime-db@1.52.0: {} + mime-db@1.52.0: + optional: true mime-types@2.1.35: dependencies: mime-db: 1.52.0 + optional: true mimic-fn@2.1.0: {} @@ -10138,7 +10267,12 @@ snapshots: mixme@0.5.10: {} - mkdirp@1.0.4: {} + mlly@1.6.1: + dependencies: + acorn: 8.11.3 + pathe: 1.1.2 + pkg-types: 1.1.0 + ufo: 1.5.3 mockdate@3.0.5: {} @@ -10165,7 +10299,8 @@ snapshots: dependencies: whatwg-url: 5.0.0 - node-int64@0.4.0: {} + node-int64@0.4.0: + optional: true node-releases@2.0.14: {} @@ -10183,17 +10318,20 @@ snapshots: semver: 7.6.0 validate-npm-package-license: 3.0.4 - normalize-path@3.0.0: {} + normalize-path@3.0.0: + optional: true npm-run-path@4.0.1: dependencies: path-key: 3.1.1 + optional: true npm-run-path@5.3.0: dependencies: path-key: 4.0.0 - nwsapi@2.2.7: {} + nwsapi@2.2.7: + optional: true obj-case@0.2.1: {} @@ -10282,6 +10420,10 @@ snapshots: dependencies: yocto-queue: 1.0.0 + p-limit@5.0.0: + dependencies: + yocto-queue: 1.0.0 + p-locate@4.1.0: dependencies: p-limit: 2.3.0 @@ -10318,6 +10460,7 @@ snapshots: parse5@7.1.2: dependencies: entities: 4.5.0 + optional: true path-exists@4.0.0: {} @@ -10335,6 +10478,10 @@ snapshots: path-type@5.0.0: {} + pathe@1.1.2: {} + + pathval@1.1.1: {} + picocolors@1.0.0: {} picomatch@2.3.1: {} @@ -10343,12 +10490,19 @@ snapshots: pify@4.0.1: {} - pirates@4.0.6: {} + pirates@4.0.6: + optional: true pkg-dir@4.2.0: dependencies: find-up: 4.1.0 + pkg-types@1.1.0: + dependencies: + confbox: 0.1.7 + mlly: 1.6.1 + pathe: 1.1.2 + possible-typed-array-names@1.0.0: {} postcss@8.4.38: @@ -10386,6 +10540,7 @@ snapshots: dependencies: kleur: 3.0.3 sisteransi: 1.0.5 + optional: true prop-types@15.8.1: dependencies: @@ -10395,11 +10550,13 @@ snapshots: pseudomap@1.0.2: {} - psl@1.9.0: {} + psl@1.9.0: + optional: true punycode@2.3.1: {} - pure-rand@6.1.0: {} + pure-rand@6.1.0: + optional: true query-string@9.0.0: dependencies: @@ -10407,7 +10564,8 @@ snapshots: filter-obj: 5.1.0 split-on-first: 3.0.0 - querystringify@2.2.0: {} + querystringify@2.2.0: + optional: true queue-microtask@1.2.3: {} @@ -10524,17 +10682,20 @@ snapshots: require-main-filename@2.0.0: {} - requires-port@1.0.0: {} + requires-port@1.0.0: + optional: true resolve-cwd@3.0.0: dependencies: resolve-from: 5.0.0 + optional: true resolve-from@4.0.0: {} resolve-from@5.0.0: {} - resolve.exports@2.0.2: {} + resolve.exports@2.0.2: + optional: true resolve@1.22.8: dependencies: @@ -10605,6 +10766,7 @@ snapshots: saxes@6.0.0: dependencies: xmlchars: 2.2.0 + optional: true scheduler@0.23.0: dependencies: @@ -10655,6 +10817,8 @@ snapshots: get-intrinsic: 1.2.4 object-inspect: 1.13.1 + siginfo@2.0.0: {} + signal-exit@3.0.7: {} signal-exit@4.1.0: {} @@ -10667,7 +10831,8 @@ snapshots: transitivePeerDependencies: - supports-color - sisteransi@1.0.5: {} + sisteransi@1.0.5: + optional: true slash@3.0.0: {} @@ -10698,10 +10863,10 @@ snapshots: dependencies: buffer-from: 1.1.2 source-map: 0.6.1 + optional: true - source-map@0.5.7: {} - - source-map@0.6.1: {} + source-map@0.6.1: + optional: true spark-md5@3.0.2: {} @@ -10724,8 +10889,6 @@ snapshots: spdx-license-ids@3.0.17: {} - specificity@0.4.1: {} - split-on-first@3.0.0: {} split2@4.2.0: {} @@ -10736,6 +10899,10 @@ snapshots: dependencies: escape-string-regexp: 2.0.0 + stackback@0.0.2: {} + + std-env@3.7.0: {} + stream-transform@2.1.3: dependencies: mixme: 0.5.10 @@ -10746,6 +10913,7 @@ snapshots: dependencies: char-regex: 1.0.2 strip-ansi: 6.0.1 + optional: true string-width@4.2.3: dependencies: @@ -10803,9 +10971,11 @@ snapshots: strip-bom@3.0.0: {} - strip-bom@4.0.0: {} + strip-bom@4.0.0: + optional: true - strip-final-newline@2.0.0: {} + strip-final-newline@2.0.0: + optional: true strip-final-newline@3.0.0: {} @@ -10815,7 +10985,9 @@ snapshots: strip-json-comments@3.1.1: {} - stylis@4.2.0: {} + strip-literal@2.1.0: + dependencies: + js-tokens: 9.0.0 supports-color@5.5.0: dependencies: @@ -10828,10 +11000,12 @@ snapshots: supports-color@8.1.1: dependencies: has-flag: 4.0.0 + optional: true supports-preserve-symlinks-flag@1.0.0: {} - symbol-tree@3.2.4: {} + symbol-tree@3.2.4: + optional: true term-size@2.2.1: {} @@ -10849,11 +11023,18 @@ snapshots: tiny-hashes@1.0.1: {} + tinybench@2.8.0: {} + + tinypool@0.8.4: {} + + tinyspy@2.2.1: {} + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 - tmpl@1.0.5: {} + tmpl@1.0.5: + optional: true to-fast-properties@2.0.0: {} @@ -10867,12 +11048,14 @@ snapshots: punycode: 2.3.1 universalify: 0.2.0 url-parse: 1.5.10 + optional: true tr46@0.0.3: {} tr46@3.0.0: dependencies: punycode: 2.3.1 + optional: true trim-newlines@3.0.1: {} @@ -10920,7 +11103,8 @@ snapshots: type-fest@0.20.2: {} - type-fest@0.21.3: {} + type-fest@0.21.3: + optional: true type-fest@0.6.0: {} @@ -10962,6 +11146,8 @@ snapshots: typescript@5.4.5: {} + ufo@1.5.3: {} + unbox-primitive@1.0.2: dependencies: call-bind: 1.0.7 @@ -10990,7 +11176,8 @@ snapshots: universalify@0.1.2: {} - universalify@0.2.0: {} + universalify@0.2.0: + optional: true update-browserslist-db@1.0.13(browserslist@4.23.0): dependencies: @@ -11006,6 +11193,7 @@ snapshots: dependencies: querystringify: 2.2.0 requires-port: 1.0.0 + optional: true use-deep-compare-effect@1.8.1(react@18.2.0): dependencies: @@ -11013,19 +11201,35 @@ snapshots: dequal: 2.0.3 react: 18.2.0 - uuid@8.3.2: {} - v8-to-istanbul@9.2.0: dependencies: '@jridgewell/trace-mapping': 0.3.25 '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 + optional: true validate-npm-package-license@3.0.4: dependencies: spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 + vite-node@1.5.0(@types/node@20.12.7): + dependencies: + cac: 6.7.14 + debug: 4.3.4 + pathe: 1.1.2 + picocolors: 1.0.0 + vite: 5.2.9(@types/node@20.12.7) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + vite@5.2.10(@types/node@20.12.7): dependencies: esbuild: 0.20.2 @@ -11035,15 +11239,65 @@ snapshots: '@types/node': 20.12.7 fsevents: 2.3.3 + vite@5.2.9(@types/node@20.12.7): + dependencies: + esbuild: 0.20.2 + postcss: 8.4.38 + rollup: 4.14.3 + optionalDependencies: + '@types/node': 20.12.7 + fsevents: 2.3.3 + + vitest-localstorage-mock@0.1.2(vitest@1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3)): + dependencies: + vitest: 1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3) + + vitest@1.5.0(@types/node@20.12.7)(happy-dom@14.7.1)(jsdom@20.0.3): + dependencies: + '@vitest/expect': 1.5.0 + '@vitest/runner': 1.5.0 + '@vitest/snapshot': 1.5.0 + '@vitest/spy': 1.5.0 + '@vitest/utils': 1.5.0 + acorn-walk: 8.3.2 + chai: 4.4.1 + debug: 4.3.4 + execa: 8.0.1 + local-pkg: 0.5.0 + magic-string: 0.30.10 + pathe: 1.1.2 + picocolors: 1.0.0 + std-env: 3.7.0 + strip-literal: 2.1.0 + tinybench: 2.8.0 + tinypool: 0.8.4 + vite: 5.2.10(@types/node@20.12.7) + vite-node: 1.5.0(@types/node@20.12.7) + why-is-node-running: 2.2.2 + optionalDependencies: + '@types/node': 20.12.7 + happy-dom: 14.7.1 + jsdom: 20.0.3 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + w3c-xmlserializer@4.0.0: dependencies: xml-name-validator: 4.0.0 + optional: true wait-for-expect@3.0.2: {} walker@1.0.8: dependencies: makeerror: 1.0.12 + optional: true wcwidth@1.0.1: dependencies: @@ -11056,6 +11310,7 @@ snapshots: whatwg-encoding@2.0.0: dependencies: iconv-lite: 0.6.3 + optional: true whatwg-mimetype@3.0.0: {} @@ -11063,6 +11318,7 @@ snapshots: dependencies: tr46: 3.0.0 webidl-conversions: 7.0.0 + optional: true whatwg-url@5.0.0: dependencies: @@ -11122,6 +11378,11 @@ snapshots: dependencies: isexe: 2.0.0 + why-is-node-running@2.2.2: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + wrap-ansi@6.2.0: dependencies: ansi-styles: 4.3.0 @@ -11146,14 +11407,16 @@ snapshots: dependencies: imurmurhash: 0.1.4 signal-exit: 3.0.7 + optional: true - ws@8.16.0: {} - - xml-name-validator@4.0.0: {} + ws@8.16.0: + optional: true - xml@1.0.1: {} + xml-name-validator@4.0.0: + optional: true - xmlchars@2.2.0: {} + xmlchars@2.2.0: + optional: true y18n@4.0.3: {} @@ -11165,7 +11428,8 @@ snapshots: yallist@4.0.0: {} - yaml@1.10.2: {} + yaml@1.10.2: + optional: true yaml@2.3.4: {} diff --git a/tsconfig.json b/tsconfig.json index 32bde5311..59a7dad39 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,12 +6,14 @@ "target": "esnext", "noEmit": true, "allowJs": true, - "jsx": "preserve" + "jsx": "preserve", + "skipLibCheck": true }, "include": ["**/*.ts", "**/*.js", "**/.*.js", "**/*.tsx"], "exclude": [ "**/dist/*.ts", "**/__typetests__/*.test.ts", - "**/__typetests__/*.test.tsx" + "**/__typetests__/*.test.tsx", + "packages_deprecated/**" ] } diff --git a/vite.config.ts b/vite.config.ts index 588c753c0..bd9de84e7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,7 +2,7 @@ import react from '@vitejs/plugin-react' import browserslist from 'browserslist' import { resolveToEsbuildTarget } from 'esbuild-plugin-browserslist' import { readPackage } from 'read-pkg' -import { type UserConfig, defineConfig } from 'vite' +import { type UserConfig, defineConfig } from 'vitest/config' const pkg = await readPackage() @@ -33,6 +33,7 @@ export const defaultConfig: UserConfig = { build: { outDir: 'dist', target: [...targets, 'node20'], + minify: false, lib: { name: pkg.name, entry: 'src/index.ts', @@ -57,6 +58,42 @@ export const defaultConfig: UserConfig = { jsxRuntime: 'automatic', }), ], + test: { + name: 'lib', + globals: true, + clearMocks: true, + restoreMocks: true, + mockReset: true, + environment: 'node', + setupFiles: ['vitest-localstorage-mock'], + server: { + deps: { + inline: true, + }, + }, + allowOnly: false, + css: true, + logHeapUsage: true, + reporters: ['default'], + exclude: ['**/__typetests__/**', 'node_modules', '**/dist/**'], + coverage: { + provider: 'istanbul', + reporter: ['json-summary', 'cobertura'], + exclude: [ + '**/__typetests__/**', + '.reports/**', + '.turbo', + '**/.eslintrc.*', + '**/*.d.ts', + 'build', + 'dist', + 'node_modules', + '**/{webpack,vite,vitest,babel}.config.*', + '**.snap', + '**.svg', + ], + }, + }, } export default defineConfig(defaultConfig)