@websolutespa/test 3.0.1 → 4.0.0-next.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/dist/index.d.ts CHANGED
@@ -1,9 +1,13 @@
1
- import { Config } from 'jest';
1
+ import { Config } from "jest";
2
2
 
3
+ //#region src/index.d.ts
3
4
  declare const baseConfig: Config;
4
5
  declare function getProjectConfig(): {};
5
6
  declare function getAppConfig(): {};
6
7
  declare function getPackageConfig(): {};
7
8
  declare function getPayloadConfig(): {};
9
+ //# sourceMappingURL=index.d.ts.map
8
10
 
11
+ //#endregion
9
12
  export { baseConfig, getAppConfig, getPackageConfig, getPayloadConfig, getProjectConfig };
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;cAUa,YAAY;iBA0BT,gBAAA,CAAA;AA1BH,iBA0FG,YAAA,CAAA,CAlEf,EAAA,CAAA,CAAA;AAEe,iBAiFA,gBAAA,CAAA,CAjFgB,EAAA,CAAA,CAAA;AAgEhB,iBA2DA,gBAAA,CAAA,CA3DY,EAAA,CAAA,CAAA;AAiB5B"}
package/dist/index.js CHANGED
@@ -1,214 +1,105 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // index.ts
1
+ import { __require } from "./chunk-CpzDmygQ.js";
9
2
  import nextJest from "next/jest";
10
- var createJestConfig = nextJest({
11
- // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
12
- dir: "./"
13
- });
14
- var baseConfig = {
15
- verbose: false,
16
- silent: false,
17
- testTimeout: process.env.CI ? 2e4 : 1e4,
18
- // testEnvironment: 'jsdom',
19
- testEnvironment: "jest-environment-jsdom",
20
- // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
21
- reporters: ["default", "github-actions"],
22
- /*
23
- snapshotFormat: {
24
- printBasicPrototype: false,
25
- },
26
- */
27
- /*
28
- coverageThreshold: {
29
- global: {
30
- branches: 80,
31
- functions: 80,
32
- lines: 80,
33
- statements: 80,
34
- }
35
- },
36
- */
37
- coverageReporters: ["html", "text", "text-summary", "lcov"]
3
+
4
+ //#region src/index.ts
5
+ const createJestConfig = nextJest({ dir: "./" });
6
+ const baseConfig = {
7
+ verbose: false,
8
+ silent: false,
9
+ testTimeout: process.env.CI ? 2e4 : 1e4,
10
+ testEnvironment: "jest-environment-jsdom",
11
+ reporters: ["default", "github-actions"],
12
+ coverageReporters: [
13
+ "html",
14
+ "text",
15
+ "text-summary",
16
+ "lcov"
17
+ ]
38
18
  };
39
19
  function getProjectConfig() {
40
- const cwd = process.cwd();
41
- const config = {
42
- ...baseConfig,
43
- rootDir: ".",
44
- roots: [
45
- `${cwd}`
46
- ],
47
- resetMocks: true,
48
- modulePaths: [
49
- `${cwd}/src/`
50
- ],
51
- moduleDirectories: [
52
- "node_modules"
53
- ],
54
- testMatch: [
55
- "<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"
56
- ],
57
- coverageDirectory: `${cwd}/coverage`,
58
- collectCoverageFrom: [
59
- "<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"
60
- ],
61
- setupFilesAfterEnv: [`${cwd}/jest.setup.js`],
62
- transform: {
63
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
64
- jsc: {
65
- transform: {
66
- react: {
67
- runtime: "automatic"
68
- }
69
- }
70
- }
71
- }]
72
- },
73
- // Rewrite Swiper ESM imports as paths (allows them to be transformed w/o errors)
74
- moduleNameMapper: {
75
- "\\.(css|scss)$": "identity-obj-proxy",
76
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/packages/test/jest.mock.file.js",
77
- // swiper
78
- "swiper": "<rootDir>/node_modules/swiper/swiper-bundle.js",
79
- "swiper/react": "<rootDir>/node_modules/swiper/react/swiper-react.js"
80
- // 'swiper/css': '<rootDir>/node_modules/swiper/swiper.min.css',
81
- // 'swiper/css/bundle': '<rootDir>/node_modules/swiper/swiper-bundle.min.css',
82
- // 'swiper/css/autoplay': '<rootDir>/node_modules/swiper/modules/autoplay/autoplay.min.css',
83
- // 'swiper/css/free-mode': '<rootDir>/node_modules/swiper/modules/autoplay/free-mode.min.css',
84
- // 'swiper/css/navigation': '<rootDir>/node_modules/swiper/modules/autoplay/navigation.min.css',
85
- // 'swiper/css/pagination': '<rootDir>/node_modules/swiper/modules/autoplay/pagination.min.css',
86
- // Handle module aliases (this will be automatically configured for you soon)
87
- // '^@/components/(.*)$': '<rootDir>/components/$1',
88
- // '^@/pages/(.*)$': '<rootDir>/pages/$1',
89
- },
90
- modulePathIgnorePatterns: [
91
- "<rootDir>/build/",
92
- "<rootDir>/.next/"
93
- ],
94
- transformIgnorePatterns: [
95
- "node_modules",
96
- "node_modules/(?!(swiper|swiper/react|ssr-window|dom7)/)"
97
- ]
98
- };
99
- return config;
20
+ const cwd = process.cwd();
21
+ const config = {
22
+ ...baseConfig,
23
+ rootDir: ".",
24
+ roots: [`${cwd}`],
25
+ resetMocks: true,
26
+ modulePaths: [`${cwd}/src/`],
27
+ moduleDirectories: ["node_modules"],
28
+ testMatch: ["<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"],
29
+ coverageDirectory: `${cwd}/coverage`,
30
+ collectCoverageFrom: ["<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"],
31
+ setupFilesAfterEnv: [`${cwd}/jest.setup.js`],
32
+ transform: { "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", { jsc: { transform: { react: { runtime: "automatic" } } } }] },
33
+ moduleNameMapper: {
34
+ "\\.(css|scss)$": "identity-obj-proxy",
35
+ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/packages/test/jest.mock.file.js",
36
+ "swiper": "<rootDir>/node_modules/swiper/swiper-bundle.js",
37
+ "swiper/react": "<rootDir>/node_modules/swiper/react/swiper-react.js"
38
+ },
39
+ modulePathIgnorePatterns: ["<rootDir>/build/", "<rootDir>/.next/"],
40
+ transformIgnorePatterns: ["node_modules", "node_modules/(?!(swiper|swiper/react|ssr-window|dom7)/)"]
41
+ };
42
+ return config;
100
43
  }
