@mysetup/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 ADDED
@@ -0,0 +1,14 @@
1
+ # `@mysetup/jest-config`
2
+
3
+ A base [Jest](https://jestjs.io/) configuration with [ts-jest](https://kulshekhar.github.io/ts-jest/), [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/), and [Jest aXe](https://github.com/nickcolley/jest-axe).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ const jestConfig = require("@mysetup/jest-config");
9
+
10
+ module.exports = {
11
+ ...jestConfig,
12
+ // Additional configuration
13
+ };
14
+ ```
@@ -0,0 +1,8 @@
1
+ export declare const logger: {
2
+ log: jest.Mock<any, any, any>;
3
+ debug: jest.Mock<any, any, any>;
4
+ info: jest.Mock<any, any, any>;
5
+ warn: jest.Mock<any, any, any>;
6
+ error: jest.Mock<any, any, any>;
7
+ };
8
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../__mocks__/logger.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;CAMlB,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = void 0;
4
+ exports.logger = {
5
+ log: jest.fn(),
6
+ debug: jest.fn(),
7
+ info: jest.fn(),
8
+ warn: jest.fn(),
9
+ error: jest.fn(),
10
+ };
@@ -0,0 +1,3 @@
1
+ declare const _default: {};
2
+ export default _default;
3
+ //# sourceMappingURL=styleMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styleMock.d.ts","sourceRoot":"","sources":["../../__mocks__/styleMock.ts"],"names":[],"mappings":";AAAA,wBAAkB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {};
@@ -0,0 +1,4 @@
1
+ declare const _default: "svg-mock";
2
+ export default _default;
3
+ export declare const ReactComponent = "svg-mock";
4
+ //# sourceMappingURL=svgMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgMock.d.ts","sourceRoot":"","sources":["../../__mocks__/svgMock.ts"],"names":[],"mappings":";AAAA,wBAA0B;AAC1B,eAAO,MAAM,cAAc,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReactComponent = void 0;
4
+ exports.default = 'svg-mock';
5
+ exports.ReactComponent = 'svg-mock';
@@ -0,0 +1,3 @@
1
+ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
+ declare const path: any;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,QAAA,MAAM,IAAI,KAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
3
+ var path = require("node:path");
4
+ module.exports = {
5
+ coveragePathIgnorePatterns: [
6
+ "/build/",
7
+ "/dist/",
8
+ "/.next/",
9
+ "/__fixtures__/",
10
+ "/__mocks__/",
11
+ "/node_modules/",
12
+ ],
13
+ coverageThreshold: {
14
+ global: {
15
+ branches: 20,
16
+ functions: 25,
17
+ lines: 25,
18
+ statements: 25,
19
+ },
20
+ },
21
+ moduleDirectories: [
22
+ __dirname,
23
+ "node_modules",
24
+ path.resolve(__dirname, "../"),
25
+ ],
26
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
27
+ moduleNameMapper: {
28
+ '\\.(svg)$': path.resolve(__dirname, "./__mocks__/svgMock.js"),
29
+ "\\.(css|scss)$": path.resolve(__dirname, "./__mocks__/styleMock.js"),
30
+ "swiper/css": path.resolve(__dirname, "./__mocks__/styleMock.js"),
31
+ "@mysetup/logger": path.resolve(__dirname, "./__mocks__/logger.js"),
32
+ },
33
+ modulePathIgnorePatterns: [".*__mocks__.*"],
34
+ preset: "ts-jest",
35
+ setupFilesAfterEnv: [path.resolve(__dirname, "./setupTests.js")],
36
+ testEnvironment: "jsdom",
37
+ testPathIgnorePatterns: ["generated/", "/node_modules/", "/dist/"],
38
+ transformIgnorePatterns: ["node_modules/.pnpm/(?!(swiper|ssr-window|dom7))"],
39
+ transform: {
40
+ "^.+\\.(js|jsx|ts|tsx)$": ["babel-jest", { presets: ["next/babel"] }],
41
+ },
42
+ };
@@ -0,0 +1,3 @@
1
+ import "@testing-library/jest-dom";
2
+ import "jest-canvas-mock";
3
+ //# sourceMappingURL=setupTests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../setupTests.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAGnC,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ require("@testing-library/jest-dom");
15
+ var node_util_1 = require("node:util");
16
+ var jest_axe_1 = require("jest-axe");
17
+ require("jest-canvas-mock");
18
+ jest.mock("react-dom", function () { return (__assign(__assign({}, jest.requireActual("react-dom")), { preload: jest.fn() })); });
19
+ jest.setTimeout(30000);
20
+ global.scrollTo = jest.fn();
21
+ jest.spyOn(global.console, "log").mockImplementation(function () { return jest.fn(); });
22
+ jest.spyOn(global.console, "debug").mockImplementation(function () { return jest.fn(); });
23
+ jest.spyOn(global.console, "info").mockImplementation(function () { return jest.fn(); });
24
+ jest.spyOn(global.console, "warn").mockImplementation(function () { return jest.fn(); });
25
+ jest.spyOn(global.console, "error").mockImplementation(function () { return jest.fn(); });
26
+ global.alert = jest.fn();
27
+ global.TextEncoder = node_util_1.TextEncoder;
28
+ // IntersectionObserver isn't available in test environment
29
+ var mockIntersectionObserver = jest.fn();
30
+ mockIntersectionObserver.mockReturnValue({
31
+ observe: function () { return null; },
32
+ unobserve: function () { return null; },
33
+ disconnect: function () { return null; },
34
+ });
35
+ global.IntersectionObserver = mockIntersectionObserver;
36
+ var matchMedia = jest.fn();
37
+ matchMedia.mockReturnValue({
38
+ matches: false,
39
+ addListener: jest.fn(),
40
+ removeListener: jest.fn(),
41
+ });
42
+ global.matchMedia = matchMedia;
43
+ expect.extend(jest_axe_1.toHaveNoViolations);
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@mysetup/jest-config",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "scripts": {
18
+ "build": "rm -rf ./dist && tsc",
19
+ "clean": "rm -rf node_modules .swc dist pnpm-lock.yaml && echo \"✅ Successfully removed \""
20
+ },
21
+ "dependencies": {
22
+ "@react-aria/utils": "^3.25.3",
23
+ "@testing-library/jest-dom": "^6.6.3",
24
+ "@testing-library/react": "^16.0.1",
25
+ "@types/react-dom": "^18.3.1",
26
+ "jest": "^29.7.0",
27
+ "jest-axe": "^9.0.0",
28
+ "jest-canvas-mock": "^2.5.2",
29
+ "jest-environment-jsdom": "^29.7.0",
30
+ "next": "^15.0.2",
31
+ "ts-jest": "^29.2.5"
32
+ },
33
+ "devDependencies": {
34
+ "@mysetup/tsconfig": "latest",
35
+ "@types/jest": "^29.5.14",
36
+ "@types/jest-axe": "^3.5.9",
37
+ "@types/node": "^22.8.6",
38
+ "react": "^18.3.1",
39
+ "react-dom": "^18.3.1",
40
+ "typescript": "^5.6.3"
41
+ },
42
+ "prettier": "@mysetup/prettier-config",
43
+ "engines": {
44
+ "node": ">=18.0.0"
45
+ },
46
+ "packageManager": "pnpm@9.9.0"
47
+ }