Skip to content

Commit 1f02355

Browse files
committed
Refactor test setup.
1 parent e2f526b commit 1f02355

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
},
2222
"scripts": {
2323
"lint": "eslint src",
24-
"test": "jest src/Async.spec.js --collectCoverageFrom=src/Async.js",
25-
"test:hook": "jest src/useAsync.spec.js --collectCoverageFrom=src/useAsync.js",
26-
"test:watch": "npm run test -- --watch",
24+
"test": "jest src/*.spec.js",
25+
"test:watch": "npm test -- --watch",
26+
"test:hooks": "jest src/useAsync.spec.js --collectCoverageFrom=src/useAsync.js",
27+
"test:components": "jest src/Async.spec.js --collectCoverageFrom=src/Async.js",
28+
"test:backwards": "npm i [email protected] [email protected] --no-save && npm test:components",
29+
"test:forwards": "npm i react@next react-dom@next --no-save && npm test",
30+
"test:latest": "npm i react@latest react-dom@latest --no-save && npm test",
2731
"test:compat": "npm run test:backwards && npm run test:forwards && npm run test:latest",
28-
"test:backwards": "npm i [email protected] [email protected] --no-save && npm test",
29-
"test:forwards": "npm i react@next react-dom@next --no-save && npm test && npm run test:hook",
30-
"test:latest": "npm i react@latest react-dom@latest --no-save && npm test && npm run test:hook",
3132
"build": "pack build",
3233
"publish": "pack publish",
3334
"prepublishOnly": "npm run lint && npm run test:compat && npm run build"

src/Async.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
withPromise,
1313
withPromiseFn,
1414
withDeferFn,
15-
} from "./common.spec"
15+
} from "./specs"
1616

1717
const abortCtrl = { abort: jest.fn() }
1818
window.AbortController = jest.fn().mockImplementation(() => abortCtrl)
File renamed without changes.

src/useAsync.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import "jest-dom/extend-expect"
44
import React from "react"
55
import { render, fireEvent, cleanup, waitForElement } from "react-testing-library"
66
import { useAsync, useFetch } from "./index"
7-
import { resolveTo, common, withPromise, withPromiseFn, withDeferFn } from "./common.spec"
7+
import { resolveTo, common, withPromise, withPromiseFn, withDeferFn } from "./specs"
88

99
const abortCtrl = { abort: jest.fn(), signal: "SIGNAL" }
1010
window.AbortController = jest.fn(() => abortCtrl)

0 commit comments

Comments
 (0)