101
44
  function getAppConfig() {
102
- const config = getProjectConfig();
103
- config.transform = {
104
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
105
- jsc: {
106
- transform: {
107
- react: {
108
- runtime: "automatic"
109
- }
110
- }
111
- },
112
- tsconfig: "tsconfig.test.json"
113
- }]
114
- };
115
- return createJestConfig(config);
45
+ const config = getProjectConfig();
46
+ config.transform = { "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
47
+ jsc: { transform: { react: { runtime: "automatic" } } },
48
+ tsconfig: "tsconfig.test.json"
49
+ }] };
50
+ return createJestConfig(config);
116
51
  }
117
52
  function getPackageConfig() {
118
- const cwd = process.cwd();
119
- const config = {
120
- ...baseConfig,
121
- rootDir: ".",
122
- roots: [
123
- `${cwd}`
124
- ],
125
- modulePaths: [
126
- `${cwd}/src/`
127
- ],
128
- moduleDirectories: [
129
- "node_modules"
130
- ],
131
- testMatch: [
132
- "<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"
133
- ],
134
- coverageDirectory: `${cwd}/coverage`,
135
- collectCoverageFrom: [
136
- "<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"
137
- ],
138
- transform: {
139
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
140
- jsc: {
141
- transform: {
142
- react: {
143
- runtime: "automatic"
144
- }
145
- }
146
- }
147
- }]
148
- },
149
- modulePathIgnorePatterns: [
150
- "<rootDir>/build/"
151
- ],
152
- transformIgnorePatterns: ["node_modules/(?!swiper)/"]
153
- };
154
- return config;
53
+ const cwd = process.cwd();
54
+ const config = {
55
+ ...baseConfig,
56
+ rootDir: ".",
57
+ roots: [`${cwd}`],
58
+ modulePaths: [`${cwd}/src/`],
59
+ moduleDirectories: ["node_modules"],
60
+ testMatch: ["<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"],
61
+ coverageDirectory: `${cwd}/coverage`,
62
+ collectCoverageFrom: ["<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"],
63
+ transform: { "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", { jsc: { transform: { react: { runtime: "automatic" } } } }] },
64
+ modulePathIgnorePatterns: ["<rootDir>/build/"],
65
+ transformIgnorePatterns: ["node_modules/(?!swiper)/"]
66
+ };
67
+ return config;
155
68
  }
