@servicetitan/startup 22.21.0 → 23.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/dist/cli/utils/compile-sass.d.ts +1 -1
- package/dist/cli/utils/compile-sass.d.ts.map +1 -1
- package/dist/cli/utils/compile-sass.js +13 -5
- package/dist/cli/utils/compile-sass.js.map +1 -1
- package/dist/cli/utils/tcm.d.ts.map +1 -1
- package/dist/cli/utils/tcm.js +14 -7
- package/dist/cli/utils/tcm.js.map +1 -1
- package/dist/utils/get-jest-config.d.ts.map +1 -1
- package/dist/utils/get-jest-config.js +18 -13
- package/dist/utils/get-jest-config.js.map +1 -1
- package/dist/webpack/utils/testing/normalize-errors.js +1 -1
- package/dist/webpack/utils/testing/normalize-errors.js.map +1 -1
- package/package.json +14 -13
- package/src/cli/utils/__tests__/tcm.test.ts +15 -6
- package/src/cli/utils/compile-sass.ts +3 -7
- package/src/cli/utils/tcm.ts +13 -11
- package/src/utils/__tests__/get-jest-config.test.ts +15 -38
- package/src/utils/get-jest-config.ts +32 -45
- package/src/webpack/loaders/expose-loader/__tests__/__snapshots__/index.test.ts.snap +14 -14
- package/src/webpack/utils/testing/normalize-errors.ts +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function compileSass(filePath: string): string
|
|
1
|
+
export declare function compileSass(filePath: string): Promise<string>;
|
|
2
2
|
//# sourceMappingURL=compile-sass.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-sass.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/compile-sass.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile-sass.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/compile-sass.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,mBAIjD"}
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
exports.compileSass = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
16
|
const path_1 = __importDefault(require("path"));
|
|
9
17
|
const sass_1 = __importDefault(require("sass"));
|
|
10
18
|
function compileSass(filePath) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const loadPaths = [path_1.default.dirname(filePath), '../../node_modules', 'node_modules'];
|
|
21
|
+
const result = yield sass_1.default.compileAsync(filePath, { loadPaths });
|
|
22
|
+
return result.css.toString();
|
|
14
23
|
});
|
|
15
|
-
return result.css.toString();
|
|
16
24
|
}
|
|
17
25
|
exports.compileSass = compileSass;
|
|
18
26
|
//# sourceMappingURL=compile-sass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-sass.js","sourceRoot":"","sources":["../../../src/cli/utils/compile-sass.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compile-sass.js","sourceRoot":"","sources":["../../../src/cli/utils/compile-sass.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,gDAAwB;AAExB,SAAsB,WAAW,CAAC,QAAgB;;QAC9C,MAAM,SAAS,GAAG,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,oBAAoB,EAAE,cAAc,CAAC,CAAC;QACjF,MAAM,MAAM,GAAG,MAAM,cAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAChE,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CAAA;AAJD,kCAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcm.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/tcm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tcm.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/tcm.ts"],"names":[],"mappings":"AA2DA,wBAAsB,GAAG,kBAIxB;AAED,wBAAsB,QAAQ,kBAE7B"}
|
package/dist/cli/utils/tcm.js
CHANGED
|
@@ -19,21 +19,28 @@ const chokidar_1 = __importDefault(require("chokidar"));
|
|
|
19
19
|
const typed_css_modules_1 = __importDefault(require("typed-css-modules"));
|
|
20
20
|
const utils_1 = require("../../utils");
|
|
21
21
|
const _1 = require(".");
|
|
22
|
+
function compile(filePath) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
if (filePath.endsWith('.less')) {
|
|
25
|
+
return (0, _1.compileLess)(filePath);
|
|
26
|
+
}
|
|
27
|
+
if (filePath.endsWith('.scss')) {
|
|
28
|
+
return (0, _1.compileSass)(filePath);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
22
32
|
function run({ watch } = {}) {
|
|
23
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
34
|
const { source } = (0, utils_1.getFolders)();
|
|
25
|
-
const filesPattern = `${source}/**/*.module.{${_1.styleExtensions.join()}}
|
|
35
|
+
const filesPattern = `${source}/**/*.module.{${_1.styleExtensions.join()}}`.replace(/\\/g, '/');
|
|
26
36
|
const creator = new typed_css_modules_1.default({
|
|
27
37
|
camelCase: true,
|
|
28
38
|
namedExports: true,
|
|
29
39
|
});
|
|
30
40
|
const writeFile = (filePath) => __awaiter(this, void 0, void 0, function* () {
|
|
31
41
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
: filePath.endsWith('.scss')
|
|
35
|
-
? (0, _1.compileSass)(filePath)
|
|
36
|
-
: undefined, !!watch);
|
|
42
|
+
const initialContents = yield compile(filePath);
|
|
43
|
+
const content = yield creator.create(filePath, initialContents, !!watch);
|
|
37
44
|
yield content.writeFile();
|
|
38
45
|
}
|
|
39
46
|
catch (error) {
|
|
@@ -46,7 +53,7 @@ function run({ watch } = {}) {
|
|
|
46
53
|
}
|
|
47
54
|
else {
|
|
48
55
|
utils_1.log.info('Watch ' + filesPattern + '...');
|
|
49
|
-
const watcher = chokidar_1.default.watch([filesPattern
|
|
56
|
+
const watcher = chokidar_1.default.watch([filesPattern], { ignoreInitial: true });
|
|
50
57
|
watcher.on('add', writeFile);
|
|
51
58
|
watcher.on('change', writeFile);
|
|
52
59
|
if (process.env.NODE_ENV !== 'test') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcm.js","sourceRoot":"","sources":["../../../src/cli/utils/tcm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,gDAAwB;AACxB,wDAAgC;AAEhC,0EAA2C;AAE3C,uCAA8C;AAC9C,wBAA8D;AAM9D,SAAe,GAAG,CAAC,EAAE,KAAK,KAAiB,EAAE;;QACzC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;QAEhC,MAAM,YAAY,GAAG,GAAG,MAAM,iBAAiB,kBAAe,CAAC,IAAI,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"tcm.js","sourceRoot":"","sources":["../../../src/cli/utils/tcm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,gDAAwB;AACxB,wDAAgC;AAEhC,0EAA2C;AAE3C,uCAA8C;AAC9C,wBAA8D;AAM9D,SAAe,OAAO,CAAC,QAAgB;;QACnC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC5B,OAAO,IAAA,cAAW,EAAC,QAAQ,CAAC,CAAC;SAChC;QACD,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC5B,OAAO,IAAA,cAAW,EAAC,QAAQ,CAAC,CAAC;SAChC;IACL,CAAC;CAAA;AAED,SAAe,GAAG,CAAC,EAAE,KAAK,KAAiB,EAAE;;QACzC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;QAEhC,MAAM,YAAY,GAAG,GAAG,MAAM,iBAAiB,kBAAe,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE7F,MAAM,OAAO,GAAG,IAAI,2BAAU,CAAC;YAC3B,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,IAAI;SACrB,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,CAAO,QAAgB,EAAE,EAAE;YACzC,IAAI;gBACA,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAChD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;gBACzE,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;aAC7B;YAAC,OAAO,KAAK,EAAE;gBACZ,WAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;aAC5B;QACL,CAAC,CAAA,CAAC;QAEF,IAAI,CAAC,KAAK,EAAE;YACR,MAAM,KAAK,GAAG,MAAM,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,CAAC,YAAY,CAAC,CAAC;YAEvD,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;SAC3C;aAAM;YACH,WAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC,CAAC;YAE1C,MAAM,OAAO,GAAG,kBAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;YACxE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;YAC7B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;YAEhC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;gBACjC,MAAM,IAAI,OAAO,CAAO,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;aACrC;SACJ;IACL,CAAC;CAAA;AAED,SAAsB,GAAG;;QACrB,WAAG,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;QAExE,MAAM,GAAG,EAAE,CAAC;IAChB,CAAC;CAAA;AAJD,kBAIC;AAED,SAAsB,QAAQ;;QAC1B,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/B,CAAC;CAAA;AAFD,4BAEC"}
|
|
@@ -1 +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,EAAE,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;
|
|
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,EAAE,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AA4C9E;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,iBAWhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAU,OAAO,IAAI,KAAG,OAAO,IAoB3D,CAAC"}
|
|
@@ -19,29 +19,25 @@ const path_1 = __importDefault(require("path"));
|
|
|
19
19
|
const get_configuration_1 = require("./get-configuration");
|
|
20
20
|
const get_destination_folders_1 = require("./get-destination-folders");
|
|
21
21
|
const to_array_1 = require("./to-array");
|
|
22
|
-
const getJestConfigBase = (
|
|
22
|
+
const getJestConfigBase = ({ coveragePathIgnorePatterns = [], setupFiles = [], testPathIgnorePatterns = [], }) => {
|
|
23
23
|
const transform = {
|
|
24
24
|
'^.+\\.jsx?$': [
|
|
25
25
|
'babel-jest',
|
|
26
26
|
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
27
27
|
],
|
|
28
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
28
|
+
'^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.test.json' }],
|
|
29
29
|
};
|
|
30
30
|
const moduleNameMapper = {
|
|
31
31
|
'\\.(css|scss|less|png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$': 'identity-obj-proxy',
|
|
32
32
|
};
|
|
33
|
-
const globals = Object.assign({ 'ts-jest': {
|
|
34
|
-
tsconfig: './tsconfig.test.json',
|
|
35
|
-
} }, globalsOverrides);
|
|
36
33
|
return {
|
|
37
34
|
verbose: true,
|
|
38
35
|
testEnvironment: 'jsdom',
|
|
39
36
|
testRunner: 'jest-circus/runner',
|
|
40
|
-
transformIgnorePatterns: ['node_modules/(
|
|
37
|
+
transformIgnorePatterns: ['node_modules/(?!(@servicetitan|@react-hook|nanoid)/)'],
|
|
41
38
|
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
42
|
-
transform
|
|
43
|
-
moduleNameMapper
|
|
44
|
-
globals: stringify ? JSON.stringify(globals) : globals,
|
|
39
|
+
transform,
|
|
40
|
+
moduleNameMapper,
|
|
45
41
|
testPathIgnorePatterns: [
|
|
46
42
|
'\\.yalc',
|
|
47
43
|
...(0, get_destination_folders_1.getDestinationFolders)(),
|
|
@@ -58,16 +54,25 @@ const getJestConfigBase = (stringify, testPathIgnorePatterns = [], setupFiles =
|
|
|
58
54
|
* Jest config files.
|
|
59
55
|
*/
|
|
60
56
|
const getJestConfig = () => {
|
|
61
|
-
const _a =
|
|
62
|
-
return Object.assign(Object.assign({}, getJestConfigBase(
|
|
57
|
+
const _a = (0, get_configuration_1.getJestConfiguration)(), { coveragePathIgnorePatterns, setupFiles, testPathIgnorePatterns } = _a, config = __rest(_a, ["coveragePathIgnorePatterns", "setupFiles", "testPathIgnorePatterns"]);
|
|
58
|
+
return Object.assign(Object.assign({}, getJestConfigBase({
|
|
59
|
+
coveragePathIgnorePatterns,
|
|
60
|
+
setupFiles,
|
|
61
|
+
testPathIgnorePatterns,
|
|
62
|
+
})), config);
|
|
63
63
|
};
|
|
64
64
|
exports.getJestConfig = getJestConfig;
|
|
65
65
|
/**
|
|
66
66
|
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
67
67
|
*/
|
|
68
68
|
const getJestConfigCLI = (args) => {
|
|
69
|
-
const _a = Object.assign(Object.assign({}, (0, get_configuration_1.getJestConfiguration)()), args), {
|
|
70
|
-
|
|
69
|
+
const _a = Object.assign(Object.assign({}, (0, get_configuration_1.getJestConfiguration)()), args), { coveragePathIgnorePatterns, setupFiles, testPathIgnorePatterns, globals } = _a, config = __rest(_a, ["coveragePathIgnorePatterns", "setupFiles", "testPathIgnorePatterns", "globals"]);
|
|
70
|
+
const _b = getJestConfigBase({
|
|
71
|
+
coveragePathIgnorePatterns,
|
|
72
|
+
setupFiles,
|
|
73
|
+
testPathIgnorePatterns,
|
|
74
|
+
}), { collectCoverageFrom, moduleNameMapper, transform } = _b, rest = __rest(_b, ["collectCoverageFrom", "moduleNameMapper", "transform"]);
|
|
75
|
+
return Object.assign(Object.assign({ collectCoverageFrom: JSON.stringify(collectCoverageFrom), globals: JSON.stringify(globals), moduleNameMapper: JSON.stringify(moduleNameMapper), transform: JSON.stringify(transform) }, rest), config);
|
|
71
76
|
};
|
|
72
77
|
exports.getJestConfigCLI = getJestConfigCLI;
|
|
73
78
|
//# sourceMappingURL=get-jest-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-jest-config.js","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,2DAA8E;AAC9E,uEAAkE;AAClE,yCAAqC;AAErC,MAAM,iBAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"get-jest-config.js","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,2DAA8E;AAC9E,uEAAkE;AAClE,yCAAqC;AAErC,MAAM,iBAAiB,GAAG,CAAC,EACvB,0BAA0B,GAAG,EAAE,EAC/B,UAAU,GAAG,EAAE,EACf,sBAAsB,GAAG,EAAE,GAK9B,EAAE,EAAE;IACD,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,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,sBAAsB,EAAE,CAAC;KACnE,CAAC;IACF,MAAM,gBAAgB,GAAG;QACrB,iEAAiE,EAAE,oBAAoB;KAC1F,CAAC;IAEF,OAAO;QACH,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,OAAO;QACxB,UAAU,EAAE,oBAAoB;QAChC,uBAAuB,EAAE,CAAC,sDAAsD,CAAC;QACjF,wBAAwB,EAAE,CAAC,wBAAwB,CAAC;QACpD,SAAS;QACT,gBAAgB;QAChB,sBAAsB,EAAE;YACpB,SAAS;YACT,GAAG,IAAA,+CAAqB,GAAE;YAC1B,GAAG,IAAA,kBAAO,EAAC,sBAAsB,CAAC;SACrC;QACD,UAAU,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,EAAE,GAAG,IAAA,kBAAO,EAAC,UAAU,CAAC,CAAC;QACjF,0BAA0B,EAAE,CAAC,eAAe,EAAE,GAAG,0BAA0B,CAAC;QAC5E,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;QACpE,mBAAmB,EAAE,CAAC,eAAe,CAAC;KACzC,CAAC;AACN,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,aAAa,GAAG,GAAsB,EAAE;IACjD,MAAM,KACF,IAAA,wCAAoB,GAAyB,EAD3C,EAAE,0BAA0B,EAAE,UAAU,EAAE,sBAAsB,OACrB,EAD0B,MAAM,cAA3E,sEAA6E,CAClC,CAAC;IAClD,uCACO,iBAAiB,CAAC;QACjB,0BAA0B;QAC1B,UAAU;QACV,sBAAsB;KACzB,CAAC,GACC,MAAM,EACX;AACN,CAAC,CAAC;AAXW,QAAA,aAAa,iBAWxB;AAEF;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAiB,EAAe,EAAE;IAC/D,MAAM,qCACC,IAAA,wCAAoB,GAAE,GACtB,IAAI,CACV,EAHK,EAAE,0BAA0B,EAAE,UAAU,EAAE,sBAAsB,EAAE,OAAO,OAG9E,EAHmF,MAAM,cAApF,iFAAsF,CAG3F,CAAC;IAEF,MAAM,KAAgE,iBAAiB,CAAC;QACpF,0BAA0B;QAC1B,UAAU;QACV,sBAAsB;KACzB,CAAC,EAJI,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,SAAS,OAItD,EAJ2D,IAAI,cAA3D,wDAA6D,CAIjE,CAAC;IAEH,qCACI,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,EACxD,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAChC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAClD,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IACjC,IAAI,GACJ,MAAM,EACX;AACN,CAAC,CAAC;AApBW,QAAA,gBAAgB,oBAoB3B"}
|
|
@@ -12,7 +12,7 @@ function removeCWD(str) {
|
|
|
12
12
|
return str.replace(new RegExp(cwd, 'g'), '');
|
|
13
13
|
}
|
|
14
14
|
function normalizeErrors(errors) {
|
|
15
|
-
return errors.map(error => removeCWD(error.
|
|
15
|
+
return errors.map(error => removeCWD(error.message.split('\n').slice(0, 2).join('\n')));
|
|
16
16
|
}
|
|
17
17
|
exports.normalizeErrors = normalizeErrors;
|
|
18
18
|
//# sourceMappingURL=normalize-errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-errors.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/normalize-errors.ts"],"names":[],"mappings":";;;AAEA,SAAS,SAAS,CAAC,GAAW;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;IAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAExB,IAAI,KAAK,EAAE;QACP,6CAA6C;QAC7C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;KACjC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,SAAgB,eAAe,CAAC,MAAsB;IAClD,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"normalize-errors.js","sourceRoot":"","sources":["../../../../src/webpack/utils/testing/normalize-errors.ts"],"names":[],"mappings":";;;AAEA,SAAS,SAAS,CAAC,GAAW;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;IAC3C,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAExB,IAAI,KAAK,EAAE;QACP,6CAA6C;QAC7C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;KACjC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,SAAgB,eAAe,CAAC,MAAsB;IAClD,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC;AAFD,0CAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"bin": "./bin/index.js",
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/cpx": "~1.5.2",
|
|
27
|
-
"@types/eslint": "~8.
|
|
27
|
+
"@types/eslint": "~8.56.2",
|
|
28
28
|
"@types/less": "~3.0.3",
|
|
29
29
|
"@types/mini-css-extract-plugin": "~2.4.0",
|
|
30
30
|
"@types/moment-locales-webpack-plugin": "~1.2.2",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/preset-env": "~7.22.20",
|
|
38
|
-
"@jest/core": "~
|
|
39
|
-
"@jest/types": "~
|
|
38
|
+
"@jest/core": "~29.7.0",
|
|
39
|
+
"@jest/types": "~29.6.3",
|
|
40
40
|
"@lerna/exec": "~5.6.2",
|
|
41
|
-
"@servicetitan/eslint-config": "
|
|
42
|
-
"@servicetitan/stylelint-config": "
|
|
41
|
+
"@servicetitan/eslint-config": "23.0.0",
|
|
42
|
+
"@servicetitan/stylelint-config": "23.0.0",
|
|
43
43
|
"@swc/core": "1.3.100",
|
|
44
44
|
"@types/jest": "~27.4.0",
|
|
45
45
|
"chalk": "~4.1.2",
|
|
@@ -49,20 +49,21 @@
|
|
|
49
49
|
"debug": "^4.3.4",
|
|
50
50
|
"deepmerge": "~4.3.1",
|
|
51
51
|
"esbuild-loader": "~4.0.2",
|
|
52
|
-
"eslint": "~8.
|
|
52
|
+
"eslint": "~8.56.0",
|
|
53
53
|
"execa": "~5.1.1",
|
|
54
54
|
"fork-ts-checker-webpack-plugin": "~7.3.0",
|
|
55
55
|
"glob": "~7.2.0",
|
|
56
56
|
"html-webpack-plugin": "~5.5.3",
|
|
57
57
|
"identity-obj-proxy": "~3.0.0",
|
|
58
|
-
"jest": "~
|
|
59
|
-
"jest-circus": "~
|
|
58
|
+
"jest": "~29.7.0",
|
|
59
|
+
"jest-circus": "~29.7.0",
|
|
60
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
60
61
|
"jest-fetch-mock": "~3.0.3",
|
|
61
62
|
"lerna": "~5.6.2",
|
|
62
63
|
"less": "~4.2.0",
|
|
63
64
|
"less-loader": "~10.2.0",
|
|
64
65
|
"less-plugin-npm-import": "~2.1.0",
|
|
65
|
-
"memfs": "~4.
|
|
66
|
+
"memfs": "~4.7.0",
|
|
66
67
|
"mini-css-extract-plugin": "~2.7.6",
|
|
67
68
|
"moment": "^2.29.4",
|
|
68
69
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
@@ -74,10 +75,10 @@
|
|
|
74
75
|
"style-loader": "~3.3.3",
|
|
75
76
|
"stylelint": "~14.16.1",
|
|
76
77
|
"swc-loader": "0.2.3",
|
|
77
|
-
"ts-jest": "~
|
|
78
|
+
"ts-jest": "~29.1.2",
|
|
78
79
|
"ts-loader": "~9.4.4",
|
|
79
80
|
"ts-node": "~10.9.1",
|
|
80
|
-
"typed-css-modules": "~0.
|
|
81
|
+
"typed-css-modules": "~0.8.1",
|
|
81
82
|
"typescript": "~4.7.4",
|
|
82
83
|
"username": "~5.1.0",
|
|
83
84
|
"webpack": "~5.78.0",
|
|
@@ -97,5 +98,5 @@
|
|
|
97
98
|
"cli": {
|
|
98
99
|
"webpack": false
|
|
99
100
|
},
|
|
100
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "45876ed36415ad78d3ec4ef3783d6df1430504d3"
|
|
101
102
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @jest-environment node
|
|
3
|
+
*/
|
|
2
4
|
import chokidar from 'chokidar';
|
|
5
|
+
import fs from 'fs';
|
|
3
6
|
|
|
4
7
|
import { getFolders, log } from '../../../utils';
|
|
5
8
|
import * as sassModule from '../compile-sass';
|
|
@@ -7,26 +10,32 @@ import * as sassModule from '../compile-sass';
|
|
|
7
10
|
import { styleExtensions } from '..';
|
|
8
11
|
import { tcm, tcmWatch } from '../tcm';
|
|
9
12
|
|
|
10
|
-
jest.mock('fs', () => fs);
|
|
11
13
|
jest.mock('../../../utils', () => ({
|
|
12
14
|
...jest.requireActual('../../../utils'),
|
|
13
15
|
getFolders: jest.fn(),
|
|
14
16
|
log: { error: jest.fn(), info: jest.fn() }, // suppress test output
|
|
15
17
|
}));
|
|
16
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Note: These tests don't use memfs because the typed-css-modules package
|
|
21
|
+
* uses node: URLs to import the fs modules, which bypasses the memfs filesystem
|
|
22
|
+
* (as of memfs ~4.6.0).
|
|
23
|
+
*/
|
|
24
|
+
|
|
17
25
|
describe('[startup] Cli Utils', () => {
|
|
18
|
-
const source = 'src';
|
|
26
|
+
const source = fs.mkdtempSync('src');
|
|
19
27
|
|
|
20
28
|
beforeEach(() => {
|
|
21
29
|
jest.resetAllMocks();
|
|
22
30
|
jest.mocked(getFolders).mockReturnValue({ source, destination: undefined });
|
|
31
|
+
fs.readdirSync(source).forEach(file => fs.rmSync(`${source}/${file}`));
|
|
23
32
|
});
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
afterAll(() => fs.rmSync(source, { recursive: true }));
|
|
26
35
|
|
|
27
36
|
function mockStylesModule(module: string, id = 'foo') {
|
|
28
37
|
const content = `.${id} { display: none; }`;
|
|
29
|
-
|
|
38
|
+
fs.writeFileSync(`${source}/${module}`, content);
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
function expectTypeDefinitions(module: string, id = 'foo') {
|
|
@@ -78,7 +87,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
78
87
|
beforeEach(() => {
|
|
79
88
|
fsWatcher = { on: jest.fn() };
|
|
80
89
|
watchSpy = jest.spyOn(chokidar, 'watch').mockReturnValue(fsWatcher as any);
|
|
81
|
-
|
|
90
|
+
fs.writeFileSync(`${source}/foo.bar`, '');
|
|
82
91
|
});
|
|
83
92
|
|
|
84
93
|
const subject = () => tcmWatch();
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
1
|
import path from 'path';
|
|
3
2
|
|
|
4
3
|
import sass from 'sass';
|
|
5
4
|
|
|
6
|
-
export function compileSass(filePath: string) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
includePaths: [path.dirname(filePath), '../../node_modules', 'node_modules'],
|
|
10
|
-
});
|
|
11
|
-
|
|
5
|
+
export async function compileSass(filePath: string) {
|
|
6
|
+
const loadPaths = [path.dirname(filePath), '../../node_modules', 'node_modules'];
|
|
7
|
+
const result = await sass.compileAsync(filePath, { loadPaths });
|
|
12
8
|
return result.css.toString();
|
|
13
9
|
}
|
package/src/cli/utils/tcm.ts
CHANGED
|
@@ -11,10 +11,19 @@ interface RunOptions {
|
|
|
11
11
|
watch?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
async function compile(filePath: string) {
|
|
15
|
+
if (filePath.endsWith('.less')) {
|
|
16
|
+
return compileLess(filePath);
|
|
17
|
+
}
|
|
18
|
+
if (filePath.endsWith('.scss')) {
|
|
19
|
+
return compileSass(filePath);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
14
23
|
async function run({ watch }: RunOptions = {}) {
|
|
15
24
|
const { source } = getFolders();
|
|
16
25
|
|
|
17
|
-
const filesPattern = `${source}/**/*.module.{${styleExtensions.join()}}
|
|
26
|
+
const filesPattern = `${source}/**/*.module.{${styleExtensions.join()}}`.replace(/\\/g, '/');
|
|
18
27
|
|
|
19
28
|
const creator = new DtsCreator({
|
|
20
29
|
camelCase: true,
|
|
@@ -23,15 +32,8 @@ async function run({ watch }: RunOptions = {}) {
|
|
|
23
32
|
|
|
24
33
|
const writeFile = async (filePath: string) => {
|
|
25
34
|
try {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
filePath.endsWith('.less')
|
|
29
|
-
? await compileLess(filePath)
|
|
30
|
-
: filePath.endsWith('.scss')
|
|
31
|
-
? compileSass(filePath)
|
|
32
|
-
: undefined,
|
|
33
|
-
!!watch
|
|
34
|
-
);
|
|
35
|
+
const initialContents = await compile(filePath);
|
|
36
|
+
const content = await creator.create(filePath, initialContents, !!watch);
|
|
35
37
|
await content.writeFile();
|
|
36
38
|
} catch (error) {
|
|
37
39
|
log.error(String(error));
|
|
@@ -45,7 +47,7 @@ async function run({ watch }: RunOptions = {}) {
|
|
|
45
47
|
} else {
|
|
46
48
|
log.info('Watch ' + filesPattern + '...');
|
|
47
49
|
|
|
48
|
-
const watcher = chokidar.watch([filesPattern
|
|
50
|
+
const watcher = chokidar.watch([filesPattern], { ignoreInitial: true });
|
|
49
51
|
watcher.on('add', writeFile);
|
|
50
52
|
watcher.on('change', writeFile);
|
|
51
53
|
|
|
@@ -13,23 +13,22 @@ jest.mock('../get-configuration', () => ({
|
|
|
13
13
|
|
|
14
14
|
describe('[startup] Utils', () => {
|
|
15
15
|
const destinationFolders = ['dist'];
|
|
16
|
-
const defaultConfig = {
|
|
16
|
+
const defaultConfig: Record<string, any> = {
|
|
17
17
|
verbose: true,
|
|
18
18
|
testEnvironment: 'jsdom',
|
|
19
19
|
testRunner: 'jest-circus/runner',
|
|
20
|
-
transformIgnorePatterns: ['node_modules/(
|
|
20
|
+
transformIgnorePatterns: ['node_modules/(?!(@servicetitan|@react-hook|nanoid)/)'],
|
|
21
21
|
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
22
22
|
transform: {
|
|
23
23
|
'^.+\\.jsx?$': [
|
|
24
24
|
'babel-jest',
|
|
25
25
|
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
26
26
|
],
|
|
27
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
27
|
+
'^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.test.json' }],
|
|
28
28
|
},
|
|
29
29
|
moduleNameMapper: {
|
|
30
30
|
'\\.(css|scss|less|png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$': 'identity-obj-proxy',
|
|
31
31
|
},
|
|
32
|
-
globals: { 'ts-jest': { tsconfig: './tsconfig.test.json' } },
|
|
33
32
|
testPathIgnorePatterns: ['\\.yalc', ...destinationFolders],
|
|
34
33
|
setupFiles: [expect.stringContaining(path.join('jest', 'setup.js'))],
|
|
35
34
|
coveragePathIgnorePatterns: ['^.+\\.d\\.ts$'],
|
|
@@ -73,25 +72,6 @@ describe('[startup] Utils', () => {
|
|
|
73
72
|
}
|
|
74
73
|
);
|
|
75
74
|
|
|
76
|
-
describe.each(['globals'])(
|
|
77
|
-
'with custom "%s"',
|
|
78
|
-
(option: keyof Pick<typeof defaultConfig, 'globals'>) => {
|
|
79
|
-
const customValue = { foo: 'bar' };
|
|
80
|
-
|
|
81
|
-
beforeEach(() => {
|
|
82
|
-
jest.mocked(getJestConfiguration).mockReturnValue({ [option]: customValue });
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test(`merges custom value with "${option}"`, () => {
|
|
86
|
-
expect(subject()).toEqual(
|
|
87
|
-
expect.objectContaining({
|
|
88
|
-
[option]: { ...defaultConfig[option], ...customValue },
|
|
89
|
-
})
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
|
|
95
75
|
describe('with other custom options', () => {
|
|
96
76
|
const customOptions = { resetMocks: true, testEnvironment: 'node' };
|
|
97
77
|
|
|
@@ -104,31 +84,28 @@ describe('[startup] Utils', () => {
|
|
|
104
84
|
});
|
|
105
85
|
|
|
106
86
|
describe(`${getJestConfigCLI.name}`, () => {
|
|
107
|
-
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
88
|
+
const args: Config.Argv = { _: [], $0: '', runInBand: true };
|
|
89
|
+
const globals = { foo: 'bar' };
|
|
108
90
|
|
|
109
91
|
const subject = () => getJestConfigCLI(args);
|
|
110
92
|
|
|
111
93
|
beforeEach(() => {
|
|
112
|
-
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
114
|
-
args = { _: [], $0: '', ...commandLineOptions };
|
|
94
|
+
jest.mocked(getJestConfiguration).mockReturnValue({ globals });
|
|
115
95
|
});
|
|
116
96
|
|
|
117
|
-
const stringified
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
];
|
|
97
|
+
const stringified = ['collectCoverageFrom', 'moduleNameMapper', 'transform'].reduce(
|
|
98
|
+
(result, key) => ({ ...result, [key]: JSON.stringify(defaultConfig[key]) }),
|
|
99
|
+
{ globals: JSON.stringify(globals) }
|
|
100
|
+
);
|
|
122
101
|
|
|
123
|
-
test(`merges command line args with default config and stringifies "${
|
|
124
|
-
|
|
125
|
-
)}"`, () => {
|
|
102
|
+
test(`merges command line args with default config and stringifies "${Object.keys(
|
|
103
|
+
stringified
|
|
104
|
+
).join('", "')}"`, () => {
|
|
126
105
|
expect(subject()).toEqual({
|
|
127
106
|
...defaultConfig,
|
|
128
107
|
...args,
|
|
129
|
-
...
|
|
130
|
-
stringified.map(option => [option, JSON.stringify(defaultConfig[option])])
|
|
131
|
-
),
|
|
108
|
+
...stringified,
|
|
132
109
|
});
|
|
133
110
|
});
|
|
134
111
|
});
|
|
@@ -4,39 +4,34 @@ import { JestConfiguration, getJestConfiguration } from './get-configuration';
|
|
|
4
4
|
import { getDestinationFolders } from './get-destination-folders';
|
|
5
5
|
import { toArray } from './to-array';
|
|
6
6
|
|
|
7
|
-
const getJestConfigBase = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const getJestConfigBase = ({
|
|
8
|
+
coveragePathIgnorePatterns = [],
|
|
9
|
+
setupFiles = [],
|
|
10
|
+
testPathIgnorePatterns = [],
|
|
11
|
+
}: {
|
|
12
|
+
coveragePathIgnorePatterns?: string[];
|
|
13
|
+
setupFiles?: string[];
|
|
14
|
+
testPathIgnorePatterns?: string[];
|
|
15
|
+
}) => {
|
|
14
16
|
const transform = {
|
|
15
17
|
'^.+\\.jsx?$': [
|
|
16
18
|
'babel-jest',
|
|
17
19
|
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
18
20
|
],
|
|
19
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
21
|
+
'^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.test.json' }],
|
|
20
22
|
};
|
|
21
23
|
const moduleNameMapper = {
|
|
22
24
|
'\\.(css|scss|less|png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$': 'identity-obj-proxy',
|
|
23
25
|
};
|
|
24
|
-
const globals = {
|
|
25
|
-
'ts-jest': {
|
|
26
|
-
tsconfig: './tsconfig.test.json',
|
|
27
|
-
},
|
|
28
|
-
...globalsOverrides,
|
|
29
|
-
};
|
|
30
26
|
|
|
31
27
|
return {
|
|
32
28
|
verbose: true,
|
|
33
29
|
testEnvironment: 'jsdom',
|
|
34
30
|
testRunner: 'jest-circus/runner',
|
|
35
|
-
transformIgnorePatterns: ['node_modules/(
|
|
31
|
+
transformIgnorePatterns: ['node_modules/(?!(@servicetitan|@react-hook|nanoid)/)'],
|
|
36
32
|
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
37
|
-
transform
|
|
38
|
-
moduleNameMapper
|
|
39
|
-
globals: stringify ? JSON.stringify(globals) : globals,
|
|
33
|
+
transform,
|
|
34
|
+
moduleNameMapper,
|
|
40
35
|
testPathIgnorePatterns: [
|
|
41
36
|
'\\.yalc',
|
|
42
37
|
...getDestinationFolders(),
|
|
@@ -54,21 +49,14 @@ const getJestConfigBase = (
|
|
|
54
49
|
* Jest config files.
|
|
55
50
|
*/
|
|
56
51
|
export const getJestConfig = (): JestConfiguration => {
|
|
57
|
-
const {
|
|
58
|
-
|
|
59
|
-
setupFiles = [],
|
|
60
|
-
coveragePathIgnorePatterns = [],
|
|
61
|
-
globals = {},
|
|
62
|
-
...config
|
|
63
|
-
} = { ...getJestConfiguration() };
|
|
52
|
+
const { coveragePathIgnorePatterns, setupFiles, testPathIgnorePatterns, ...config } =
|
|
53
|
+
getJestConfiguration() as Record<string, any>;
|
|
64
54
|
return {
|
|
65
|
-
...getJestConfigBase(
|
|
66
|
-
false,
|
|
67
|
-
testPathIgnorePatterns,
|
|
68
|
-
setupFiles,
|
|
55
|
+
...getJestConfigBase({
|
|
69
56
|
coveragePathIgnorePatterns,
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
setupFiles,
|
|
58
|
+
testPathIgnorePatterns,
|
|
59
|
+
}),
|
|
72
60
|
...config,
|
|
73
61
|
};
|
|
74
62
|
};
|
|
@@ -77,24 +65,23 @@ export const getJestConfig = (): JestConfiguration => {
|
|
|
77
65
|
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
78
66
|
*/
|
|
79
67
|
export const getJestConfigCLI = (args: Config.Argv): Config.Argv => {
|
|
80
|
-
const {
|
|
81
|
-
testPathIgnorePatterns = [],
|
|
82
|
-
setupFiles = [],
|
|
83
|
-
coveragePathIgnorePatterns = [],
|
|
84
|
-
globals = {},
|
|
85
|
-
...config
|
|
86
|
-
} = {
|
|
68
|
+
const { coveragePathIgnorePatterns, setupFiles, testPathIgnorePatterns, globals, ...config } = {
|
|
87
69
|
...getJestConfiguration(),
|
|
88
70
|
...args,
|
|
89
71
|
};
|
|
72
|
+
|
|
73
|
+
const { collectCoverageFrom, moduleNameMapper, transform, ...rest } = getJestConfigBase({
|
|
74
|
+
coveragePathIgnorePatterns,
|
|
75
|
+
setupFiles,
|
|
76
|
+
testPathIgnorePatterns,
|
|
77
|
+
});
|
|
78
|
+
|
|
90
79
|
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
globals
|
|
97
|
-
),
|
|
80
|
+
collectCoverageFrom: JSON.stringify(collectCoverageFrom),
|
|
81
|
+
globals: JSON.stringify(globals),
|
|
82
|
+
moduleNameMapper: JSON.stringify(moduleNameMapper),
|
|
83
|
+
transform: JSON.stringify(transform),
|
|
84
|
+
...rest,
|
|
98
85
|
...config,
|
|
99
86
|
};
|
|
100
87
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`expose-loader should work for a nested property for a global object: errors 1`] = `
|
|
3
|
+
exports[`expose-loader should work for a nested property for a global object: errors 1`] = `[]`;
|
|
4
4
|
|
|
5
5
|
exports[`expose-loader should work for a nested property for a global object: module 1`] = `
|
|
6
|
-
"var ___EXPOSE_LOADER_IMPORT___ = require(
|
|
7
|
-
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require(
|
|
6
|
+
"var ___EXPOSE_LOADER_IMPORT___ = require("-!./configuration.expose-loader.js");
|
|
7
|
+
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require("../../runtime/get-global-this.ts");
|
|
8
8
|
var ___EXPOSE_LOADER_STORAGE_KEY___ = Symbol.for('SERVICETITAN_EXPOSE_LOADER_STORAGE');
|
|
9
9
|
if (___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] === undefined) {
|
|
10
10
|
___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] = Object.assign(
|
|
@@ -48,7 +48,7 @@ ___EXPOSE_LOADER_GLOBAL_THIS___.SharedDependencies.Configuration = new Proxy(
|
|
|
48
48
|
if (prop === 'getStorage') {
|
|
49
49
|
return Reflect.get(target, prop, receiver);
|
|
50
50
|
}
|
|
51
|
-
return getModule(require.resolveWeak(
|
|
51
|
+
return getModule(require.resolveWeak("-!./configuration.expose-loader.js"))
|
|
52
52
|
},
|
|
53
53
|
}
|
|
54
54
|
);
|
|
@@ -57,8 +57,8 @@ module.exports = ___EXPOSE_LOADER_IMPORT___;
|
|
|
57
57
|
`;
|
|
58
58
|
|
|
59
59
|
exports[`expose-loader should work for a nested property for a global object: result 1`] = `
|
|
60
|
-
|
|
61
|
-
"configuration":
|
|
60
|
+
{
|
|
61
|
+
"configuration": {
|
|
62
62
|
"get": [Function],
|
|
63
63
|
"set": [Function],
|
|
64
64
|
"version": "1.0.0",
|
|
@@ -66,13 +66,13 @@ Object {
|
|
|
66
66
|
}
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
-
exports[`expose-loader should work for a nested property for a global object: warnings 1`] = `
|
|
69
|
+
exports[`expose-loader should work for a nested property for a global object: warnings 1`] = `[]`;
|
|
70
70
|
|
|
71
|
-
exports[`expose-loader should work: errors 1`] = `
|
|
71
|
+
exports[`expose-loader should work: errors 1`] = `[]`;
|
|
72
72
|
|
|
73
73
|
exports[`expose-loader should work: module 1`] = `
|
|
74
|
-
"var ___EXPOSE_LOADER_IMPORT___ = require(
|
|
75
|
-
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require(
|
|
74
|
+
"var ___EXPOSE_LOADER_IMPORT___ = require("-!./configuration.expose-loader.js");
|
|
75
|
+
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require("../../runtime/get-global-this.ts");
|
|
76
76
|
var ___EXPOSE_LOADER_STORAGE_KEY___ = Symbol.for('SERVICETITAN_EXPOSE_LOADER_STORAGE');
|
|
77
77
|
if (___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] === undefined) {
|
|
78
78
|
___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] = Object.assign(
|
|
@@ -113,7 +113,7 @@ ___EXPOSE_LOADER_GLOBAL_THIS___.Configuration = new Proxy(
|
|
|
113
113
|
if (prop === 'getStorage') {
|
|
114
114
|
return Reflect.get(target, prop, receiver);
|
|
115
115
|
}
|
|
116
|
-
return getModule(require.resolveWeak(
|
|
116
|
+
return getModule(require.resolveWeak("-!./configuration.expose-loader.js"))
|
|
117
117
|
},
|
|
118
118
|
}
|
|
119
119
|
);
|
|
@@ -122,8 +122,8 @@ module.exports = ___EXPOSE_LOADER_IMPORT___;
|
|
|
122
122
|
`;
|
|
123
123
|
|
|
124
124
|
exports[`expose-loader should work: result 1`] = `
|
|
125
|
-
|
|
126
|
-
"configuration":
|
|
125
|
+
{
|
|
126
|
+
"configuration": {
|
|
127
127
|
"get": [Function],
|
|
128
128
|
"set": [Function],
|
|
129
129
|
"version": "1.0.0",
|
|
@@ -131,4 +131,4 @@ Object {
|
|
|
131
131
|
}
|
|
132
132
|
`;
|
|
133
133
|
|
|
134
|
-
exports[`expose-loader should work: warnings 1`] = `
|
|
134
|
+
exports[`expose-loader should work: warnings 1`] = `[]`;
|
|
@@ -14,5 +14,5 @@ function removeCWD(str: string) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function normalizeErrors(errors: WebpackError[]) {
|
|
17
|
-
return errors.map(error => removeCWD(error.
|
|
17
|
+
return errors.map(error => removeCWD(error.message.split('\n').slice(0, 2).join('\n')));
|
|
18
18
|
}
|