From c09843ae88b221053e770916a7e9682eac2195d8 Mon Sep 17 00:00:00 2001 From: Daishi Kato Date: Sun, 7 Apr 2024 13:39:47 +0900 Subject: [PATCH] chore(deps): update dev dependencies (#2479) * chore(deps): update dev dependencies * downgrade user-evnet * fix type with vi.fn * for older ts * hack for older ts * hack for older ts 2 * hack for older ts 3 * hack for older ts 4 * hack for older ts 5 * hack for older ts 6 * hack for older ts 7 * hack for older ts 8 * resolve replacement * update snapshots * do not use default export * Revert "do not use default export" This reverts commit 0a646730c7389ea8060191f0331b5432563c94af. * update package.json * wip: fix cjs * wip: for other builds * wip: fix previous commit * wip: esm and system * system cannot be tested * wip: fix esm * wip: RESET * wip: RESET 2 * wip: tsconfig * revert it * wip: patch test * wip: fix regex * wip: patch dist * patch test with require * wip: fix path * fix cjs&umd * skip one test with umd * can we remove this? * Revert "can we remove this?" This reverts commit 1efc0b50b0d99be10b5ffe5e5d62f22d99603468. --- .github/workflows/test-multiple-builds.yml | 13 +- .github/workflows/test-old-typescript.yml | 17 +- package.json | 20 +- tests/babel/plugin-debug-label.test.ts | 58 +- tests/babel/plugin-react-refresh.test.ts | 24 +- tests/babel/preset.test.ts | 36 +- tests/react/dependency.test.tsx | 4 +- tests/react/utils/useResetAtom.test.tsx | 8 +- vitest.config.ts | 5 +- yarn.lock | 914 ++++++++++----------- 10 files changed, 534 insertions(+), 565 deletions(-) diff --git a/.github/workflows/test-multiple-builds.yml b/.github/workflows/test-multiple-builds.yml index f76684107e..9fedaa0f93 100644 --- a/.github/workflows/test-multiple-builds.yml +++ b/.github/workflows/test-multiple-builds.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - build: [cjs, umd] # [cjs, esm, umd, system] + build: [cjs, esm, umd] env: [development, production] steps: - uses: actions/checkout@v2 @@ -40,24 +40,27 @@ jobs: - name: Patch for CJS if: ${{ matrix.build == 'cjs' }} run: | - sed -i~ "s/\/src\(.*\)\.ts/\/dist\1.js/" package.json + sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\1.js')/" vitest.config.ts + sed -i~ "s/import { useResetAtom } from 'jotai\/react\/utils'/const { useResetAtom } = require('..\/..\/..\/dist\/react\/utils.js')/" tests/react/utils/useResetAtom.test.tsx + sed -i~ "s/import { RESET, atomWithReducer, atomWithReset } from 'jotai\/vanilla\/utils'/const { RESET, atomWithReducer, atomWithReset } = require('..\/..\/..\/dist\/vanilla\/utils.js')/" tests/react/utils/useResetAtom.test.tsx - name: Patch for ESM if: ${{ matrix.build == 'esm' }} run: | - sed -i~ "s/\/src\(.*\)\.ts/\/dist\/esm\1.js" package.json + sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/esm\1.mjs')/" vitest.config.ts sed -i~ "1s/^/import.meta.env=import.meta.env||{};import.meta.env.MODE='${NODE_ENV}';/" tests/*/*.tsx tests/*/*/*.tsx env: NODE_ENV: ${{ matrix.env }} - name: Patch for UMD if: ${{ matrix.build == 'umd' }} run: | - sed -i~ "s/\/src\(.*\)\.ts/\/dist\/umd\1.${NODE_ENV}.js/" package.json + sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/umd\1.${NODE_ENV}.js')/" vitest.config.ts + rm tests/react/utils/useResetAtom.test.tsx # FIXME we skip this for now. Actually I'm not sure if we really run tests with UMD build env: NODE_ENV: ${{ matrix.env }} - name: Patch for SystemJS if: ${{ matrix.build == 'system' }} run: | - sed -i~ "s/\/src\(.*\)\.ts/\/dist\/system\1.${NODE_ENV}.js/" package.json + sed -i~ "s/resolve('\.\/src\(.*\)\.ts')/resolve('\.\/dist\/system\1.${NODE_ENV}.js')/" vitest.config.ts env: NODE_ENV: ${{ matrix.env }} - name: Test ${{ matrix.build }} ${{ matrix.env }} diff --git a/.github/workflows/test-old-typescript.yml b/.github/workflows/test-old-typescript.yml index 823a1fb3b3..47980a2c97 100644 --- a/.github/workflows/test-old-typescript.yml +++ b/.github/workflows/test-old-typescript.yml @@ -47,7 +47,7 @@ jobs: sed -i~ 's/"jotai\/\*": \["\.\/src\/\*\.ts"\]/"jotai\/*": [".\/dist\/*.d.ts"]/' tsconfig.json sed -i~ 's/"include": .*/"include": ["src\/types.d.ts", "dist\/**\/*", "tests\/**\/*"],/' tsconfig.json - name: Patch for Old TS - if: ${{ matrix.typescript == '4.7.4' || matrix.typescript == '4.6.4' || matrix.typescript == '4.5.5' || matrix.typescript == '4.4.4' || matrix.typescript == '4.3.5' || matrix.typescript == '4.2.3' || matrix.typescript == '4.1.5' || matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} + if: ${{ matrix.typescript == '4.7.4' || matrix.typescript == '4.6.4' || matrix.typescript == '4.5.5' || matrix.typescript == '4.4.4' || matrix.typescript == '4.3.5' || matrix.typescript == '4.2.3' || matrix.typescript == '4.1.5' || matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} run: | sed -i~ 's/\/\/ @ts-expect-error.*\[LATEST-TS-ONLY\]//' tests/*/*.tsx tests/*/*/*.tsx sed -i~ 's/"target":/"skipLibCheck":true,"target":/' tsconfig.json @@ -70,6 +70,21 @@ jobs: rm -r tests/react/vanilla-utils/atomWithObservable.* - name: Install old TypeScript run: yarn add -D typescript@${{ matrix.typescript }} + - name: Patch testing setup for Old TS + if: ${{ matrix.typescript == '4.4.4' || matrix.typescript == '4.3.5' || matrix.typescript == '4.2.3' || matrix.typescript == '4.1.5' || matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} + run: | + rm node_modules/@vitest/expect/dist/*.d.ts + echo "declare module '@vitest/expect'" >> ./src/types.d.ts + rm node_modules/@vitest/runner/dist/*.d.ts + echo "declare module '@vitest/runner'" >> ./src/types.d.ts + rm node_modules/@vitest/spy/dist/*.d.ts + echo "declare module '@vitest/spy'" >> ./src/types.d.ts + rm node_modules/@vitest/utils/dist/*.d.ts + echo "declare module '@vitest/utils'" >> ./src/types.d.ts + rm node_modules/vite-node/dist/*.d.ts + echo "declare module 'vite-node'" >> ./src/types.d.ts + rm node_modules/vitest/dist/*.d.ts + echo "declare module 'vitest'" >> ./src/types.d.ts - name: Patch testing setup for older TS if: ${{ matrix.typescript == '4.0.5' || startsWith(matrix.typescript, '3.') }} run: | diff --git a/package.json b/package.json index 9005b55916..695ad47386 100644 --- a/package.json +++ b/package.json @@ -114,10 +114,10 @@ }, "homepage": "https://github.com/pmndrs/jotai", "devDependencies": { - "@babel/core": "^7.24.3", + "@babel/core": "^7.24.4", "@babel/plugin-transform-react-jsx": "^7.23.4", - "@babel/plugin-transform-typescript": "^7.24.1", - "@babel/preset-env": "^7.24.3", + "@babel/plugin-transform-typescript": "^7.24.4", + "@babel/preset-env": "^7.24.4", "@babel/template": "^7.24.0", "@babel/types": "^7.24.0", "@redux-devtools/extension": "^3.3.0", @@ -131,13 +131,13 @@ "@testing-library/react": "^14.2.2", "@testing-library/user-event": "14.4.3", "@types/babel__core": "^7.20.5", - "@types/node": "^20.11.30", + "@types/node": "^20.12.4", "@types/react": "18.2.56", - "@types/react-dom": "^18.2.23", + "@types/react-dom": "^18.2.24", "@typescript-eslint/eslint-plugin": "7.2.0", "@typescript-eslint/parser": "7.2.0", - "@vitest/coverage-v8": "0.33.0", - "@vitest/ui": "0.33.0", + "@vitest/coverage-v8": "^1.4.0", + "@vitest/ui": "^1.4.0", "benny": "^3.7.1", "concurrently": "^8.2.2", "downlevel-dts": "^0.11.0", @@ -149,14 +149,14 @@ "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-vitest": "^0.4.0", + "eslint-plugin-vitest": "^0.4.1", "jsdom": "^24.0.0", "json": "^11.0.0", "prettier": "^3.2.5", "react": "^18.2.0", "react-dom": "^18.2.0", "redux": "^5.0.1", - "rollup": "^4.13.2", + "rollup": "^4.14.0", "rollup-plugin-banner2": "^1.2.3", "rollup-plugin-esbuild": "^6.1.1", "rxjs": "^7.8.1", @@ -165,7 +165,7 @@ "ts-node": "^10.9.2", "tslib": "^2.6.2", "typescript": "^5.4.3", - "vitest": "0.33.0", + "vitest": "^1.4.0", "wonka": "^6.3.4" }, "resolutions": { diff --git a/tests/babel/plugin-debug-label.test.ts b/tests/babel/plugin-debug-label.test.ts index b7c4dc7e11..9897007bf5 100644 --- a/tests/babel/plugin-debug-label.test.ts +++ b/tests/babel/plugin-debug-label.test.ts @@ -17,21 +17,21 @@ const transform = ( it('Should add a debugLabel to an atom', () => { expect(transform(`const countAtom = atom(0);`)).toMatchInlineSnapshot(` "const countAtom = atom(0); - countAtom.debugLabel = \\"countAtom\\";" + countAtom.debugLabel = "countAtom";" `) }) it('Should handle a atom from a default export', () => { expect(transform(`const countAtom = jotai.atom(0);`)).toMatchInlineSnapshot(` "const countAtom = jotai.atom(0); - countAtom.debugLabel = \\"countAtom\\";" + countAtom.debugLabel = "countAtom";" `) }) it('Should handle a atom being exported', () => { expect(transform(`export const countAtom = atom(0);`)).toMatchInlineSnapshot(` "export const countAtom = atom(0); - countAtom.debugLabel = \\"countAtom\\";" + countAtom.debugLabel = "countAtom";" `) }) @@ -39,7 +39,7 @@ it('Should handle a default exported atom', () => { expect(transform(`export default atom(0);`, 'countAtom.ts')) .toMatchInlineSnapshot(` "const countAtom = atom(0); - countAtom.debugLabel = \\"countAtom\\"; + countAtom.debugLabel = "countAtom"; export default countAtom;" `) }) @@ -48,7 +48,7 @@ it('Should handle a default exported atom in a barrel file', () => { expect(transform(`export default atom(0);`, 'atoms/index.ts')) .toMatchInlineSnapshot(` "const atoms = atom(0); - atoms.debugLabel = \\"atoms\\"; + atoms.debugLabel = "atoms"; export default atoms;" `) }) @@ -64,9 +64,9 @@ it('Should handle all types of exports', () => { ), ).toMatchInlineSnapshot(` "export const countAtom = atom(0); - countAtom.debugLabel = \\"countAtom\\"; + countAtom.debugLabel = "countAtom"; const atoms = atom(0); - atoms.debugLabel = \\"atoms\\"; + atoms.debugLabel = "atoms"; export default atoms;" `) }) @@ -112,52 +112,52 @@ it('Should handle all atom types', () => { ), ).toMatchInlineSnapshot(` "export const countAtom = atom(0); - countAtom.debugLabel = \\"countAtom\\"; + countAtom.debugLabel = "countAtom"; const myFamily = atomFamily(param => atom(param)); - myFamily.debugLabel = \\"myFamily\\"; + myFamily.debugLabel = "myFamily"; const countAtomWithDefault = atomWithDefault(get => get(countAtom) * 2); - countAtomWithDefault.debugLabel = \\"countAtomWithDefault\\"; + countAtomWithDefault.debugLabel = "countAtomWithDefault"; const observableAtom = atomWithObservable(() => {}); - observableAtom.debugLabel = \\"observableAtom\\"; + observableAtom.debugLabel = "observableAtom"; const reducerAtom = atomWithReducer(0, () => {}); - reducerAtom.debugLabel = \\"reducerAtom\\"; + reducerAtom.debugLabel = "reducerAtom"; const resetAtom = atomWithReset(0); - resetAtom.debugLabel = \\"resetAtom\\"; + resetAtom.debugLabel = "resetAtom"; const storageAtom = atomWithStorage('count', 1); - storageAtom.debugLabel = \\"storageAtom\\"; + storageAtom.debugLabel = "storageAtom"; const freezedAtom = freezeAtom(atom({ count: 0 })); - freezedAtom.debugLabel = \\"freezedAtom\\"; + freezedAtom.debugLabel = "freezedAtom"; const loadedAtom = loadable(countAtom); - loadedAtom.debugLabel = \\"loadedAtom\\"; + loadedAtom.debugLabel = "loadedAtom"; const selectedValueAtom = selectAtom(atom({ a: 0, b: 'othervalue' }), v => v.a); - selectedValueAtom.debugLabel = \\"selectedValueAtom\\"; + selectedValueAtom.debugLabel = "selectedValueAtom"; const splittedAtom = splitAtom(atom([])); - splittedAtom.debugLabel = \\"splittedAtom\\"; + splittedAtom.debugLabel = "splittedAtom"; const unwrappedAtom = unwrap(asyncArrayAtom, () => []); - unwrappedAtom.debugLabel = \\"unwrappedAtom\\"; + unwrappedAtom.debugLabel = "unwrappedAtom"; const someatomWithSubscription = atomWithSubscription(() => {}); - someatomWithSubscription.debugLabel = \\"someatomWithSubscription\\"; + someatomWithSubscription.debugLabel = "someatomWithSubscription"; const someAtomWithStore = atomWithStore(() => {}); - someAtomWithStore.debugLabel = \\"someAtomWithStore\\"; + someAtomWithStore.debugLabel = "someAtomWithStore"; const someAtomWithHash = atomWithHash('', ''); - someAtomWithHash.debugLabel = \\"someAtomWithHash\\"; + someAtomWithHash.debugLabel = "someAtomWithHash"; const someAtomWithLocation = atomWithLocation(); - someAtomWithLocation.debugLabel = \\"someAtomWithLocation\\"; + someAtomWithLocation.debugLabel = "someAtomWithLocation"; const someFocusAtom = focusAtom(someAtom, () => {}); - someFocusAtom.debugLabel = \\"someFocusAtom\\"; + someFocusAtom.debugLabel = "someFocusAtom"; const someAtomWithValidate = atomWithValidate('', {}); - someAtomWithValidate.debugLabel = \\"someAtomWithValidate\\"; + someAtomWithValidate.debugLabel = "someAtomWithValidate"; const someValidateAtoms = validateAtoms({}, () => {}); - someValidateAtoms.debugLabel = \\"someValidateAtoms\\"; + someValidateAtoms.debugLabel = "someValidateAtoms"; const someAtomWithCache = atomWithCache(async () => {}); - someAtomWithCache.debugLabel = \\"someAtomWithCache\\"; + someAtomWithCache.debugLabel = "someAtomWithCache"; const someAtomWithRecoilValue = atomWithRecoilValue({}); - someAtomWithRecoilValue.debugLabel = \\"someAtomWithRecoilValue\\";" + someAtomWithRecoilValue.debugLabel = "someAtomWithRecoilValue";" `) }) @@ -168,6 +168,6 @@ it('Handles custom atom names a debugLabel to an atom', () => { ]), ).toMatchInlineSnapshot(` "const mySpecialThing = myCustomAtom(0); - mySpecialThing.debugLabel = \\"mySpecialThing\\";" + mySpecialThing.debugLabel = "mySpecialThing";" `) }) diff --git a/tests/babel/plugin-react-refresh.test.ts b/tests/babel/plugin-react-refresh.test.ts index 352d547b9f..a83dbc2121 100644 --- a/tests/babel/plugin-react-refresh.test.ts +++ b/tests/babel/plugin-react-refresh.test.ts @@ -28,7 +28,7 @@ it('Should add a cache for a single atom', () => { return inst; } }; - const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/countAtom\\", atom(0));" + const countAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/countAtom", atom(0));" `) }) @@ -52,8 +52,8 @@ it('Should add a cache for multiple atoms', () => { return inst; } }; - const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/countAtom\\", atom(0)); - const doubleAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/doubleAtom\\", atom(get => get(countAtom) * 2));" + const countAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/countAtom", atom(0)); + const doubleAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/doubleAtom", atom(get => get(countAtom) * 2));" `) }) @@ -77,8 +77,8 @@ it('Should add a cache for multiple exported atoms', () => { return inst; } }; - export const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/countAtom\\", atom(0)); - export const doubleAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/doubleAtom\\", atom(get => get(countAtom) * 2));" + export const countAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/countAtom", atom(0)); + export const doubleAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/doubleAtom", atom(get => get(countAtom) * 2));" `) }) @@ -95,7 +95,7 @@ it('Should add a cache for a default exported atom', () => { return inst; } }; - export default globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/defaultExport\\", atom(0));" + export default globalThis.jotaiAtomCache.get("/src/atoms/index.ts/defaultExport", atom(0));" `) }) @@ -119,8 +119,8 @@ it('Should add a cache for mixed exports of atoms', () => { return inst; } }; - export const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/countAtom\\", atom(0)); - export default globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/defaultExport\\", atom(get => get(countAtom) * 2));" + export const countAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/countAtom", atom(0)); + export default globalThis.jotaiAtomCache.get("/src/atoms/index.ts/defaultExport", atom(get => get(countAtom) * 2));" `) }) @@ -160,9 +160,9 @@ it('Should handle atoms returned from functions (#891)', () => { anAtom.debugLabel = label; return anAtom; } - const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/countAtom\\", atom(0)); - const countAtom2 = createAtom(\\"countAtom2\\"); - const countAtom3 = createAtom(\\"countAtom3\\");" + const countAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/countAtom", atom(0)); + const countAtom2 = createAtom("countAtom2"); + const countAtom3 = createAtom("countAtom3");" `) }) @@ -184,6 +184,6 @@ it('Should handle custom atom names', () => { return inst; } }; - const mySpecialThing = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/mySpecialThing\\", myCustomAtom(0));" + const mySpecialThing = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/mySpecialThing", myCustomAtom(0));" `) }) diff --git a/tests/babel/preset.test.ts b/tests/babel/preset.test.ts index df02911cb1..2339b293ea 100644 --- a/tests/babel/preset.test.ts +++ b/tests/babel/preset.test.ts @@ -27,8 +27,8 @@ it('Should add a debugLabel and cache to an atom', () => { return inst; } }; - const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms.ts/countAtom\\", atom(0)); - countAtom.debugLabel = \\"countAtom\\";" + const countAtom = globalThis.jotaiAtomCache.get("/src/atoms.ts/countAtom", atom(0)); + countAtom.debugLabel = "countAtom";" `) }) @@ -51,10 +51,10 @@ it('Should add a debugLabel and cache to multiple atoms', () => { return inst; } }; - const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms.ts/countAtom\\", atom(0)); - countAtom.debugLabel = \\"countAtom\\"; - const doubleAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms.ts/doubleAtom\\", atom(get => get(countAtom) * 2)); - doubleAtom.debugLabel = \\"doubleAtom\\";" + const countAtom = globalThis.jotaiAtomCache.get("/src/atoms.ts/countAtom", atom(0)); + countAtom.debugLabel = "countAtom"; + const doubleAtom = globalThis.jotaiAtomCache.get("/src/atoms.ts/doubleAtom", atom(get => get(countAtom) * 2)); + doubleAtom.debugLabel = "doubleAtom";" `) }) @@ -78,10 +78,10 @@ it('Should add a cache and debugLabel for multiple exported atoms', () => { return inst; } }; - export const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/countAtom\\", atom(0)); - countAtom.debugLabel = \\"countAtom\\"; - export const doubleAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/doubleAtom\\", atom(get => get(countAtom) * 2)); - doubleAtom.debugLabel = \\"doubleAtom\\";" + export const countAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/countAtom", atom(0)); + countAtom.debugLabel = "countAtom"; + export const doubleAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/doubleAtom", atom(get => get(countAtom) * 2)); + doubleAtom.debugLabel = "doubleAtom";" `) }) @@ -98,8 +98,8 @@ it('Should add a cache and debugLabel for a default exported atom', () => { return inst; } }; - const atoms = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/atoms\\", atom(0)); - atoms.debugLabel = \\"atoms\\"; + const atoms = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/atoms", atom(0)); + atoms.debugLabel = "atoms"; export default atoms;" `) }) @@ -124,10 +124,10 @@ it('Should add a cache and debugLabel for mixed exports of atoms', () => { return inst; } }; - export const countAtom = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/countAtom\\", atom(0)); - countAtom.debugLabel = \\"countAtom\\"; - const atoms = globalThis.jotaiAtomCache.get(\\"/src/atoms/index.ts/atoms\\", atom(get => get(countAtom) * 2)); - atoms.debugLabel = \\"atoms\\"; + export const countAtom = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/countAtom", atom(0)); + countAtom.debugLabel = "countAtom"; + const atoms = globalThis.jotaiAtomCache.get("/src/atoms/index.ts/atoms", atom(get => get(countAtom) * 2)); + atoms.debugLabel = "atoms"; export default atoms;" `) }) @@ -154,7 +154,7 @@ it('Should handle custom atom names', () => { return inst; } }; - const mySpecialThing = globalThis.jotaiAtomCache.get(\\"/src/atoms.ts/mySpecialThing\\", myCustomAtom(0)); - mySpecialThing.debugLabel = \\"mySpecialThing\\";" + const mySpecialThing = globalThis.jotaiAtomCache.get("/src/atoms.ts/mySpecialThing", myCustomAtom(0)); + mySpecialThing.debugLabel = "mySpecialThing";" `) }) diff --git a/tests/react/dependency.test.tsx b/tests/react/dependency.test.tsx index debe14d747..af72636093 100644 --- a/tests/react/dependency.test.tsx +++ b/tests/react/dependency.test.tsx @@ -908,7 +908,9 @@ describe('glitch free', () => { it('should not call read function for unmounted atoms in StrictMode (#2076)', async () => { const countAtom = atom(1) - let firstDerivedFn: ReturnType | undefined + let firstDerivedFn: + | (((get: Getter) => number) & { mockClear: () => void }) + | undefined const Component = () => { const memoizedAtomRef = useRef | null>(null) diff --git a/tests/react/utils/useResetAtom.test.tsx b/tests/react/utils/useResetAtom.test.tsx index 106ee80b23..703df3ee5d 100644 --- a/tests/react/utils/useResetAtom.test.tsx +++ b/tests/react/utils/useResetAtom.test.tsx @@ -63,7 +63,9 @@ it('atomWithReset reset based on previous value', async () => {
count: {count}