@ttoss/config 1.32.3 → 1.32.5
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/esm/index.js +71 -22
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +75 -21
- package/package.json +13 -12
- package/src/babel.ts +3 -25
- package/src/index.ts +6 -1
- package/src/jest.ts +28 -2
- package/tsconfig.json +9 -2
- package/src/babel.spec.ts +0 -26
- package/src/commitlint.spec.ts +0 -18
- package/src/configCreator.spec.ts +0 -36
- package/src/index.spec.ts +0 -10
- package/src/jest.spec.ts +0 -5
- package/src/lintstaged.spec.ts +0 -13
- package/src/prettier.spec.ts +0 -13
- package/src/tsup.spec.ts +0 -18
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
5
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
|
|
6
|
+
exports: {}
|
|
7
|
+
}).exports, mod), mod.exports;
|
|
8
|
+
};
|
|
3
9
|
var __export = (target2, all) => {
|
|
4
10
|
for (var name in all) __defProp(target2, name, {
|
|
5
11
|
get: all[name],
|
|
@@ -7,6 +13,48 @@ var __export = (target2, all) => {
|
|
|
7
13
|
});
|
|
8
14
|
};
|
|
9
15
|
|
|
16
|
+
// babel.config.js
|
|
17
|
+
var require_babel_config = __commonJS({
|
|
18
|
+
"babel.config.js"(exports, module) {
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
presets: [["@babel/preset-env", {
|
|
23
|
+
targets: {
|
|
24
|
+
node: "current"
|
|
25
|
+
},
|
|
26
|
+
loose: true
|
|
27
|
+
}], "@babel/preset-typescript", ["@babel/preset-react", {
|
|
28
|
+
runtime: "automatic"
|
|
29
|
+
}]],
|
|
30
|
+
plugins: [
|
|
31
|
+
/**
|
|
32
|
+
* Carlin is full ESM and jest doesn't support import.meta.url from
|
|
33
|
+
* @ttoss/cloudformation. This plugin is needed to transform import.meta.url
|
|
34
|
+
*
|
|
35
|
+
* More reference about pure ESM packages:
|
|
36
|
+
* https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
37
|
+
*/
|
|
38
|
+
"babel-plugin-transform-import-meta",
|
|
39
|
+
/**
|
|
40
|
+
* This plugin is needed to create a unique ID for each message in the
|
|
41
|
+
* translation files.
|
|
42
|
+
*/
|
|
43
|
+
["formatjs", {
|
|
44
|
+
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
45
|
+
ast: true
|
|
46
|
+
}],
|
|
47
|
+
/**
|
|
48
|
+
* Decorators are not supported in ES6, so we need to use this plugin to
|
|
49
|
+
* transpile decorators to ES5.
|
|
50
|
+
*/
|
|
51
|
+
["@babel/plugin-proposal-decorators", {
|
|
52
|
+
version: "legacy"
|
|
53
|
+
}]]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
10
58
|
// src/configCreator.ts
|
|
11
59
|
import deepmerge from "deepmerge";
|
|
12
60
|
var overwriteMerge = (_, sourceArray) => {
|
|
@@ -21,27 +69,7 @@ var configCreator = (defaultConfig8 = {}) => {
|
|
|
21
69
|
};
|
|
22
70
|
|
|
23
71
|
// src/babel.ts
|
|
24
|
-
var defaultConfig =
|
|
25
|
-
presets: [["@babel/preset-env", {
|
|
26
|
-
targets: {
|
|
27
|
-
node: "current"
|
|
28
|
-
}
|
|
29
|
-
}], "@babel/preset-typescript", ["@babel/preset-react", {
|
|
30
|
-
runtime: "automatic"
|
|
31
|
-
}]],
|
|
32
|
-
plugins: [
|
|
33
|
-
/**
|
|
34
|
-
* Carlin is full ESM and jest doesn't support import.meta.url from
|
|
35
|
-
* @ttoss/cloudformation. This plugin is needed to transform import.meta.url
|
|
36
|
-
*
|
|
37
|
-
* More reference about pure ESM packages:
|
|
38
|
-
* https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
39
|
-
*/
|
|
40
|
-
"babel-plugin-transform-import-meta", ["formatjs", {
|
|
41
|
-
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
42
|
-
ast: true
|
|
43
|
-
}]]
|
|
44
|
-
};
|
|
72
|
+
var defaultConfig = require_babel_config();
|
|
45
73
|
var babelConfig = configCreator(defaultConfig);
|
|
46
74
|
|
|
47
75
|
// src/commitlint.ts
|
|
@@ -75,6 +103,27 @@ var defaultConfig3 = {
|
|
|
75
103
|
}
|
|
76
104
|
};
|
|
77
105
|
var jestConfig = configCreator(defaultConfig3);
|
|
106
|
+
var jestRootConfig = configCreator({
|
|
107
|
+
projects: ["<rootDir>/tests"]
|
|
108
|
+
});
|
|
109
|
+
var jestE2EConfig = configCreator({
|
|
110
|
+
...defaultConfig3,
|
|
111
|
+
displayName: "E2E Tests",
|
|
112
|
+
moduleNameMapper: {
|
|
113
|
+
"src/(.*)": "<rootDir>/../../src/$1",
|
|
114
|
+
"tests/(.*)": "<rootDir>/../$1"
|
|
115
|
+
},
|
|
116
|
+
roots: ["<rootDir>"]
|
|
117
|
+
});
|
|
118
|
+
var jestUnitConfig = configCreator({
|
|
119
|
+
...defaultConfig3,
|
|
120
|
+
displayName: "Unit Tests",
|
|
121
|
+
moduleNameMapper: {
|
|
122
|
+
"src/(.*)": "<rootDir>/../../src/$1",
|
|
123
|
+
"tests/(.*)": "<rootDir>/../$1"
|
|
124
|
+
},
|
|
125
|
+
roots: ["<rootDir>"]
|
|
126
|
+
});
|
|
78
127
|
|
|
79
128
|
// src/lintstaged.ts
|
|
80
129
|
var defaultConfig4 = {
|
|
@@ -169,4 +218,4 @@ var defaultConfig7 = {
|
|
|
169
218
|
target
|
|
170
219
|
};
|
|
171
220
|
var tsupConfig = configCreator(defaultConfig7);
|
|
172
|
-
export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig_exports as typescriptConfig };
|
|
221
|
+
export { babelConfig, commitlintConfig, jestConfig, jestE2EConfig, jestRootConfig, jestUnitConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig_exports as typescriptConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,19 @@ declare const commitlintConfig: (config?: any, deepmergeConfig?: {
|
|
|
9
9
|
declare const jestConfig: (config?: any, deepmergeConfig?: {
|
|
10
10
|
arrayMerge: "append" | "overwrite";
|
|
11
11
|
} | undefined) => any;
|
|
12
|
+
declare const jestRootConfig: (config?: {
|
|
13
|
+
projects: string[];
|
|
14
|
+
}, deepmergeConfig?: {
|
|
15
|
+
arrayMerge: "append" | "overwrite";
|
|
16
|
+
} | undefined) => {
|
|
17
|
+
projects: string[];
|
|
18
|
+
};
|
|
19
|
+
declare const jestE2EConfig: (config?: any, deepmergeConfig?: {
|
|
20
|
+
arrayMerge: "append" | "overwrite";
|
|
21
|
+
} | undefined) => any;
|
|
22
|
+
declare const jestUnitConfig: (config?: any, deepmergeConfig?: {
|
|
23
|
+
arrayMerge: "append" | "overwrite";
|
|
24
|
+
} | undefined) => any;
|
|
12
25
|
|
|
13
26
|
declare const lintstagedConfig: (config?: any, deepmergeConfig?: {
|
|
14
27
|
arrayMerge: "append" | "overwrite";
|
|
@@ -42,4 +55,4 @@ declare namespace typescriptConfig {
|
|
|
42
55
|
export { typescriptConfig_target as target };
|
|
43
56
|
}
|
|
44
57
|
|
|
45
|
-
export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig };
|
|
58
|
+
export { babelConfig, commitlintConfig, jestConfig, jestE2EConfig, jestRootConfig, jestUnitConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,19 @@ declare const commitlintConfig: (config?: any, deepmergeConfig?: {
|
|
|
9
9
|
declare const jestConfig: (config?: any, deepmergeConfig?: {
|
|
10
10
|
arrayMerge: "append" | "overwrite";
|
|
11
11
|
} | undefined) => any;
|
|
12
|
+
declare const jestRootConfig: (config?: {
|
|
13
|
+
projects: string[];
|
|
14
|
+
}, deepmergeConfig?: {
|
|
15
|
+
arrayMerge: "append" | "overwrite";
|
|
16
|
+
} | undefined) => {
|
|
17
|
+
projects: string[];
|
|
18
|
+
};
|
|
19
|
+
declare const jestE2EConfig: (config?: any, deepmergeConfig?: {
|
|
20
|
+
arrayMerge: "append" | "overwrite";
|
|
21
|
+
} | undefined) => any;
|
|
22
|
+
declare const jestUnitConfig: (config?: any, deepmergeConfig?: {
|
|
23
|
+
arrayMerge: "append" | "overwrite";
|
|
24
|
+
} | undefined) => any;
|
|
12
25
|
|
|
13
26
|
declare const lintstagedConfig: (config?: any, deepmergeConfig?: {
|
|
14
27
|
arrayMerge: "append" | "overwrite";
|
|
@@ -42,4 +55,4 @@ declare namespace typescriptConfig {
|
|
|
42
55
|
export { typescriptConfig_target as target };
|
|
43
56
|
}
|
|
44
57
|
|
|
45
|
-
export { babelConfig, commitlintConfig, jestConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig };
|
|
58
|
+
export { babelConfig, commitlintConfig, jestConfig, jestE2EConfig, jestRootConfig, jestUnitConfig, lintstagedConfig, prettierConfig, syncpackConfig, tsupConfig, typescriptConfig };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
7
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
|
|
12
|
+
exports: {}
|
|
13
|
+
}).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
10
15
|
var __export = (target2, all) => {
|
|
11
16
|
for (var name in all) __defProp(target2, name, {
|
|
12
17
|
get: all[name],
|
|
@@ -35,12 +40,57 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
35
40
|
value: true
|
|
36
41
|
}), mod);
|
|
37
42
|
|
|
43
|
+
// babel.config.js
|
|
44
|
+
var require_babel_config = __commonJS({
|
|
45
|
+
"babel.config.js"(exports2, module2) {
|
|
46
|
+
"use strict";
|
|
47
|
+
|
|
48
|
+
module2.exports = {
|
|
49
|
+
presets: [["@babel/preset-env", {
|
|
50
|
+
targets: {
|
|
51
|
+
node: "current"
|
|
52
|
+
},
|
|
53
|
+
loose: true
|
|
54
|
+
}], "@babel/preset-typescript", ["@babel/preset-react", {
|
|
55
|
+
runtime: "automatic"
|
|
56
|
+
}]],
|
|
57
|
+
plugins: [
|
|
58
|
+
/**
|
|
59
|
+
* Carlin is full ESM and jest doesn't support import.meta.url from
|
|
60
|
+
* @ttoss/cloudformation. This plugin is needed to transform import.meta.url
|
|
61
|
+
*
|
|
62
|
+
* More reference about pure ESM packages:
|
|
63
|
+
* https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
64
|
+
*/
|
|
65
|
+
"babel-plugin-transform-import-meta",
|
|
66
|
+
/**
|
|
67
|
+
* This plugin is needed to create a unique ID for each message in the
|
|
68
|
+
* translation files.
|
|
69
|
+
*/
|
|
70
|
+
["formatjs", {
|
|
71
|
+
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
72
|
+
ast: true
|
|
73
|
+
}],
|
|
74
|
+
/**
|
|
75
|
+
* Decorators are not supported in ES6, so we need to use this plugin to
|
|
76
|
+
* transpile decorators to ES5.
|
|
77
|
+
*/
|
|
78
|
+
["@babel/plugin-proposal-decorators", {
|
|
79
|
+
version: "legacy"
|
|
80
|
+
}]]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
38
85
|
// src/index.ts
|
|
39
86
|
var src_exports = {};
|
|
40
87
|
__export(src_exports, {
|
|
41
88
|
babelConfig: () => babelConfig,
|
|
42
89
|
commitlintConfig: () => commitlintConfig,
|
|
43
90
|
jestConfig: () => jestConfig,
|
|
91
|
+
jestE2EConfig: () => jestE2EConfig,
|
|
92
|
+
jestRootConfig: () => jestRootConfig,
|
|
93
|
+
jestUnitConfig: () => jestUnitConfig,
|
|
44
94
|
lintstagedConfig: () => lintstagedConfig,
|
|
45
95
|
prettierConfig: () => prettierConfig,
|
|
46
96
|
syncpackConfig: () => syncpackConfig,
|
|
@@ -63,27 +113,7 @@ var configCreator = (defaultConfig8 = {}) => {
|
|
|
63
113
|
};
|
|
64
114
|
|
|
65
115
|
// src/babel.ts
|
|
66
|
-
var defaultConfig =
|
|
67
|
-
presets: [["@babel/preset-env", {
|
|
68
|
-
targets: {
|
|
69
|
-
node: "current"
|
|
70
|
-
}
|
|
71
|
-
}], "@babel/preset-typescript", ["@babel/preset-react", {
|
|
72
|
-
runtime: "automatic"
|
|
73
|
-
}]],
|
|
74
|
-
plugins: [
|
|
75
|
-
/**
|
|
76
|
-
* Carlin is full ESM and jest doesn't support import.meta.url from
|
|
77
|
-
* @ttoss/cloudformation. This plugin is needed to transform import.meta.url
|
|
78
|
-
*
|
|
79
|
-
* More reference about pure ESM packages:
|
|
80
|
-
* https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
81
|
-
*/
|
|
82
|
-
"babel-plugin-transform-import-meta", ["formatjs", {
|
|
83
|
-
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
84
|
-
ast: true
|
|
85
|
-
}]]
|
|
86
|
-
};
|
|
116
|
+
var defaultConfig = require_babel_config();
|
|
87
117
|
var babelConfig = configCreator(defaultConfig);
|
|
88
118
|
|
|
89
119
|
// src/commitlint.ts
|
|
@@ -117,6 +147,27 @@ var defaultConfig3 = {
|
|
|
117
147
|
}
|
|
118
148
|
};
|
|
119
149
|
var jestConfig = configCreator(defaultConfig3);
|
|
150
|
+
var jestRootConfig = configCreator({
|
|
151
|
+
projects: ["<rootDir>/tests"]
|
|
152
|
+
});
|
|
153
|
+
var jestE2EConfig = configCreator({
|
|
154
|
+
...defaultConfig3,
|
|
155
|
+
displayName: "E2E Tests",
|
|
156
|
+
moduleNameMapper: {
|
|
157
|
+
"src/(.*)": "<rootDir>/../../src/$1",
|
|
158
|
+
"tests/(.*)": "<rootDir>/../$1"
|
|
159
|
+
},
|
|
160
|
+
roots: ["<rootDir>"]
|
|
161
|
+
});
|
|
162
|
+
var jestUnitConfig = configCreator({
|
|
163
|
+
...defaultConfig3,
|
|
164
|
+
displayName: "Unit Tests",
|
|
165
|
+
moduleNameMapper: {
|
|
166
|
+
"src/(.*)": "<rootDir>/../../src/$1",
|
|
167
|
+
"tests/(.*)": "<rootDir>/../$1"
|
|
168
|
+
},
|
|
169
|
+
roots: ["<rootDir>"]
|
|
170
|
+
});
|
|
120
171
|
|
|
121
172
|
// src/lintstaged.ts
|
|
122
173
|
var defaultConfig4 = {
|
|
@@ -216,6 +267,9 @@ var tsupConfig = configCreator(defaultConfig7);
|
|
|
216
267
|
babelConfig,
|
|
217
268
|
commitlintConfig,
|
|
218
269
|
jestConfig,
|
|
270
|
+
jestE2EConfig,
|
|
271
|
+
jestRootConfig,
|
|
272
|
+
jestUnitConfig,
|
|
219
273
|
lintstagedConfig,
|
|
220
274
|
prettierConfig,
|
|
221
275
|
syncpackConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/config",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.5",
|
|
4
4
|
"description": "Default configuration for packages.",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -22,13 +22,14 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"typings": "dist/index.d.ts",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@babel/core": "^7.
|
|
26
|
-
"@babel/
|
|
27
|
-
"@babel/preset-
|
|
28
|
-
"@babel/preset-
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"
|
|
25
|
+
"@babel/core": "^7.24.7",
|
|
26
|
+
"@babel/plugin-proposal-decorators": "^7.24.7",
|
|
27
|
+
"@babel/preset-env": "^7.24.7",
|
|
28
|
+
"@babel/preset-react": "^7.24.7",
|
|
29
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
30
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
31
|
+
"@formatjs/ts-transformer": "^3.13.14",
|
|
32
|
+
"babel-plugin-formatjs": "^10.5.16",
|
|
32
33
|
"babel-plugin-transform-import-meta": "^2.2.1",
|
|
33
34
|
"deepmerge": "^4.3.1",
|
|
34
35
|
"identity-obj-proxy": "^3.0.0",
|
|
@@ -37,10 +38,10 @@
|
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@jest/types": "^29.6.3",
|
|
39
40
|
"@types/jest": "^29.5.12",
|
|
40
|
-
"@types/node": "^20.
|
|
41
|
-
"esbuild": "^0.
|
|
41
|
+
"@types/node": "^20.14.2",
|
|
42
|
+
"esbuild": "^0.21.4",
|
|
42
43
|
"jest": "^29.7.0",
|
|
43
|
-
"tsup": "^8.0
|
|
44
|
+
"tsup": "^8.1.0"
|
|
44
45
|
},
|
|
45
46
|
"keywords": [],
|
|
46
47
|
"publishConfig": {
|
|
@@ -49,6 +50,6 @@
|
|
|
49
50
|
},
|
|
50
51
|
"scripts": {
|
|
51
52
|
"build:config": "tsup-node",
|
|
52
|
-
"test": "jest"
|
|
53
|
+
"test": "jest --projects tests/unit"
|
|
53
54
|
}
|
|
54
55
|
}
|
package/src/babel.ts
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
import { configCreator } from './configCreator';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
3
|
+
const defaultConfig = require('../babel.config.js');
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
export const defaultConfig: any = {
|
|
5
|
-
presets: [
|
|
6
|
-
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
7
|
-
'@babel/preset-typescript',
|
|
8
|
-
['@babel/preset-react', { runtime: 'automatic' }],
|
|
9
|
-
],
|
|
10
|
-
plugins: [
|
|
11
|
-
/**
|
|
12
|
-
* Carlin is full ESM and jest doesn't support import.meta.url from
|
|
13
|
-
* @ttoss/cloudformation. This plugin is needed to transform import.meta.url
|
|
14
|
-
*
|
|
15
|
-
* More reference about pure ESM packages:
|
|
16
|
-
* https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
17
|
-
*/
|
|
18
|
-
'babel-plugin-transform-import-meta',
|
|
19
|
-
[
|
|
20
|
-
'formatjs',
|
|
21
|
-
{
|
|
22
|
-
idInterpolationPattern: '[sha512:contenthash:base64:6]',
|
|
23
|
-
ast: true,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
],
|
|
27
|
-
};
|
|
5
|
+
export { defaultConfig };
|
|
28
6
|
|
|
29
7
|
export const babelConfig = configCreator(defaultConfig);
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { babelConfig } from './babel';
|
|
2
2
|
export { commitlintConfig } from './commitlint';
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
jestConfig,
|
|
5
|
+
jestE2EConfig,
|
|
6
|
+
jestRootConfig,
|
|
7
|
+
jestUnitConfig,
|
|
8
|
+
} from './jest';
|
|
4
9
|
export { lintstagedConfig } from './lintstaged';
|
|
5
10
|
export { prettierConfig } from './prettier';
|
|
6
11
|
export { syncpackConfig } from './syncpack';
|
package/src/jest.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { configCreator } from './configCreator';
|
|
2
|
-
|
|
2
|
+
import type { Config } from 'jest';
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
6
6
|
* https://jestjs.io/docs/configuration
|
|
7
7
|
*/
|
|
8
|
-
export const defaultConfig = {
|
|
8
|
+
export const defaultConfig: Config = {
|
|
9
9
|
clearMocks: true,
|
|
10
10
|
collectCoverage: true,
|
|
11
11
|
coverageDirectory: 'coverage',
|
|
@@ -31,3 +31,29 @@ export const defaultConfig = {
|
|
|
31
31
|
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
33
|
export const jestConfig = configCreator<any>(defaultConfig);
|
|
34
|
+
|
|
35
|
+
export const jestRootConfig = configCreator({
|
|
36
|
+
projects: ['<rootDir>/tests'],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
export const jestE2EConfig = configCreator<any>({
|
|
41
|
+
...defaultConfig,
|
|
42
|
+
displayName: 'E2E Tests',
|
|
43
|
+
moduleNameMapper: {
|
|
44
|
+
'src/(.*)': '<rootDir>/../../src/$1',
|
|
45
|
+
'tests/(.*)': '<rootDir>/../$1',
|
|
46
|
+
},
|
|
47
|
+
roots: ['<rootDir>'],
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
export const jestUnitConfig = configCreator<any>({
|
|
52
|
+
...defaultConfig,
|
|
53
|
+
displayName: 'Unit Tests',
|
|
54
|
+
moduleNameMapper: {
|
|
55
|
+
'src/(.*)': '<rootDir>/../../src/$1',
|
|
56
|
+
'tests/(.*)': '<rootDir>/../$1',
|
|
57
|
+
},
|
|
58
|
+
roots: ['<rootDir>'],
|
|
59
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -36,6 +36,13 @@
|
|
|
36
36
|
* Set `preserveSymlinks` to `false` else change-case package and @aws-sdk/*
|
|
37
37
|
* packages will not be able to resolve their dependencies.
|
|
38
38
|
*/
|
|
39
|
-
"preserveSymlinks": false
|
|
40
|
-
|
|
39
|
+
"preserveSymlinks": false,
|
|
40
|
+
/**
|
|
41
|
+
* Set `experimentalDecorators` and `emitDecoratorMetadata` to `true` to use
|
|
42
|
+
* decorators in your application as we use with sequelize-typescript.
|
|
43
|
+
*/
|
|
44
|
+
"experimentalDecorators": true,
|
|
45
|
+
"emitDecoratorMetadata": true
|
|
46
|
+
},
|
|
47
|
+
"exclude": ["tests"]
|
|
41
48
|
}
|
package/src/babel.spec.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { babelConfig, defaultConfig } from './babel';
|
|
2
|
-
|
|
3
|
-
test('should return default config', () => {
|
|
4
|
-
expect(babelConfig()).toEqual(defaultConfig);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('should update plugin', () => {
|
|
8
|
-
expect(
|
|
9
|
-
babelConfig(
|
|
10
|
-
{ plugins: ['relay'] },
|
|
11
|
-
{
|
|
12
|
-
arrayMerge: 'overwrite',
|
|
13
|
-
}
|
|
14
|
-
)
|
|
15
|
-
).toEqual({
|
|
16
|
-
...defaultConfig,
|
|
17
|
-
plugins: ['relay'],
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('should append plugin', () => {
|
|
22
|
-
expect(babelConfig({ plugins: ['relay'] })).toEqual({
|
|
23
|
-
...defaultConfig,
|
|
24
|
-
plugins: [...defaultConfig.plugins, 'relay'],
|
|
25
|
-
});
|
|
26
|
-
});
|
package/src/commitlint.spec.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { commitlintConfig, defaultConfig } from './commitlint';
|
|
2
|
-
|
|
3
|
-
test('should return default configuration', () => {
|
|
4
|
-
expect(commitlintConfig()).toEqual(defaultConfig);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('should return default configuration with different extends', () => {
|
|
8
|
-
expect(
|
|
9
|
-
commitlintConfig(
|
|
10
|
-
{
|
|
11
|
-
extends: ['other-config'],
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
arrayMerge: 'overwrite',
|
|
15
|
-
}
|
|
16
|
-
)
|
|
17
|
-
).toEqual({ ...defaultConfig, extends: ['other-config'] });
|
|
18
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { configCreator } from './configCreator';
|
|
2
|
-
|
|
3
|
-
const defaultConfig: any = {
|
|
4
|
-
obj: { a: 1, b: 2 },
|
|
5
|
-
arr: [1, 2, 3],
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const config = configCreator(defaultConfig);
|
|
9
|
-
|
|
10
|
-
test('should append array', () => {
|
|
11
|
-
expect(config({ arr: [4, 5] })).toEqual({
|
|
12
|
-
obj: { a: 1, b: 2 },
|
|
13
|
-
arr: [1, 2, 3, 4, 5],
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('should overwrite array', () => {
|
|
18
|
-
expect(
|
|
19
|
-
config(
|
|
20
|
-
{ arr: [4, 5] },
|
|
21
|
-
{
|
|
22
|
-
arrayMerge: 'overwrite',
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
).toEqual({
|
|
26
|
-
obj: { a: 1, b: 2 },
|
|
27
|
-
arr: [4, 5],
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test('should add obj key', () => {
|
|
32
|
-
expect(config({ obj: { c: 3 } })).toEqual({
|
|
33
|
-
arr: [1, 2, 3],
|
|
34
|
-
obj: { a: 1, b: 2, c: 3 },
|
|
35
|
-
});
|
|
36
|
-
});
|
package/src/index.spec.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as allConfigs from '.';
|
|
2
|
-
|
|
3
|
-
it('configs should be exported', () => {
|
|
4
|
-
expect(allConfigs.babelConfig).toBeDefined();
|
|
5
|
-
expect(allConfigs.commitlintConfig).toBeDefined();
|
|
6
|
-
expect(allConfigs.jestConfig).toBeDefined();
|
|
7
|
-
expect(allConfigs.lintstagedConfig).toBeDefined();
|
|
8
|
-
expect(allConfigs.prettierConfig).toBeDefined();
|
|
9
|
-
expect(allConfigs.tsupConfig).toBeDefined();
|
|
10
|
-
});
|
package/src/jest.spec.ts
DELETED
package/src/lintstaged.spec.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defaultConfig, lintstagedConfig } from './lintstaged';
|
|
2
|
-
|
|
3
|
-
test('should return default configuration', () => {
|
|
4
|
-
expect(lintstagedConfig()).toEqual(defaultConfig);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('should append a config', () => {
|
|
8
|
-
expect(
|
|
9
|
-
lintstagedConfig({
|
|
10
|
-
'.js': 'eslint --fix',
|
|
11
|
-
})
|
|
12
|
-
).toEqual({ ...defaultConfig, '.js': 'eslint --fix' });
|
|
13
|
-
});
|
package/src/prettier.spec.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defaultConfig, prettierConfig } from './prettier';
|
|
2
|
-
|
|
3
|
-
test('should return default configuration', () => {
|
|
4
|
-
expect(prettierConfig()).toEqual(defaultConfig);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('should append config', () => {
|
|
8
|
-
expect(
|
|
9
|
-
prettierConfig({
|
|
10
|
-
printWidth: 100,
|
|
11
|
-
})
|
|
12
|
-
).toEqual({ ...defaultConfig, printWidth: 100 });
|
|
13
|
-
});
|
package/src/tsup.spec.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defaultConfig, tsupConfig } from './tsup';
|
|
2
|
-
|
|
3
|
-
test('should return default configuration', () => {
|
|
4
|
-
expect(tsupConfig()).toEqual(defaultConfig);
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('should return default configuration with different entrypoint', () => {
|
|
8
|
-
expect(
|
|
9
|
-
tsupConfig(
|
|
10
|
-
{
|
|
11
|
-
entryPoints: ['src/index.tsx'],
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
arrayMerge: 'overwrite',
|
|
15
|
-
}
|
|
16
|
-
)
|
|
17
|
-
).toEqual({ ...defaultConfig, entryPoints: ['src/index.tsx'] });
|
|
18
|
-
});
|