@aristobyte-ui/jest-config 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/jest.base.js +20 -0
- package/dist/jest.next.js +11 -0
- package/dist/jest.react.js +9 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @aristobyte-ui/jest-config
|
|
2
|
+
|
|
3
|
+
Scalable, centralized Jest configurations for AristoByte’s TypeScript monorepos — with first-class support for Node, React, and Next.js environments.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📦 Exported Config Profiles
|
|
8
|
+
|
|
9
|
+
| Config Path | Description |
|
|
10
|
+
| ---------------------------------- | --------------------------------------------------------------------------------- |
|
|
11
|
+
| `@aristobyte-ui/jest-config/base` | Core config for libraries and backend packages. Targets Node.js environments. |
|
|
12
|
+
| `@aristobyte-ui/jest-config/react` | Extends `base` for React-based packages with jsdom and Testing Library support. |
|
|
13
|
+
| `@aristobyte-ui/jest-config/next` | Builds on `react`, adding CSS module mocks and alias resolution for Next.js apps. |
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 🚀 Usage
|
|
18
|
+
|
|
19
|
+
1. **Install peer dependencies** (in consuming package):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
yarn add -D jest babel-jest @babel/preset-env @babel/preset-typescript @testing-library/jest-dom identity-obj-proxy
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Consume a config in your jest.config.js or jest.config.mjs:
|
|
26
|
+
|
|
27
|
+
## Node / Base
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { config as base } from "@aristobyte-ui/jest-config/base.js";
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
...base,
|
|
34
|
+
displayName: "my-lib",
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## React
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { config as react } from "@aristobyte-ui/jest-config/react.js";
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
...react,
|
|
45
|
+
displayName: "ui-components",
|
|
46
|
+
rootDir: ".",
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Next.js
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import { config as next } from "@aristobyte-ui/jest-config/next.js";
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
...next,
|
|
57
|
+
displayName: "web-app",
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 🧠 Why Use This?
|
|
62
|
+
|
|
63
|
+
- ✅ Unified test strategy across apps and packages
|
|
64
|
+
- 📐 Consistent coverage + transformation rules
|
|
65
|
+
- 🧪 Seamless Testing Library support for React
|
|
66
|
+
- ⚙️ Clean path aliasing & style mock handling for Next.js
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
© AristoByte Inc. — Streamlining test infrastructure at scale.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
exports.config = {
|
|
5
|
+
testEnvironment: "node",
|
|
6
|
+
transform: {
|
|
7
|
+
"^.+\\.(ts|tsx|js|jsx)$": [
|
|
8
|
+
"babel-jest",
|
|
9
|
+
{
|
|
10
|
+
presets: ["@babel/preset-env", "@babel/preset-typescript"],
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json"],
|
|
15
|
+
moduleDirectories: ["node_modules", "src"],
|
|
16
|
+
coverageDirectory: "./coverage",
|
|
17
|
+
collectCoverageFrom: ["**/*.{ts,tsx}", "!**/node_modules/**", "!**/dist/**"],
|
|
18
|
+
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
|
|
19
|
+
globals: {},
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
const jest_react_1 = require("./jest.react");
|
|
5
|
+
exports.config = {
|
|
6
|
+
...jest_react_1.config,
|
|
7
|
+
moduleNameMapper: {
|
|
8
|
+
"^@/(.*)$": "<rootDir>/src/$1",
|
|
9
|
+
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
const jest_base_1 = require("./jest.base");
|
|
5
|
+
exports.config = {
|
|
6
|
+
...jest_base_1.config,
|
|
7
|
+
testEnvironment: "jsdom",
|
|
8
|
+
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"],
|
|
9
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aristobyte-ui/jest-config",
|
|
3
|
+
"description": "Centralized, shareable Jest configurations for AristoByteUI monorepo projects.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "./jest.base.js",
|
|
8
|
+
"author": "AristoByte <info@aristobyte.com>",
|
|
9
|
+
"homepage": "https://github.com/aristobyte-team/aristobyte-ui.git#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/aristobyte-team/aristobyte-ui.git",
|
|
13
|
+
"directory": "packages/jest-config"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/aristobyte-team/aristobyte-ui.git/issues"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20.17.0",
|
|
20
|
+
"npm": ">=10.8.2",
|
|
21
|
+
"yarn": ">=1.22.22"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"jest",
|
|
25
|
+
"config",
|
|
26
|
+
"testing",
|
|
27
|
+
"monorepo",
|
|
28
|
+
"aristobyte",
|
|
29
|
+
"shared-config"
|
|
30
|
+
],
|
|
31
|
+
"exports": {
|
|
32
|
+
"./base": "./dist/jest.base.js",
|
|
33
|
+
"./react": "./dist/jest.react.js",
|
|
34
|
+
"./next": "./dist/jest.next.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc --project tsconfig.json"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@babel/preset-env": "^7.0.0",
|
|
44
|
+
"@babel/preset-typescript": "^7.0.0",
|
|
45
|
+
"babel-jest": "^29.0.0",
|
|
46
|
+
"jest": "^29.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@jest/types": "^30.0.0-beta.3",
|
|
50
|
+
"@testing-library/jest-dom": "^6.0.0",
|
|
51
|
+
"@types/jest": "^29.5.14",
|
|
52
|
+
"identity-obj-proxy": "^3.0.0"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
}
|
|
57
|
+
}
|