156
69
  function getPayloadConfig() {
157
- const cwd = process.cwd();
158
- const config = {
159
- ...baseConfig,
160
- // testEnvironment: '<rootDir>/jest.environment.ts',
161
- testEnvironment: "node",
162
- testTimeout: 2e4,
163
- verbose: true,
164
- silent: true,
165
- rootDir: ".",
166
- roots: [
167
- `${cwd}`
168
- ],
169
- modulePaths: [
170
- `${cwd}/src/`
171
- ],
172
- moduleDirectories: [
173
- "node_modules"
174
- ],
175
- testMatch: [
176
- "<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"
177
- ],
178
- coverageDirectory: `${cwd}/coverage`,
179
- collectCoverageFrom: [
180
- "<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"
181
- ],
182
- reporters: ["default", "github-actions"],
183
- coverageReporters: ["html", "text", "text-summary", "lcov"],
184
- transform: {
185
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
186
- jsc: {
187
- transform: {
188
- react: {
189
- runtime: "automatic"
190
- }
191
- }
192
- }
193
- }]
194
- },
195
- modulePathIgnorePatterns: [
196
- "<rootDir>/build/"
197
- ],
198
- transformIgnorePatterns: ["node_modules/(?!swiper)/"],
199
- moduleNameMapper: {
200
- // Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451
201
- "uuid": __require.resolve("uuid"),
202
- "\\.(css|scss)$": "identity-obj-proxy",
203
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/jest.mock.file.js"
204
- }
205
- };
206
- return config;
70
+ const cwd = process.cwd();
71
+ const config = {
72
+ ...baseConfig,
73
+ testEnvironment: "node",
74
+ testTimeout: 2e4,
75
+ verbose: true,
76
+ silent: true,
77
+ rootDir: ".",
78
+ roots: [`${cwd}`],
79
+ modulePaths: [`${cwd}/src/`],
80
+ moduleDirectories: ["node_modules"],
81
+ testMatch: ["<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"],
82
+ coverageDirectory: `${cwd}/coverage`,
83
+ collectCoverageFrom: ["<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"],
84
+ reporters: ["default", "github-actions"],
85
+ coverageReporters: [
86
+ "html",
87
+ "text",
88
+ "text-summary",
89
+ "lcov"
90
+ ],
91
+ transform: { "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", { jsc: { transform: { react: { runtime: "automatic" } } } }] },
92
+ modulePathIgnorePatterns: ["<rootDir>/build/"],
93
+ transformIgnorePatterns: ["node_modules/(?!swiper)/"],
94
+ moduleNameMapper: {
95
+ "uuid": __require.resolve("uuid"),
96
+ "\\.(css|scss)$": "identity-obj-proxy",
97
+ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/jest.mock.file.js"
98
+ }
99
+ };
100
+ return config;
207
101
  }
