diff --git a/.eslintrc b/.eslintrc index 5e90a5cf..f49a9cab 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,6 +11,6 @@ "@typescript-eslint/no-invalid-void-type": "off" }, "parserOptions": { - "project": ["./tsconfig.json", "./test/tsconfig.json", "./scripts/tsconfig.json"] + "project": ["./tsconfig.json", "./scripts/tsconfig.json"] } } diff --git a/.gitignore b/.gitignore index 2236836e..33e40a57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +# node node_modules -coverage + +# build generated lib dom native @@ -7,4 +9,12 @@ server pure .docz site + +# tests (need the !files because of the build generated above) +coverage +!src/dom +!src/native +!src/server + +# settings from IDE .vscode diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index d9ce8bbb..00000000 --- a/jest.config.js +++ /dev/null @@ -1,7 +0,0 @@ -// eslint-disable-next-line -const { jest: jestConfig } = require('kcd-scripts/config') - -module.exports = Object.assign(jestConfig, { - roots: ['/src', '/test'], - testMatch: ['/test/**/*.(ts|tsx|js)'] -}) diff --git a/test/dom/asyncHook.ts b/src/dom/__tests__/asyncHook.test.ts similarity index 99% rename from test/dom/asyncHook.ts rename to src/dom/__tests__/asyncHook.test.ts index 20559e4c..4484b81e 100644 --- a/test/dom/asyncHook.ts +++ b/src/dom/__tests__/asyncHook.test.ts @@ -1,5 +1,5 @@ import { useState, useRef, useEffect } from 'react' -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('async hook tests', () => { const useSequence = (...values: string[]) => { diff --git a/test/native/autoCleanup.disabled.ts b/src/dom/__tests__/autoCleanup.disabled.test.ts similarity index 84% rename from test/native/autoCleanup.disabled.ts rename to src/dom/__tests__/autoCleanup.disabled.test.ts index b43794d5..1485ff47 100644 --- a/test/native/autoCleanup.disabled.ts +++ b/src/dom/__tests__/autoCleanup.disabled.test.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { ReactHooksRenderer } from 'types' +import { ReactHooksRenderer } from '../../types/react' // This verifies that if RHTL_SKIP_AUTO_CLEANUP is set // then we DON'T auto-wire up the afterEach for folks @@ -11,7 +11,7 @@ describe('skip auto cleanup (disabled) tests', () => { beforeAll(() => { process.env.RHTL_SKIP_AUTO_CLEANUP = 'true' // eslint-disable-next-line @typescript-eslint/no-var-requires - renderHook = (require('../../src/native') as ReactHooksRenderer).renderHook + renderHook = (require('..') as ReactHooksRenderer).renderHook }) test('first', () => { diff --git a/test/native/autoCleanup.noAfterEach.ts b/src/dom/__tests__/autoCleanup.noAfterEach.test.ts similarity index 86% rename from test/native/autoCleanup.noAfterEach.ts rename to src/dom/__tests__/autoCleanup.noAfterEach.test.ts index 49b00b3d..afe4514d 100644 --- a/test/native/autoCleanup.noAfterEach.ts +++ b/src/dom/__tests__/autoCleanup.noAfterEach.test.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { ReactHooksRenderer } from 'types' +import { ReactHooksRenderer } from '../../types/react' // This verifies that if RHTL_SKIP_AUTO_CLEANUP is set // then we DON'T auto-wire up the afterEach for folks @@ -13,7 +13,7 @@ describe('skip auto cleanup (no afterEach) tests', () => { // eslint-disable-next-line no-global-assign afterEach = false // eslint-disable-next-line @typescript-eslint/no-var-requires - renderHook = (require('../../src/native') as ReactHooksRenderer).renderHook + renderHook = (require('..') as ReactHooksRenderer).renderHook }) test('first', () => { diff --git a/test/dom/autoCleanup.ts b/src/dom/__tests__/autoCleanup.test.ts similarity index 92% rename from test/dom/autoCleanup.ts rename to src/dom/__tests__/autoCleanup.test.ts index b5585350..f783f1c2 100644 --- a/test/dom/autoCleanup.ts +++ b/src/dom/__tests__/autoCleanup.test.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { renderHook } from '../../src/dom' +import { renderHook } from '..' // This verifies that by importing RHTL in an // environment which supports afterEach (like Jest) diff --git a/test/dom/cleanup.ts b/src/dom/__tests__/cleanup.test.ts similarity index 99% rename from test/dom/cleanup.ts rename to src/dom/__tests__/cleanup.test.ts index aafa877b..20a0f267 100644 --- a/test/dom/cleanup.ts +++ b/src/dom/__tests__/cleanup.test.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { renderHook, cleanup, addCleanup, removeCleanup } from '../../src/dom/pure' +import { renderHook, cleanup, addCleanup, removeCleanup } from '../pure' describe('cleanup tests', () => { test('should flush effects on cleanup', async () => { diff --git a/test/dom/customHook.ts b/src/dom/__tests__/customHook.test.ts similarity index 93% rename from test/dom/customHook.ts rename to src/dom/__tests__/customHook.test.ts index ab1b859d..5a1e83ab 100644 --- a/test/dom/customHook.ts +++ b/src/dom/__tests__/customHook.test.ts @@ -1,5 +1,5 @@ import { useState, useCallback } from 'react' -import { renderHook, act } from '../../src/dom' +import { renderHook, act } from '..' describe('custom hook tests', () => { function useCounter() { diff --git a/test/dom/errorHook.ts b/src/dom/__tests__/errorHook.test.ts similarity index 98% rename from test/dom/errorHook.ts rename to src/dom/__tests__/errorHook.test.ts index b0a5ba8c..7fb7a265 100644 --- a/test/dom/errorHook.ts +++ b/src/dom/__tests__/errorHook.test.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('error hook tests', () => { function useError(throwError?: boolean) { diff --git a/test/dom/resultHistory.ts b/src/dom/__tests__/resultHistory.test.ts similarity index 94% rename from test/dom/resultHistory.ts rename to src/dom/__tests__/resultHistory.test.ts index 68c84741..1da5e94b 100644 --- a/test/dom/resultHistory.ts +++ b/src/dom/__tests__/resultHistory.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('result history tests', () => { let count = 0 diff --git a/test/dom/suspenseHook.ts b/src/dom/__tests__/suspenseHook.test.ts similarity index 96% rename from test/dom/suspenseHook.ts rename to src/dom/__tests__/suspenseHook.test.ts index 174d70b2..d3f19a1d 100644 --- a/test/dom/suspenseHook.ts +++ b/src/dom/__tests__/suspenseHook.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('suspense hook tests', () => { const cache: { value?: Promise | string | Error } = {} diff --git a/test/dom/useContext.tsx b/src/dom/__tests__/useContext.test.tsx similarity index 97% rename from test/dom/useContext.tsx rename to src/dom/__tests__/useContext.test.tsx index 0f88c548..84046e30 100644 --- a/test/dom/useContext.tsx +++ b/src/dom/__tests__/useContext.test.tsx @@ -1,5 +1,5 @@ import React, { createContext, useContext } from 'react' -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('useContext tests', () => { test('should get default value from context', () => { diff --git a/test/dom/useEffect.ts b/src/dom/__tests__/useEffect.test.ts similarity index 97% rename from test/dom/useEffect.ts rename to src/dom/__tests__/useEffect.test.ts index b09c2fa6..0091b7a8 100644 --- a/test/dom/useEffect.ts +++ b/src/dom/__tests__/useEffect.test.ts @@ -1,5 +1,5 @@ import { useEffect, useLayoutEffect } from 'react' -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('useEffect tests', () => { test('should handle useEffect hook', () => { diff --git a/test/dom/useMemo.ts b/src/dom/__tests__/useMemo.test.ts similarity index 96% rename from test/dom/useMemo.ts rename to src/dom/__tests__/useMemo.test.ts index f8a7e86a..dcf0de7d 100644 --- a/test/dom/useMemo.ts +++ b/src/dom/__tests__/useMemo.test.ts @@ -1,5 +1,5 @@ import { useMemo, useCallback } from 'react' -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('useCallback tests', () => { test('should handle useMemo hook', () => { diff --git a/test/dom/useReducer.ts b/src/dom/__tests__/useReducer.test.ts similarity index 91% rename from test/dom/useReducer.ts rename to src/dom/__tests__/useReducer.test.ts index 0e9ff9e8..fab39201 100644 --- a/test/dom/useReducer.ts +++ b/src/dom/__tests__/useReducer.test.ts @@ -1,5 +1,5 @@ import { useReducer } from 'react' -import { renderHook, act } from '../../src/dom' +import { renderHook, act } from '..' describe('useReducer tests', () => { test('should handle useReducer hook', () => { diff --git a/test/dom/useRef.ts b/src/dom/__tests__/useRef.test.ts similarity index 94% rename from test/dom/useRef.ts rename to src/dom/__tests__/useRef.test.ts index baca0ead..a8663e16 100644 --- a/test/dom/useRef.ts +++ b/src/dom/__tests__/useRef.test.ts @@ -1,5 +1,5 @@ import { useRef, useImperativeHandle } from 'react' -import { renderHook } from '../../src/dom' +import { renderHook } from '..' describe('useHook tests', () => { test('should handle useRef hook', () => { diff --git a/test/dom/useState.ts b/src/dom/__tests__/useState.test.ts similarity index 91% rename from test/dom/useState.ts rename to src/dom/__tests__/useState.test.ts index e25c8bbe..78cbaa6f 100644 --- a/test/dom/useState.ts +++ b/src/dom/__tests__/useState.test.ts @@ -1,5 +1,5 @@ import { useState } from 'react' -import { renderHook, act } from '../../src/dom' +import { renderHook, act } from '..' describe('useState tests', () => { test('should use setState value', () => { diff --git a/test/native/asyncHook.ts b/src/native/__tests__/asyncHook.test.ts similarity index 99% rename from test/native/asyncHook.ts rename to src/native/__tests__/asyncHook.test.ts index 18977b19..4484b81e 100644 --- a/test/native/asyncHook.ts +++ b/src/native/__tests__/asyncHook.test.ts @@ -1,5 +1,5 @@ import { useState, useRef, useEffect } from 'react' -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('async hook tests', () => { const useSequence = (...values: string[]) => { diff --git a/test/server/autoCleanup.disabled.ts b/src/native/__tests__/autoCleanup.disabled.test.ts similarity index 84% rename from test/server/autoCleanup.disabled.ts rename to src/native/__tests__/autoCleanup.disabled.test.ts index 00853a13..1485ff47 100644 --- a/test/server/autoCleanup.disabled.ts +++ b/src/native/__tests__/autoCleanup.disabled.test.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { ReactHooksRenderer } from 'types' +import { ReactHooksRenderer } from '../../types/react' // This verifies that if RHTL_SKIP_AUTO_CLEANUP is set // then we DON'T auto-wire up the afterEach for folks @@ -11,7 +11,7 @@ describe('skip auto cleanup (disabled) tests', () => { beforeAll(() => { process.env.RHTL_SKIP_AUTO_CLEANUP = 'true' // eslint-disable-next-line @typescript-eslint/no-var-requires - renderHook = (require('../../src/server') as ReactHooksRenderer).renderHook + renderHook = (require('..') as ReactHooksRenderer).renderHook }) test('first', () => { diff --git a/test/server/autoCleanup.noAfterEach.ts b/src/native/__tests__/autoCleanup.noAfterEach.test.ts similarity index 86% rename from test/server/autoCleanup.noAfterEach.ts rename to src/native/__tests__/autoCleanup.noAfterEach.test.ts index 180dbea3..afe4514d 100644 --- a/test/server/autoCleanup.noAfterEach.ts +++ b/src/native/__tests__/autoCleanup.noAfterEach.test.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { ReactHooksRenderer } from 'types' +import { ReactHooksRenderer } from '../../types/react' // This verifies that if RHTL_SKIP_AUTO_CLEANUP is set // then we DON'T auto-wire up the afterEach for folks @@ -13,7 +13,7 @@ describe('skip auto cleanup (no afterEach) tests', () => { // eslint-disable-next-line no-global-assign afterEach = false // eslint-disable-next-line @typescript-eslint/no-var-requires - renderHook = (require('../../src/server') as ReactHooksRenderer).renderHook + renderHook = (require('..') as ReactHooksRenderer).renderHook }) test('first', () => { diff --git a/test/native/autoCleanup.ts b/src/native/__tests__/autoCleanup.test.ts similarity index 91% rename from test/native/autoCleanup.ts rename to src/native/__tests__/autoCleanup.test.ts index 2d7addf9..f783f1c2 100644 --- a/test/native/autoCleanup.ts +++ b/src/native/__tests__/autoCleanup.test.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { renderHook } from '../../src/native' +import { renderHook } from '..' // This verifies that by importing RHTL in an // environment which supports afterEach (like Jest) diff --git a/test/native/cleanup.ts b/src/native/__tests__/cleanup.test.ts similarity index 99% rename from test/native/cleanup.ts rename to src/native/__tests__/cleanup.test.ts index 9eeed775..20a0f267 100644 --- a/test/native/cleanup.ts +++ b/src/native/__tests__/cleanup.test.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { renderHook, cleanup, addCleanup, removeCleanup } from '../../src/native/pure' +import { renderHook, cleanup, addCleanup, removeCleanup } from '../pure' describe('cleanup tests', () => { test('should flush effects on cleanup', async () => { diff --git a/test/native/customHook.ts b/src/native/__tests__/customHook.test.ts similarity index 93% rename from test/native/customHook.ts rename to src/native/__tests__/customHook.test.ts index 8d699188..5a1e83ab 100644 --- a/test/native/customHook.ts +++ b/src/native/__tests__/customHook.test.ts @@ -1,5 +1,5 @@ import { useState, useCallback } from 'react' -import { renderHook, act } from '../../src/native' +import { renderHook, act } from '..' describe('custom hook tests', () => { function useCounter() { diff --git a/test/native/errorHook.ts b/src/native/__tests__/errorHook.test.ts similarity index 98% rename from test/native/errorHook.ts rename to src/native/__tests__/errorHook.test.ts index 078227c7..7fb7a265 100644 --- a/test/native/errorHook.ts +++ b/src/native/__tests__/errorHook.test.ts @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('error hook tests', () => { function useError(throwError?: boolean) { diff --git a/test/native/resultHistory.ts b/src/native/__tests__/resultHistory.test.ts similarity index 94% rename from test/native/resultHistory.ts rename to src/native/__tests__/resultHistory.test.ts index db01d5b7..1da5e94b 100644 --- a/test/native/resultHistory.ts +++ b/src/native/__tests__/resultHistory.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('result history tests', () => { let count = 0 diff --git a/test/native/suspenseHook.ts b/src/native/__tests__/suspenseHook.test.ts similarity index 96% rename from test/native/suspenseHook.ts rename to src/native/__tests__/suspenseHook.test.ts index 76e49830..d3f19a1d 100644 --- a/test/native/suspenseHook.ts +++ b/src/native/__tests__/suspenseHook.test.ts @@ -1,4 +1,4 @@ -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('suspense hook tests', () => { const cache: { value?: Promise | string | Error } = {} diff --git a/test/native/useContext.tsx b/src/native/__tests__/useContext.test.tsx similarity index 97% rename from test/native/useContext.tsx rename to src/native/__tests__/useContext.test.tsx index c306fb21..84046e30 100644 --- a/test/native/useContext.tsx +++ b/src/native/__tests__/useContext.test.tsx @@ -1,5 +1,5 @@ import React, { createContext, useContext } from 'react' -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('useContext tests', () => { test('should get default value from context', () => { diff --git a/test/native/useEffect.ts b/src/native/__tests__/useEffect.test.ts similarity index 96% rename from test/native/useEffect.ts rename to src/native/__tests__/useEffect.test.ts index c9c4a8d9..0091b7a8 100644 --- a/test/native/useEffect.ts +++ b/src/native/__tests__/useEffect.test.ts @@ -1,5 +1,5 @@ import { useEffect, useLayoutEffect } from 'react' -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('useEffect tests', () => { test('should handle useEffect hook', () => { diff --git a/test/native/useMemo.ts b/src/native/__tests__/useMemo.test.ts similarity index 96% rename from test/native/useMemo.ts rename to src/native/__tests__/useMemo.test.ts index 465ef591..dcf0de7d 100644 --- a/test/native/useMemo.ts +++ b/src/native/__tests__/useMemo.test.ts @@ -1,5 +1,5 @@ import { useMemo, useCallback } from 'react' -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('useCallback tests', () => { test('should handle useMemo hook', () => { diff --git a/test/native/useReducer.ts b/src/native/__tests__/useReducer.test.ts similarity index 90% rename from test/native/useReducer.ts rename to src/native/__tests__/useReducer.test.ts index 2de8c44d..fab39201 100644 --- a/test/native/useReducer.ts +++ b/src/native/__tests__/useReducer.test.ts @@ -1,5 +1,5 @@ import { useReducer } from 'react' -import { renderHook, act } from '../../src/native' +import { renderHook, act } from '..' describe('useReducer tests', () => { test('should handle useReducer hook', () => { diff --git a/test/native/useRef.ts b/src/native/__tests__/useRef.test.ts similarity index 94% rename from test/native/useRef.ts rename to src/native/__tests__/useRef.test.ts index a1ca0e27..a8663e16 100644 --- a/test/native/useRef.ts +++ b/src/native/__tests__/useRef.test.ts @@ -1,5 +1,5 @@ import { useRef, useImperativeHandle } from 'react' -import { renderHook } from '../../src/native' +import { renderHook } from '..' describe('useHook tests', () => { test('should handle useRef hook', () => { diff --git a/test/native/useState.ts b/src/native/__tests__/useState.test.ts similarity index 91% rename from test/native/useState.ts rename to src/native/__tests__/useState.test.ts index f384434f..78cbaa6f 100644 --- a/test/native/useState.ts +++ b/src/native/__tests__/useState.test.ts @@ -1,5 +1,5 @@ import { useState } from 'react' -import { renderHook, act } from '../../src/native' +import { renderHook, act } from '..' describe('useState tests', () => { test('should use setState value', () => { diff --git a/test/server/asyncHook.ts b/src/server/__tests__/asyncHook.test.ts similarity index 99% rename from test/server/asyncHook.ts rename to src/server/__tests__/asyncHook.test.ts index 9c872430..09ae1871 100644 --- a/test/server/asyncHook.ts +++ b/src/server/__tests__/asyncHook.test.ts @@ -1,6 +1,6 @@ import { useState, useRef, useEffect } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' describe('async hook tests', () => { const useSequence = (...values: string[]) => { diff --git a/test/dom/autoCleanup.disabled.ts b/src/server/__tests__/autoCleanup.disabled.test.ts similarity index 84% rename from test/dom/autoCleanup.disabled.ts rename to src/server/__tests__/autoCleanup.disabled.test.ts index 1bcf45be..1485ff47 100644 --- a/test/dom/autoCleanup.disabled.ts +++ b/src/server/__tests__/autoCleanup.disabled.test.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { ReactHooksRenderer } from 'types/react' +import { ReactHooksRenderer } from '../../types/react' // This verifies that if RHTL_SKIP_AUTO_CLEANUP is set // then we DON'T auto-wire up the afterEach for folks @@ -11,7 +11,7 @@ describe('skip auto cleanup (disabled) tests', () => { beforeAll(() => { process.env.RHTL_SKIP_AUTO_CLEANUP = 'true' // eslint-disable-next-line @typescript-eslint/no-var-requires - renderHook = (require('../../src/dom') as ReactHooksRenderer).renderHook + renderHook = (require('..') as ReactHooksRenderer).renderHook }) test('first', () => { diff --git a/test/dom/autoCleanup.noAfterEach.ts b/src/server/__tests__/autoCleanup.noAfterEach.test.ts similarity index 86% rename from test/dom/autoCleanup.noAfterEach.ts rename to src/server/__tests__/autoCleanup.noAfterEach.test.ts index 12dd75e1..afe4514d 100644 --- a/test/dom/autoCleanup.noAfterEach.ts +++ b/src/server/__tests__/autoCleanup.noAfterEach.test.ts @@ -1,6 +1,6 @@ import { useEffect } from 'react' -import { ReactHooksRenderer } from 'types/react' +import { ReactHooksRenderer } from '../../types/react' // This verifies that if RHTL_SKIP_AUTO_CLEANUP is set // then we DON'T auto-wire up the afterEach for folks @@ -13,7 +13,7 @@ describe('skip auto cleanup (no afterEach) tests', () => { // eslint-disable-next-line no-global-assign afterEach = false // eslint-disable-next-line @typescript-eslint/no-var-requires - renderHook = (require('../../src/dom') as ReactHooksRenderer).renderHook + renderHook = (require('..') as ReactHooksRenderer).renderHook }) test('first', () => { diff --git a/test/server/autoCleanup.ts b/src/server/__tests__/autoCleanup.test.ts similarity index 94% rename from test/server/autoCleanup.ts rename to src/server/__tests__/autoCleanup.test.ts index 087c2af8..87e473c1 100644 --- a/test/server/autoCleanup.ts +++ b/src/server/__tests__/autoCleanup.test.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' // This verifies that by importing RHTL in an // environment which supports afterEach (like Jest) diff --git a/test/server/cleanup.ts b/src/server/__tests__/cleanup.test.ts similarity index 96% rename from test/server/cleanup.ts rename to src/server/__tests__/cleanup.test.ts index e8033492..c12815ac 100644 --- a/test/server/cleanup.ts +++ b/src/server/__tests__/cleanup.test.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { renderHook, cleanup } from '../../src/server' +import { renderHook, cleanup } from '..' describe('cleanup tests', () => { test('should flush effects on cleanup', async () => { diff --git a/test/server/customHook.ts b/src/server/__tests__/customHook.test.ts similarity index 93% rename from test/server/customHook.ts rename to src/server/__tests__/customHook.test.ts index 2fadd2d6..cb512682 100644 --- a/test/server/customHook.ts +++ b/src/server/__tests__/customHook.test.ts @@ -1,5 +1,5 @@ import { useState, useCallback } from 'react' -import { renderHook, act } from '../../src/server' +import { renderHook, act } from '..' describe('custom hook tests', () => { function useCounter() { diff --git a/test/server/errorHook.ts b/src/server/__tests__/errorHook.test.ts similarity index 98% rename from test/server/errorHook.ts rename to src/server/__tests__/errorHook.test.ts index 1fcbd34b..10a489ab 100644 --- a/test/server/errorHook.ts +++ b/src/server/__tests__/errorHook.test.ts @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' describe('error hook tests', () => { function useError(throwError?: boolean) { diff --git a/test/server/hydrationErrors.ts b/src/server/__tests__/hydrationErrors.test.ts similarity index 94% rename from test/server/hydrationErrors.ts rename to src/server/__tests__/hydrationErrors.test.ts index 4b14dd0a..56a11aea 100644 --- a/test/server/hydrationErrors.ts +++ b/src/server/__tests__/hydrationErrors.test.ts @@ -1,5 +1,5 @@ import { useState, useCallback } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' describe('hydration errors tests', () => { function useCounter() { diff --git a/test/server/useContext.tsx b/src/server/__tests__/useContext.test.tsx similarity index 96% rename from test/server/useContext.tsx rename to src/server/__tests__/useContext.test.tsx index 33c1008b..cf92aab4 100644 --- a/test/server/useContext.tsx +++ b/src/server/__tests__/useContext.test.tsx @@ -1,5 +1,5 @@ import React, { createContext, useContext } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' describe('useContext tests', () => { test('should get default value from context', () => { diff --git a/test/server/useEffect.ts b/src/server/__tests__/useEffect.test.ts similarity index 94% rename from test/server/useEffect.ts rename to src/server/__tests__/useEffect.test.ts index 1adf23e4..782b7a03 100644 --- a/test/server/useEffect.ts +++ b/src/server/__tests__/useEffect.test.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' describe('useEffect tests', () => { test('should handle useEffect hook', () => { diff --git a/test/server/useMemo.ts b/src/server/__tests__/useMemo.test.ts similarity index 97% rename from test/server/useMemo.ts rename to src/server/__tests__/useMemo.test.ts index 202db24c..d762cf6a 100644 --- a/test/server/useMemo.ts +++ b/src/server/__tests__/useMemo.test.ts @@ -1,5 +1,5 @@ import { useMemo, useCallback } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' describe('useCallback tests', () => { test('should handle useMemo hook', () => { diff --git a/test/server/useReducer.ts b/src/server/__tests__/useReducer.test.ts similarity index 91% rename from test/server/useReducer.ts rename to src/server/__tests__/useReducer.test.ts index f11daf50..6184094a 100644 --- a/test/server/useReducer.ts +++ b/src/server/__tests__/useReducer.test.ts @@ -1,5 +1,5 @@ import { useReducer } from 'react' -import { renderHook, act } from '../../src/server' +import { renderHook, act } from '..' describe('useReducer tests', () => { test('should handle useReducer hook', () => { diff --git a/test/server/useRef.ts b/src/server/__tests__/useRef.test.ts similarity index 94% rename from test/server/useRef.ts rename to src/server/__tests__/useRef.test.ts index 26cdc323..f30d0bd7 100644 --- a/test/server/useRef.ts +++ b/src/server/__tests__/useRef.test.ts @@ -1,5 +1,5 @@ import { useRef, useImperativeHandle } from 'react' -import { renderHook } from '../../src/server' +import { renderHook } from '..' describe('useHook tests', () => { test('should handle useRef hook', () => { diff --git a/test/server/useState.ts b/src/server/__tests__/useState.test.ts similarity index 94% rename from test/server/useState.ts rename to src/server/__tests__/useState.test.ts index b3546357..27925863 100644 --- a/test/server/useState.ts +++ b/src/server/__tests__/useState.test.ts @@ -1,5 +1,5 @@ import { useState } from 'react' -import { renderHook, act } from '../../src/server' +import { renderHook, act } from '..' describe('useState tests', () => { test('should use state value', () => { diff --git a/test/tsconfig.json b/test/tsconfig.json deleted file mode 100644 index bbb2c4c6..00000000 --- a/test/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../tsconfig", - "compilerOptions": { - "declaration": false - }, - "exclude": [], - "include": ["./**/*.ts"] -} diff --git a/tsconfig.json b/tsconfig.json index 2b5e3606..7661340c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "./node_modules/kcd-scripts/shared-tsconfig.json", "compilerOptions": { - "allowJs": true, "target": "ES6" } }