@servicetitan/startup 22.4.0 → 22.5.1
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/cli/commands/tests.d.ts.map +1 -1
- package/dist/cli/commands/tests.js +2 -35
- package/dist/cli/commands/tests.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jest/index.d.ts +2 -0
- package/dist/jest/index.d.ts.map +1 -0
- package/dist/jest/index.js +9 -0
- package/dist/jest/index.js.map +1 -0
- package/dist/utils/get-jest-config.d.ts +12 -0
- package/dist/utils/get-jest-config.d.ts.map +1 -0
- package/dist/utils/get-jest-config.js +70 -0
- package/dist/utils/get-jest-config.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +10 -10
- package/src/cli/commands/tests.ts +3 -47
- package/src/index.ts +1 -0
- package/src/jest/index.ts +5 -0
- package/src/utils/get-jest-config.ts +76 -0
- package/src/utils/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAE5B;;GAEG;AACH,qBAAa,KAAM,YAAW,OAAO;IACrB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,MAAM,CAAC,IAAI;IAG/B,OAAO;CAWhB"}
|
|
@@ -17,23 +17,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
17
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
21
|
-
var t = {};
|
|
22
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
-
t[p] = s[p];
|
|
24
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
-
t[p[i]] = s[p[i]];
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
21
|
exports.Tests = void 0;
|
|
36
|
-
const path_1 = __importDefault(require("path"));
|
|
37
22
|
const core_1 = require("@jest/core");
|
|
38
23
|
const utils_1 = require("../../utils");
|
|
39
24
|
/**
|
|
@@ -50,26 +35,8 @@ class Tests {
|
|
|
50
35
|
}
|
|
51
36
|
execute() {
|
|
52
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const
|
|
54
|
-
const { results: { success }, } = yield (0, core_1.runCLI)(
|
|
55
|
-
'^.+\\.jsx?$': [
|
|
56
|
-
'babel-jest',
|
|
57
|
-
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
58
|
-
],
|
|
59
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
60
|
-
}), transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'], moduleNameMapper: JSON.stringify({
|
|
61
|
-
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
62
|
-
}), modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'], globals: JSON.stringify({
|
|
63
|
-
'ts-jest': {
|
|
64
|
-
tsconfig: './tsconfig.test.json',
|
|
65
|
-
},
|
|
66
|
-
}), testPathIgnorePatterns: [
|
|
67
|
-
...(0, utils_1.getDestinationFolders)(),
|
|
68
|
-
...(0, utils_1.toArray)(testPathIgnorePatterns),
|
|
69
|
-
], setupFiles: [
|
|
70
|
-
path_1.default.join(__dirname, '../../../jest/setup.js'),
|
|
71
|
-
...(0, utils_1.toArray)(setupFiles),
|
|
72
|
-
] }, config), [process.cwd()]);
|
|
38
|
+
const jestConfig = (0, utils_1.getJestConfigCLI)(this.args);
|
|
39
|
+
const { results: { success }, } = yield (0, core_1.runCLI)(jestConfig, [process.cwd()]);
|
|
73
40
|
if (!success) {
|
|
74
41
|
// eslint-disable-next-line require-atomic-updates
|
|
75
42
|
process.exitCode = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.js","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tests.js","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,qCAAoC;AACpC,uCAA0D;AAG1D;;GAEG;AACH,MAAa,KAAK;IACd,YAAoB,IAAiB;;;;;mBAAjB;;IAAoB,CAAC;IAGnC,OAAO;;YACT,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,EACF,OAAO,EAAE,EAAE,OAAO,EAAE,GACvB,GAAG,MAAM,IAAA,aAAM,EAAC,UAAU,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAE9C,IAAI,CAAC,OAAO,EAAE;gBACV,kDAAkD;gBAClD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;aACxB;QACL,CAAC;KAAA;CACJ;AAXG;IADC,iBAAS;;;;oCAWT;AAdL,sBAeC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./webpack"), exports);
|
|
18
|
+
__exportStar(require("./jest"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jest/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,yCAE/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createJestConfig = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
function createJestConfig() {
|
|
6
|
+
return (0, utils_1.getJestConfig)();
|
|
7
|
+
}
|
|
8
|
+
exports.createJestConfig = createJestConfig;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/jest/index.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAEzC,SAAgB,gBAAgB;IAC5B,OAAO,IAAA,qBAAa,GAAE,CAAC;AAC3B,CAAC;AAFD,4CAEC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Config } from '@jest/types';
|
|
2
|
+
import { JestConfiguration } from '.';
|
|
3
|
+
/**
|
|
4
|
+
* Get Jest clean config for running tests. This config could be used to export Jest configuration into the
|
|
5
|
+
* Jest config files.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getJestConfig: () => JestConfiguration;
|
|
8
|
+
/**
|
|
9
|
+
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
10
|
+
*/
|
|
11
|
+
export declare const getJestConfigCLI: (args: Config.Argv) => Config.Argv;
|
|
12
|
+
//# sourceMappingURL=get-jest-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-jest-config.d.ts","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAA+C,iBAAiB,EAAW,MAAM,GAAG,CAAC;AAyC5F;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,iBAUhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAU,OAAO,IAAI,KAAG,OAAO,IAa3D,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getJestConfigCLI = exports.getJestConfig = void 0;
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const _1 = require(".");
|
|
20
|
+
const getJestConfigBase = (stringify, testPathIgnorePatterns = [], setupFiles = []) => {
|
|
21
|
+
const transform = {
|
|
22
|
+
'^.+\\.jsx?$': [
|
|
23
|
+
'babel-jest',
|
|
24
|
+
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
25
|
+
],
|
|
26
|
+
'^.+\\.tsx?$': 'ts-jest',
|
|
27
|
+
};
|
|
28
|
+
const moduleNameMapper = {
|
|
29
|
+
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
30
|
+
};
|
|
31
|
+
const globals = {
|
|
32
|
+
'ts-jest': {
|
|
33
|
+
tsconfig: './tsconfig.test.json',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
verbose: true,
|
|
38
|
+
testEnvironment: 'jsdom',
|
|
39
|
+
testRunner: 'jest-circus/runner',
|
|
40
|
+
transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'],
|
|
41
|
+
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
42
|
+
transform: stringify ? JSON.stringify(transform) : transform,
|
|
43
|
+
moduleNameMapper: stringify ? JSON.stringify(moduleNameMapper) : moduleNameMapper,
|
|
44
|
+
globals: stringify ? JSON.stringify(globals) : globals,
|
|
45
|
+
testPathIgnorePatterns: [
|
|
46
|
+
'\\.yalc',
|
|
47
|
+
...(0, _1.getDestinationFolders)(),
|
|
48
|
+
...(0, _1.toArray)(testPathIgnorePatterns),
|
|
49
|
+
],
|
|
50
|
+
setupFiles: [path_1.default.join(__dirname, '../../jest/setup.js'), ...(0, _1.toArray)(setupFiles)],
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Get Jest clean config for running tests. This config could be used to export Jest configuration into the
|
|
55
|
+
* Jest config files.
|
|
56
|
+
*/
|
|
57
|
+
const getJestConfig = () => {
|
|
58
|
+
const _a = Object.assign({}, (0, _1.getJestConfiguration)()), { testPathIgnorePatterns = [], setupFiles = [] } = _a, config = __rest(_a, ["testPathIgnorePatterns", "setupFiles"]);
|
|
59
|
+
return Object.assign(Object.assign({}, getJestConfigBase(false, testPathIgnorePatterns, setupFiles)), config);
|
|
60
|
+
};
|
|
61
|
+
exports.getJestConfig = getJestConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
64
|
+
*/
|
|
65
|
+
const getJestConfigCLI = (args) => {
|
|
66
|
+
const _a = Object.assign(Object.assign({}, (0, _1.getJestConfiguration)()), args), { testPathIgnorePatterns = [], setupFiles = [] } = _a, config = __rest(_a, ["testPathIgnorePatterns", "setupFiles"]);
|
|
67
|
+
return Object.assign(Object.assign({}, getJestConfigBase(true, testPathIgnorePatterns, setupFiles)), config);
|
|
68
|
+
};
|
|
69
|
+
exports.getJestConfigCLI = getJestConfigCLI;
|
|
70
|
+
//# sourceMappingURL=get-jest-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-jest-config.js","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wBAA4F;AAE5F,MAAM,iBAAiB,GAAG,CACtB,SAAkB,EAClB,yBAAmC,EAAE,EACrC,aAAuB,EAAE,EACC,EAAE;IAC5B,MAAM,SAAS,GAAG;QACd,aAAa,EAAE;YACX,YAAY;YACZ,EAAE,OAAO,EAAE,CAAC,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE;SACzE;QACD,aAAa,EAAE,SAAS;KAC3B,CAAC;IACF,MAAM,gBAAgB,GAAG;QACrB,yBAAyB,EAAE,oBAAoB;KAClD,CAAC;IACF,MAAM,OAAO,GAAG;QACZ,SAAS,EAAE;YACP,QAAQ,EAAE,sBAAsB;SACnC;KACJ,CAAC;IAEF,OAAO;QACH,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,OAAO;QACxB,UAAU,EAAE,oBAAoB;QAChC,uBAAuB,EAAE,CAAC,iCAAiC,CAAC;QAC5D,wBAAwB,EAAE,CAAC,wBAAwB,CAAC;QACpD,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;QAC5D,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB;QACjF,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;QACtD,sBAAsB,EAAE;YACpB,SAAS;YACT,GAAG,IAAA,wBAAqB,GAAE;YAC1B,GAAG,IAAA,UAAO,EAAC,sBAAsB,CAAC;SACrC;QACD,UAAU,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,EAAE,GAAG,IAAA,UAAO,EAAC,UAAU,CAAC,CAAC;KACpF,CAAC;AACN,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,aAAa,GAAG,GAAsB,EAAE;IACjD,MAAM,uBAIG,IAAA,uBAAoB,GAAE,CAAE,EAJ3B,EACF,sBAAsB,GAAG,EAAE,EAC3B,UAAU,GAAG,EAAE,OAEc,EAD1B,MAAM,cAHP,wCAIL,CAAgC,CAAC;IAClC,uCACO,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,EAAE,UAAU,CAAC,GAC5D,MAAM,EACX;AACN,CAAC,CAAC;AAVW,QAAA,aAAa,iBAUxB;AAEF;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAiB,EAAe,EAAE;IAC/D,MAAM,qCAKC,IAAA,uBAAoB,GAAE,GACtB,IAAI,CACV,EAPK,EACF,sBAAsB,GAAG,EAAE,EAC3B,UAAU,GAAG,EAAE,OAKlB,EAJM,MAAM,cAHP,wCAIL,CAGA,CAAC;IACF,uCACO,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,EAAE,UAAU,CAAC,GAC3D,MAAM,EACX;AACN,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -24,4 +24,5 @@ __exportStar(require("./log"), exports);
|
|
|
24
24
|
__exportStar(require("./read-json"), exports);
|
|
25
25
|
__exportStar(require("./to-array"), exports);
|
|
26
26
|
__exportStar(require("./load-shared-dependencies"), exports);
|
|
27
|
+
__exportStar(require("./get-jest-config"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,4DAA0C;AAC1C,gDAA8B;AAC9B,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,wCAAsB;AACtB,8CAA4B;AAC5B,6CAA2B;AAC3B,6DAA2C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,4DAA0C;AAC1C,gDAA8B;AAC9B,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,wCAAsB;AACtB,8CAA4B;AAC5B,6CAA2B;AAC3B,6DAA2C;AAC3C,oDAAkC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.5.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"bin": "./bin/index.js",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/cpx": "~1.5.2",
|
|
25
|
-
"@types/eslint": "~8.21.
|
|
25
|
+
"@types/eslint": "~8.21.2",
|
|
26
26
|
"@types/less": "~3.0.3",
|
|
27
27
|
"@types/mini-css-extract-plugin": "~2.4.0",
|
|
28
28
|
"@types/moment-locales-webpack-plugin": "~1.2.2",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"@jest/core": "~27.5.1",
|
|
37
37
|
"@jest/types": "~27.5.1",
|
|
38
38
|
"@lerna/exec": "~5.6.2",
|
|
39
|
-
"@servicetitan/eslint-config": "22.
|
|
40
|
-
"@servicetitan/stylelint-config": "22.
|
|
39
|
+
"@servicetitan/eslint-config": "22.5.1",
|
|
40
|
+
"@servicetitan/stylelint-config": "22.5.1",
|
|
41
41
|
"@types/jest": "~27.4.0",
|
|
42
42
|
"chalk": "~4.1.2",
|
|
43
43
|
"chokidar": "~3.5.3",
|
|
44
44
|
"cpx": "~1.5.0",
|
|
45
45
|
"css-loader": "~6.7.3",
|
|
46
|
-
"deepmerge": "~4.3.
|
|
46
|
+
"deepmerge": "~4.3.1",
|
|
47
47
|
"esbuild-loader": "~2.21.0",
|
|
48
|
-
"eslint": "~8.
|
|
48
|
+
"eslint": "~8.36.0",
|
|
49
49
|
"execa": "~5.1.1",
|
|
50
50
|
"fork-ts-checker-webpack-plugin": "~7.3.0",
|
|
51
51
|
"glob": "~7.2.0",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
64
64
|
"portfinder": "~1.0.28",
|
|
65
65
|
"prettier": "~2.7.1",
|
|
66
|
-
"sass": "~1.
|
|
66
|
+
"sass": "~1.59.3",
|
|
67
67
|
"sass-loader": "~12.6.0",
|
|
68
68
|
"source-map-loader": "~3.0.1",
|
|
69
|
-
"style-loader": "~3.3.
|
|
69
|
+
"style-loader": "~3.3.2",
|
|
70
70
|
"stylelint": "~14.16.1",
|
|
71
71
|
"ts-jest": "~27.1.4",
|
|
72
72
|
"ts-loader": "~9.3.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"typed-css-modules": "~0.7.2",
|
|
75
75
|
"typescript": "~4.7.4",
|
|
76
76
|
"username": "~5.1.0",
|
|
77
|
-
"webpack": "~5.
|
|
77
|
+
"webpack": "~5.76.1",
|
|
78
78
|
"webpack-assets-manifest": "~5.1.0",
|
|
79
79
|
"webpack-bundle-analyzer": "^4.8.0",
|
|
80
80
|
"webpack-dev-server": "~3.11.2",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"cli": {
|
|
92
92
|
"webpack": false
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "894362b4e192f3b7604b68ffe5221c4d4dd98af0"
|
|
95
95
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
1
|
import { Config } from '@jest/types';
|
|
4
2
|
import { runCLI } from '@jest/core';
|
|
5
|
-
|
|
6
|
-
import { getDestinationFolders, getJestConfiguration, logErrors, toArray } from '../../utils';
|
|
3
|
+
import { getJestConfigCLI, logErrors } from '../../utils';
|
|
7
4
|
import { Command } from '.';
|
|
8
5
|
|
|
9
6
|
/**
|
|
@@ -14,51 +11,10 @@ export class Tests implements Command {
|
|
|
14
11
|
|
|
15
12
|
@logErrors
|
|
16
13
|
async execute() {
|
|
17
|
-
const
|
|
18
|
-
testPathIgnorePatterns = [],
|
|
19
|
-
setupFiles = [],
|
|
20
|
-
...config
|
|
21
|
-
} = {
|
|
22
|
-
...getJestConfiguration(),
|
|
23
|
-
...this.args,
|
|
24
|
-
};
|
|
25
|
-
|
|
14
|
+
const jestConfig = getJestConfigCLI(this.args);
|
|
26
15
|
const {
|
|
27
16
|
results: { success },
|
|
28
|
-
} = await runCLI(
|
|
29
|
-
{
|
|
30
|
-
verbose: true,
|
|
31
|
-
testEnvironment: 'jsdom',
|
|
32
|
-
testRunner: 'jest-circus/runner',
|
|
33
|
-
transform: JSON.stringify({
|
|
34
|
-
'^.+\\.jsx?$': [
|
|
35
|
-
'babel-jest',
|
|
36
|
-
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
37
|
-
],
|
|
38
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
39
|
-
}),
|
|
40
|
-
transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'],
|
|
41
|
-
moduleNameMapper: JSON.stringify({
|
|
42
|
-
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
43
|
-
}),
|
|
44
|
-
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
45
|
-
globals: JSON.stringify({
|
|
46
|
-
'ts-jest': {
|
|
47
|
-
tsconfig: './tsconfig.test.json',
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
testPathIgnorePatterns: [
|
|
51
|
-
...getDestinationFolders(),
|
|
52
|
-
...toArray(testPathIgnorePatterns),
|
|
53
|
-
],
|
|
54
|
-
setupFiles: [
|
|
55
|
-
path.join(__dirname, '../../../jest/setup.js'),
|
|
56
|
-
...toArray(setupFiles),
|
|
57
|
-
],
|
|
58
|
-
...config,
|
|
59
|
-
},
|
|
60
|
-
[process.cwd()]
|
|
61
|
-
);
|
|
17
|
+
} = await runCLI(jestConfig, [process.cwd()]);
|
|
62
18
|
|
|
63
19
|
if (!success) {
|
|
64
20
|
// eslint-disable-next-line require-atomic-updates
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { Config } from '@jest/types';
|
|
3
|
+
import { getDestinationFolders, getJestConfiguration, JestConfiguration, toArray } from '.';
|
|
4
|
+
|
|
5
|
+
const getJestConfigBase = (
|
|
6
|
+
stringify: boolean,
|
|
7
|
+
testPathIgnorePatterns: string[] = [],
|
|
8
|
+
setupFiles: string[] = []
|
|
9
|
+
): Partial<JestConfiguration> => {
|
|
10
|
+
const transform = {
|
|
11
|
+
'^.+\\.jsx?$': [
|
|
12
|
+
'babel-jest',
|
|
13
|
+
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
14
|
+
],
|
|
15
|
+
'^.+\\.tsx?$': 'ts-jest',
|
|
16
|
+
};
|
|
17
|
+
const moduleNameMapper = {
|
|
18
|
+
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
19
|
+
};
|
|
20
|
+
const globals = {
|
|
21
|
+
'ts-jest': {
|
|
22
|
+
tsconfig: './tsconfig.test.json',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
verbose: true,
|
|
28
|
+
testEnvironment: 'jsdom',
|
|
29
|
+
testRunner: 'jest-circus/runner',
|
|
30
|
+
transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'],
|
|
31
|
+
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
32
|
+
transform: stringify ? JSON.stringify(transform) : transform,
|
|
33
|
+
moduleNameMapper: stringify ? JSON.stringify(moduleNameMapper) : moduleNameMapper,
|
|
34
|
+
globals: stringify ? JSON.stringify(globals) : globals,
|
|
35
|
+
testPathIgnorePatterns: [
|
|
36
|
+
'\\.yalc',
|
|
37
|
+
...getDestinationFolders(),
|
|
38
|
+
...toArray(testPathIgnorePatterns),
|
|
39
|
+
],
|
|
40
|
+
setupFiles: [path.join(__dirname, '../../jest/setup.js'), ...toArray(setupFiles)],
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get Jest clean config for running tests. This config could be used to export Jest configuration into the
|
|
46
|
+
* Jest config files.
|
|
47
|
+
*/
|
|
48
|
+
export const getJestConfig = (): JestConfiguration => {
|
|
49
|
+
const {
|
|
50
|
+
testPathIgnorePatterns = [],
|
|
51
|
+
setupFiles = [],
|
|
52
|
+
...config
|
|
53
|
+
} = { ...getJestConfiguration() };
|
|
54
|
+
return {
|
|
55
|
+
...getJestConfigBase(false, testPathIgnorePatterns, setupFiles),
|
|
56
|
+
...config,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
62
|
+
*/
|
|
63
|
+
export const getJestConfigCLI = (args: Config.Argv): Config.Argv => {
|
|
64
|
+
const {
|
|
65
|
+
testPathIgnorePatterns = [],
|
|
66
|
+
setupFiles = [],
|
|
67
|
+
...config
|
|
68
|
+
} = {
|
|
69
|
+
...getJestConfiguration(),
|
|
70
|
+
...args,
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
...getJestConfigBase(true, testPathIgnorePatterns, setupFiles),
|
|
74
|
+
...config,
|
|
75
|
+
};
|
|
76
|
+
};
|
package/src/utils/index.ts
CHANGED