208
- export {
209
- baseConfig,
210
- getAppConfig,
211
- getPackageConfig,
212
- getPayloadConfig,
213
- getProjectConfig
214
- };
102
+
103
+ //#endregion
104
+ export { baseConfig, getAppConfig, getPackageConfig, getPayloadConfig, getProjectConfig };
105
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["baseConfig: Config","config: Config"],"sources":["../src/index.ts"],"sourcesContent":["import { Config } from 'jest';\r\nimport nextJest from 'next/jest';\r\n\r\n// !!! todo add ts-jest\r\n\r\nconst createJestConfig = nextJest({\r\n // Provide the path to your Next.js app to load next.config.js and .env files in your test environment\r\n dir: './',\r\n});\r\n\r\nexport const baseConfig: Config = {\r\n verbose: false,\r\n silent: false,\r\n testTimeout: process.env.CI ? 20000 : 10000,\r\n // testEnvironment: 'jsdom',\r\n testEnvironment: 'jest-environment-jsdom',\r\n // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],\r\n reporters: ['default', 'github-actions'],\r\n /*\r\n snapshotFormat: {\r\n printBasicPrototype: false,\r\n },\r\n */\r\n /*\r\n coverageThreshold: {\r\n global: {\r\n branches: 80,\r\n functions: 80,\r\n lines: 80,\r\n statements: 80,\r\n }\r\n },\r\n */\r\n coverageReporters: ['html', 'text', 'text-summary', 'lcov'],\r\n};\r\n\r\nexport function getProjectConfig(): {} {\r\n const cwd = process.cwd();\r\n // console.log('getProjectConfig', 'process.cwd()', cwd);\r\n const config: Config = {\r\n ...baseConfig,\r\n rootDir: '.',\r\n roots: [\r\n `${cwd}`,\r\n ],\r\n resetMocks: true,\r\n modulePaths: [\r\n `${cwd}/src/`,\r\n ],\r\n moduleDirectories: [\r\n 'node_modules',\r\n ],\r\n testMatch: [\r\n '<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}',\r\n ],\r\n coverageDirectory: `${cwd}/coverage`,\r\n collectCoverageFrom: [\r\n '<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}',\r\n ],\r\n setupFilesAfterEnv: [`${cwd}/jest.setup.js`],\r\n transform: {\r\n '^.+\\\\.(js|jsx|ts|tsx)?$': ['@swc/jest', {\r\n jsc: {\r\n transform: {\r\n react: {\r\n runtime: 'automatic',\r\n },\r\n },\r\n },\r\n }],\r\n },\r\n // Rewrite Swiper ESM imports as paths (allows them to be transformed w/o errors)\r\n moduleNameMapper: {\r\n '\\\\.(css|scss)$': 'identity-obj-proxy',\r\n '\\\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/src/packages/test/jest.mock.file.js',\r\n // swiper\r\n 'swiper': '<rootDir>/node_modules/swiper/swiper-bundle.js',\r\n 'swiper/react': '<rootDir>/node_modules/swiper/react/swiper-react.js',\r\n // 'swiper/css': '<rootDir>/node_modules/swiper/swiper.min.css',\r\n // 'swiper/css/bundle': '<rootDir>/node_modules/swiper/swiper-bundle.min.css',\r\n // 'swiper/css/autoplay': '<rootDir>/node_modules/swiper/modules/autoplay/autoplay.min.css',\r\n // 'swiper/css/free-mode': '<rootDir>/node_modules/swiper/modules/autoplay/free-mode.min.css',\r\n // 'swiper/css/navigation': '<rootDir>/node_modules/swiper/modules/autoplay/navigation.min.css',\r\n // 'swiper/css/pagination': '<rootDir>/node_modules/swiper/modules/autoplay/pagination.min.css',\r\n // Handle module aliases (this will be automatically configured for you soon)\r\n // '^@/components/(.*)$': '<rootDir>/components/$1',\r\n // '^@/pages/(.*)$': '<rootDir>/pages/$1',\r\n },\r\n modulePathIgnorePatterns: [\r\n '<rootDir>/build/',\r\n '<rootDir>/.next/',\r\n ],\r\n transformIgnorePatterns: [\r\n 'node_modules',\r\n 'node_modules/(?!(swiper|swiper/react|ssr-window|dom7)/)',\r\n ],\r\n };\r\n return config;\r\n}\r\n\r\nexport function getAppConfig(): {} {\r\n const config: Config = getProjectConfig();\r\n config.transform = {\r\n '^.+\\\\.(js|jsx|ts|tsx)?$': ['@swc/jest', {\r\n jsc: {\r\n transform: {\r\n react: {\r\n runtime: 'automatic',\r\n },\r\n },\r\n },\r\n tsconfig: 'tsconfig.test.json',\r\n }],\r\n };\r\n return createJestConfig(config);\r\n}\r\n\r\nexport function getPackageConfig(): {} {\r\n const cwd = process.cwd();\r\n // console.log('getPackageConfig', 'process.cwd()', cwd);\r\n const config: Config = {\r\n ...baseConfig,\r\n rootDir: '.',\r\n roots: [\r\n `${cwd}`,\r\n ],\r\n modulePaths: [\r\n `${cwd}/src/`,\r\n ],\r\n moduleDirectories: [\r\n 'node_modules',\r\n ],\r\n testMatch: [\r\n '<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}',\r\n ],\r\n coverageDirectory: `${cwd}/coverage`,\r\n collectCoverageFrom: [\r\n '<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}',\r\n ],\r\n transform: {\r\n '^.+\\\\.(js|jsx|ts|tsx)?$': ['@swc/jest', {\r\n jsc: {\r\n transform: {\r\n react: {\r\n runtime: 'automatic',\r\n },\r\n },\r\n },\r\n }],\r\n },\r\n modulePathIgnorePatterns: [\r\n '<rootDir>/build/',\r\n ],\r\n transformIgnorePatterns: ['node_modules/(?!swiper)/'],\r\n };\r\n // console.log('getPackageConfig', config);\r\n return config;\r\n}\r\n\r\nexport function getPayloadConfig(): {} {\r\n const cwd = process.cwd();\r\n // console.log('getPayloadConfig', 'process.cwd()', cwd);\r\n const config: Config = {\r\n ...baseConfig,\r\n // testEnvironment: '<rootDir>/jest.environment.ts',\r\n testEnvironment: 'node',\r\n testTimeout: 20000,\r\n verbose: true,\r\n silent: true,\r\n rootDir: '.',\r\n roots: [\r\n `${cwd}`,\r\n ],\r\n modulePaths: [\r\n `${cwd}/src/`,\r\n ],\r\n moduleDirectories: [\r\n 'node_modules',\r\n ],\r\n testMatch: [\r\n '<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}',\r\n ],\r\n coverageDirectory: `${cwd}/coverage`,\r\n collectCoverageFrom: [\r\n '<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}',\r\n ],\r\n reporters: ['default', 'github-actions'],\r\n coverageReporters: ['html', 'text', 'text-summary', 'lcov'],\r\n transform: {\r\n '^.+\\\\.(js|jsx|ts|tsx)?$': ['@swc/jest', {\r\n jsc: {\r\n transform: {\r\n react: {\r\n runtime: 'automatic',\r\n },\r\n },\r\n },\r\n }],\r\n },\r\n modulePathIgnorePatterns: [\r\n '<rootDir>/build/',\r\n ],\r\n transformIgnorePatterns: ['node_modules/(?!swiper)/'],\r\n moduleNameMapper: {\r\n // Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451\r\n 'uuid': require.resolve('uuid'),\r\n '\\\\.(css|scss)$': 'identity-obj-proxy',\r\n '\\\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/jest.mock.file.js',\r\n },\r\n };\r\n // console.log('getPackageConfig', config);\r\n return config;\r\n}\r\n"],"mappings":";;;;AAKA,MAAM,mBAAmB,SAAS,EAEhC,KAAK,KACN,EAAC;AAEF,MAAaA,aAAqB;CAChC,SAAS;CACT,QAAQ;CACR,aAAa,QAAQ,IAAI,KAAK,MAAQ;CAEtC,iBAAiB;CAEjB,WAAW,CAAC,WAAW,gBAAiB;CAgBxC,mBAAmB;EAAC;EAAQ;EAAQ;EAAgB;CAAO;AAC5D;AAED,SAAgB,mBAAuB;CACrC,MAAM,MAAM,QAAQ,KAAK;CAEzB,MAAMC,SAAiB;EACrB,GAAG;EACH,SAAS;EACT,OAAO,CACL,GAAG,KAAK,AACT;EACD,YAAY;EACZ,aAAa,CACX,GAAG,IAAI,KAAK,CAAC,AACd;EACD,mBAAmB,CACjB,cACD;EACD,WAAW,CACT,iDACD;EACD,mBAAmB,GAAG,IAAI,SAAS,CAAC;EACpC,qBAAqB,CACnB,6CACD;EACD,oBAAoB,CAAC,GAAG,IAAI,cAAc,CAAC,AAAC;EAC5C,WAAW,EACT,2BAA2B,CAAC,aAAa,EACvC,KAAK,EACH,WAAW,EACT,OAAO,EACL,SAAS,YACV,EACF,EACF,EACF,CAAC,EACH;EAED,kBAAkB;GAChB,kBAAkB;GAClB,uFAAuF;GAEvF,UAAU;GACV,gBAAgB;EAUjB;EACD,0BAA0B,CACxB,oBACA,kBACD;EACD,yBAAyB,CACvB,gBACA,yDACD;CACF;AACD,QAAO;AACR;AAED,SAAgB,eAAmB;CACjC,MAAMA,SAAiB,kBAAkB;CACzC,OAAO,YAAY,EACjB,2BAA2B,CAAC,aAAa;EACvC,KAAK,EACH,WAAW,EACT,OAAO,EACL,SAAS,YACV,EACF,EACF;EACD,UAAU;CACX,CAAC,EACH;AACD,QAAO,iBAAiB,OAAO;AAChC;AAED,SAAgB,mBAAuB;CACrC,MAAM,MAAM,QAAQ,KAAK;CAEzB,MAAMA,SAAiB;EACrB,GAAG;EACH,SAAS;EACT,OAAO,CACL,GAAG,KAAK,AACT;EACD,aAAa,CACX,GAAG,IAAI,KAAK,CAAC,AACd;EACD,mBAAmB,CACjB,cACD;EACD,WAAW,CACT,iDACD;EACD,mBAAmB,GAAG,IAAI,SAAS,CAAC;EACpC,qBAAqB,CACnB,6CACD;EACD,WAAW,EACT,2BAA2B,CAAC,aAAa,EACvC,KAAK,EACH,WAAW,EACT,OAAO,EACL,SAAS,YACV,EACF,EACF,EACF,CAAC,EACH;EACD,0BAA0B,CACxB,kBACD;EACD,yBAAyB,CAAC,0BAA2B;CACtD;AAED,QAAO;AACR;AAED,SAAgB,mBAAuB;CACrC,MAAM,MAAM,QAAQ,KAAK;CAEzB,MAAMA,SAAiB;EACrB,GAAG;EAEH,iBAAiB;EACjB,aAAa;EACb,SAAS;EACT,QAAQ;EACR,SAAS;EACT,OAAO,CACL,GAAG,KAAK,AACT;EACD,aAAa,CACX,GAAG,IAAI,KAAK,CAAC,AACd;EACD,mBAAmB,CACjB,cACD;EACD,WAAW,CACT,iDACD;EACD,mBAAmB,GAAG,IAAI,SAAS,CAAC;EACpC,qBAAqB,CACnB,6CACD;EACD,WAAW,CAAC,WAAW,gBAAiB;EACxC,mBAAmB;GAAC;GAAQ;GAAQ;GAAgB;EAAO;EAC3D,WAAW,EACT,2BAA2B,CAAC,aAAa,EACvC,KAAK,EACH,WAAW,EACT,OAAO,EACL,SAAS,YACV,EACF,EACF,EACF,CAAC,EACH;EACD,0BAA0B,CACxB,kBACD;EACD,yBAAyB,CAAC,0BAA2B;EACrD,kBAAkB;GAEhB,kBAAgB,QAAQ,OAAO;GAC/B,kBAAkB;GAClB,uFAAuF;EACxF;CACF;AAED,QAAO;AACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/test",
3
- "version": "3.0.1",
3
+ "version": "4.0.0-next.0",
4
4
  "description": "Test shared config of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -13,12 +13,16 @@
13
13
  },
14
14
  "scripts": {
15
15
  "lint": "eslint *.js*",
16
- "compile": "tsup ./index.ts --format esm,cjs --dts",
16
+ "compile": "tsdown",
17
17
  "prepack": "bom prepack",
18
18
  "postpack": "bom postpack",
19
19
  "types": "tsc --noemit"
20
20
  },
21
21
  "peerDependencies": {
22
+ "@payloadcms/next": "3.74.0",
23
+ "@payloadcms/richtext-lexical": "3.74.0",
24
+ "@websolutespa/bom-core": "^4.0.0-next.0",
25
+ "@websolutespa/payload-db-memory": "^3.0.2",
22
26
  "next": "16.1.6",
23
27
  "payload": "3.74.0",
24
28
  "uuid": "9.0.1"
package/dist/index.cjs DELETED
@@ -1,246 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- baseConfig: () => baseConfig,
34
- getAppConfig: () => getAppConfig,
35
- getPackageConfig: () => getPackageConfig,
36
- getPayloadConfig: () => getPayloadConfig,
37
- getProjectConfig: () => getProjectConfig
38
- });
39
- module.exports = __toCommonJS(index_exports);
40
- var import_jest = __toESM(require("next/jest"), 1);
41
- var createJestConfig = (0, import_jest.default)({
42
- // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
43
- dir: "./"
44
- });
45
- var baseConfig = {
46
- verbose: false,
47
- silent: false,
48
- testTimeout: process.env.CI ? 2e4 : 1e4,
49
- // testEnvironment: 'jsdom',
50
- testEnvironment: "jest-environment-jsdom",
51
- // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
52
- reporters: ["default", "github-actions"],
53
- /*
54
- snapshotFormat: {
55
- printBasicPrototype: false,
56
- },
57
- */
58
- /*
59
- coverageThreshold: {
60
- global: {
61
- branches: 80,
62
- functions: 80,
63
- lines: 80,
64
- statements: 80,
65
- }
66
- },
67
- */
68
- coverageReporters: ["html", "text", "text-summary", "lcov"]
69
- };
70
- function getProjectConfig() {
71
- const cwd = process.cwd();
72
- const config = {
73
- ...baseConfig,
74
- rootDir: ".",
75
- roots: [
76
- `${cwd}`
77
- ],
78
- resetMocks: true,
79
- modulePaths: [
80
- `${cwd}/src/`
81
- ],
82
- moduleDirectories: [
83
- "node_modules"
84
- ],
85
- testMatch: [
86
- "<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"
87
- ],
88
- coverageDirectory: `${cwd}/coverage`,
89
- collectCoverageFrom: [
90
- "<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"
91
- ],
92
- setupFilesAfterEnv: [`${cwd}/jest.setup.js`],
93
- transform: {
94
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
95
- jsc: {
96
- transform: {
97
- react: {
98
- runtime: "automatic"
99
- }
100
- }
101
- }
102
- }]
103
- },
104
- // Rewrite Swiper ESM imports as paths (allows them to be transformed w/o errors)
105
- moduleNameMapper: {
106
- "\\.(css|scss)$": "identity-obj-proxy",
107
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/packages/test/jest.mock.file.js",
108
- // swiper
109
- "swiper": "<rootDir>/node_modules/swiper/swiper-bundle.js",
110
- "swiper/react": "<rootDir>/node_modules/swiper/react/swiper-react.js"
111
- // 'swiper/css': '<rootDir>/node_modules/swiper/swiper.min.css',
112
- // 'swiper/css/bundle': '<rootDir>/node_modules/swiper/swiper-bundle.min.css',
113
- // 'swiper/css/autoplay': '<rootDir>/node_modules/swiper/modules/autoplay/autoplay.min.css',
114
- // 'swiper/css/free-mode': '<rootDir>/node_modules/swiper/modules/autoplay/free-mode.min.css',
115
- // 'swiper/css/navigation': '<rootDir>/node_modules/swiper/modules/autoplay/navigation.min.css',
116
- // 'swiper/css/pagination': '<rootDir>/node_modules/swiper/modules/autoplay/pagination.min.css',
117
- // Handle module aliases (this will be automatically configured for you soon)
118
- // '^@/components/(.*)$': '<rootDir>/components/$1',
119
- // '^@/pages/(.*)$': '<rootDir>/pages/$1',
120
- },
121
- modulePathIgnorePatterns: [
122
- "<rootDir>/build/",
123
- "<rootDir>/.next/"
124
- ],
125
- transformIgnorePatterns: [
126
- "node_modules",
127
- "node_modules/(?!(swiper|swiper/react|ssr-window|dom7)/)"
128
- ]
129
- };
130
- return config;
131
- }
132
- function getAppConfig() {
133
- const config = getProjectConfig();
134
- config.transform = {
135
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
136
- jsc: {
137
- transform: {
138
- react: {
139
- runtime: "automatic"
140
- }
141
- }
142
- },
143
- tsconfig: "tsconfig.test.json"
144
- }]
145
- };
146
- return createJestConfig(config);
147
- }
148
- function getPackageConfig() {
149
- const cwd = process.cwd();
150
- const config = {
151
- ...baseConfig,
152
- rootDir: ".",
153
- roots: [
154
- `${cwd}`
155
- ],
156
- modulePaths: [
157
- `${cwd}/src/`
158
- ],
159
- moduleDirectories: [
160
- "node_modules"
161
- ],
162
- testMatch: [
163
- "<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"
164
- ],
165
- coverageDirectory: `${cwd}/coverage`,
166
- collectCoverageFrom: [
167
- "<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"
168
- ],
169
- transform: {
170
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
171
- jsc: {
172
- transform: {
173
- react: {
174
- runtime: "automatic"
175
- }
176
- }
177
- }
178
- }]
179
- },
180
- modulePathIgnorePatterns: [
181
- "<rootDir>/build/"
182
- ],
183
- transformIgnorePatterns: ["node_modules/(?!swiper)/"]
184
- };
185
- return config;
186
- }
187
- function getPayloadConfig() {
188
- const cwd = process.cwd();
189
- const config = {
190
- ...baseConfig,
191
- // testEnvironment: '<rootDir>/jest.environment.ts',
192
- testEnvironment: "node",
193
- testTimeout: 2e4,
194
- verbose: true,
195
- silent: true,
196
- rootDir: ".",
197
- roots: [
198
- `${cwd}`
199
- ],
200
- modulePaths: [
201
- `${cwd}/src/`
202
- ],
203
- moduleDirectories: [
204
- "node_modules"
205
- ],
206
- testMatch: [
207
- "<rootDir>/src/**/*(?<!e2e).test.{js,jsx,ts,tsx}"
208
- ],
209
- coverageDirectory: `${cwd}/coverage`,
210
- collectCoverageFrom: [
211
- "<rootDir>/src/**/*(?<!test).{js,jsx,ts,tsx}"
212
- ],
213
- reporters: ["default", "github-actions"],
214
- coverageReporters: ["html", "text", "text-summary", "lcov"],
215
- transform: {
216
- "^.+\\.(js|jsx|ts|tsx)?$": ["@swc/jest", {
217
- jsc: {
218
- transform: {
219
- react: {
220
- runtime: "automatic"
221
- }
222
- }
223
- }
224
- }]
225
- },
226
- modulePathIgnorePatterns: [
227
- "<rootDir>/build/"
228
- ],
229
- transformIgnorePatterns: ["node_modules/(?!swiper)/"],
230
- moduleNameMapper: {
231
- // Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451
232
- "uuid": require.resolve("uuid"),
233
- "\\.(css|scss)$": "identity-obj-proxy",
234
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/jest.mock.file.js"
235
- }
236
- };
237
- return config;
238
- }
239
- // Annotate the CommonJS export names for ESM import in node:
240
- 0 && (module.exports = {
241
- baseConfig,
242
- getAppConfig,
243
- getPackageConfig,
244
- getPayloadConfig,
245
- getProjectConfig
246
- });
package/dist/index.d.cts DELETED
@@ -1,9 +0,0 @@
1
- import { Config } from 'jest';
2
-
3
- declare const baseConfig: Config;
4
- declare function getProjectConfig(): {};
5
- declare function getAppConfig(): {};
6
- declare function getPackageConfig(): {};
7
- declare function getPayloadConfig(): {};
8
-
9
- export { baseConfig, getAppConfig, getPackageConfig, getPayloadConfig, getProjectConfig };