Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 43891e1

Browse files
joshuaellismpeyper
andauthored
refactor: move tests to specifically related folders
* refactor: move tests to specifically related folders * chore(config): update outdated configs after test changes * refactor: remove index from import paths in tests Co-authored-by: Michael Peyper <mpeyper7@gmail.com>
1 parent ca32bce commit 43891e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+62
-68
lines changed

‎.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"@typescript-eslint/no-invalid-void-type": "off"
1212
},
1313
"parserOptions": {
14-
"project": ["./tsconfig.json", "./test/tsconfig.json", "./scripts/tsconfig.json"]
14+
"project": ["./tsconfig.json", "./scripts/tsconfig.json"]
1515
}
1616
}

‎.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
# node
12
node_modules
2-
coverage
3+
4+
# build generated
35
lib
46
dom
57
native
68
server
79
pure
810
.docz
911
site
12+
13+
# tests (need the !files because of the build generated above)
14+
coverage
15+
!src/dom
16+
!src/native
17+
!src/server
18+
19+
# settings from IDE
1020
.vscode

‎jest.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎test/dom/asyncHook.ts renamed to ‎src/dom/__tests__/asyncHook.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useRef, useEffect } from 'react'
2-
import { renderHook } from '../../src/dom'
2+
import { renderHook } from '..'
33

44
describe('async hook tests', () => {
55
const useSequence = (...values: string[]) => {

‎test/native/autoCleanup.disabled.ts renamed to ‎src/dom/__tests__/autoCleanup.disabled.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect } from 'react'
22

3-
import { ReactHooksRenderer } from 'types'
3+
import { ReactHooksRenderer } from '../../types/react'
44

55
// This verifies that if RHTL_SKIP_AUTO_CLEANUP is set
66
// then we DON'T auto-wire up the afterEach for folks
@@ -11,7 +11,7 @@ describe('skip auto cleanup (disabled) tests', () => {
1111
beforeAll(() => {
1212
process.env.RHTL_SKIP_AUTO_CLEANUP = 'true'
1313
// eslint-disable-next-line @typescript-eslint/no-var-requires
14-
renderHook = (require('../../src/native') as ReactHooksRenderer).renderHook
14+
renderHook = (require('..') as ReactHooksRenderer).renderHook
1515
})
1616

1717
test('first', () => {

‎test/native/autoCleanup.noAfterEach.ts renamed to ‎src/dom/__tests__/autoCleanup.noAfterEach.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect } from 'react'
22

3-
import { ReactHooksRenderer } from 'types'
3+
import { ReactHooksRenderer } from '../../types/react'
44

55
// This verifies that if RHTL_SKIP_AUTO_CLEANUP is set
66
// then we DON'T auto-wire up the afterEach for folks
@@ -13,7 +13,7 @@ describe('skip auto cleanup (no afterEach) tests', () => {
1313
// eslint-disable-next-line no-global-assign
1414
afterEach = false
1515
// eslint-disable-next-line @typescript-eslint/no-var-requires
16-
renderHook = (require('../../src/native') as ReactHooksRenderer).renderHook
16+
renderHook = (require('..') as ReactHooksRenderer).renderHook
1717
})
1818

1919
test('first', () => {

‎test/dom/autoCleanup.ts renamed to ‎src/dom/__tests__/autoCleanup.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect } from 'react'
2-
import { renderHook } from '../../src/dom'
2+
import { renderHook } from '..'
33

44
// This verifies that by importing RHTL in an
55
// environment which supports afterEach (like Jest)

‎test/dom/cleanup.ts renamed to ‎src/dom/__tests__/cleanup.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect } from 'react'
2-
import { renderHook, cleanup, addCleanup, removeCleanup } from '../../src/dom/pure'
2+
import { renderHook, cleanup, addCleanup, removeCleanup } from '../pure'
33

44
describe('cleanup tests', () => {
55
test('should flush effects on cleanup', async () => {

‎test/dom/customHook.ts renamed to ‎src/dom/__tests__/customHook.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useCallback } from 'react'
2-
import { renderHook, act } from '../../src/dom'
2+
import { renderHook, act } from '..'
33

44
describe('custom hook tests', () => {
55
function useCounter() {

‎test/dom/errorHook.ts renamed to ‎src/dom/__tests__/errorHook.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useEffect } from 'react'
2-
import { renderHook } from '../../src/dom'
2+
import { renderHook } from '..'
33

44
describe('error hook tests', () => {
55
function useError(throwError?: boolean) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /