@atls/code-test 0.0.5 → 0.0.6
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.js +1 -1
- package/dist/tester.js +81 -0
- package/package.json +13 -19
- package/config.js +0 -17
- package/dist/index.d.ts +0 -1
- package/dist/jest.config.d.ts +0 -88
- package/dist/jest.config.js +0 -41
- package/dist/jest.d.ts +0 -11
- package/dist/jest.js +0 -18
- package/resolver.js +0 -7
package/dist/index.js
CHANGED
|
@@ -10,4 +10,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
13
|
+
__exportStar(require("./tester"), exports);
|
package/dist/tester.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tester = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const core_1 = require("@jest/core");
|
|
7
|
+
const config_jest_1 = require("@atls/config-jest");
|
|
8
|
+
const config_jest_2 = require("@atls/config-jest");
|
|
9
|
+
class Tester {
|
|
10
|
+
constructor(cwd) {
|
|
11
|
+
this.cwd = cwd;
|
|
12
|
+
}
|
|
13
|
+
isFileExists(file) {
|
|
14
|
+
try {
|
|
15
|
+
(0, node_fs_1.accessSync)(file);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async unit(options, files) {
|
|
23
|
+
process.env.TS_JEST_DISABLE_VER_CHECKER = 'true';
|
|
24
|
+
const setup = {
|
|
25
|
+
globalSetup: this.isFileExists((0, node_path_1.join)(this.cwd, '.config/test/unit/setup.ts'))
|
|
26
|
+
? (0, node_path_1.join)(this.cwd, '.config/test/unit/setup.ts')
|
|
27
|
+
: undefined,
|
|
28
|
+
globalTeardown: this.isFileExists((0, node_path_1.join)(this.cwd, '.config/test/unit/teardown.ts'))
|
|
29
|
+
? (0, node_path_1.join)(this.cwd, '.config/test/unit/teardown.ts')
|
|
30
|
+
: undefined,
|
|
31
|
+
};
|
|
32
|
+
const argv = {
|
|
33
|
+
rootDir: this.cwd,
|
|
34
|
+
ci: false,
|
|
35
|
+
detectLeaks: false,
|
|
36
|
+
detectOpenHandles: false,
|
|
37
|
+
errorOnDeprecated: false,
|
|
38
|
+
listTests: false,
|
|
39
|
+
passWithNoTests: true,
|
|
40
|
+
runTestsByPath: false,
|
|
41
|
+
testLocationInResults: true,
|
|
42
|
+
config: JSON.stringify({ ...config_jest_2.unit, ...setup }),
|
|
43
|
+
maxConcurrency: 5,
|
|
44
|
+
notifyMode: 'failure-change',
|
|
45
|
+
_: files || [],
|
|
46
|
+
...options,
|
|
47
|
+
};
|
|
48
|
+
const { results } = await (0, core_1.runCLI)(argv, [this.cwd]);
|
|
49
|
+
return results;
|
|
50
|
+
}
|
|
51
|
+
async integration(options, files) {
|
|
52
|
+
process.env.TS_JEST_DISABLE_VER_CHECKER = 'true';
|
|
53
|
+
const setup = {
|
|
54
|
+
globalSetup: this.isFileExists((0, node_path_1.join)(this.cwd, '.config/test/integration/setup.ts'))
|
|
55
|
+
? (0, node_path_1.join)(this.cwd, '.config/test/integration/setup.ts')
|
|
56
|
+
: undefined,
|
|
57
|
+
globalTeardown: this.isFileExists((0, node_path_1.join)(this.cwd, '.config/test/integration/teardown.ts'))
|
|
58
|
+
? (0, node_path_1.join)(this.cwd, '.config/test/integration/teardown.ts')
|
|
59
|
+
: undefined,
|
|
60
|
+
};
|
|
61
|
+
const argv = {
|
|
62
|
+
rootDir: this.cwd,
|
|
63
|
+
ci: false,
|
|
64
|
+
detectLeaks: false,
|
|
65
|
+
detectOpenHandles: false,
|
|
66
|
+
errorOnDeprecated: false,
|
|
67
|
+
listTests: false,
|
|
68
|
+
passWithNoTests: true,
|
|
69
|
+
runTestsByPath: false,
|
|
70
|
+
testLocationInResults: true,
|
|
71
|
+
config: JSON.stringify({ ...config_jest_1.integration, ...setup }),
|
|
72
|
+
maxConcurrency: 5,
|
|
73
|
+
notifyMode: 'failure-change',
|
|
74
|
+
_: files || [],
|
|
75
|
+
...options,
|
|
76
|
+
};
|
|
77
|
+
const { results } = await (0, core_1.runCLI)(argv, [this.cwd]);
|
|
78
|
+
return results;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.Tester = Tester;
|
package/package.json
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atls/code-test",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
|
-
"config.js",
|
|
9
8
|
"resolver.js"
|
|
10
9
|
],
|
|
11
10
|
"scripts": {
|
|
12
|
-
"build": "
|
|
13
|
-
"
|
|
14
|
-
"prepack": "yarn run build"
|
|
15
|
-
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@atls/tools-builder": "0.0.0",
|
|
18
|
-
"@types/jest": "^27.0.1",
|
|
19
|
-
"@types/node": "^16.7.10",
|
|
20
|
-
"jest-haste-map": "^27.1.0",
|
|
21
|
-
"typescript": "^4.4.2"
|
|
11
|
+
"build": "yarn library build",
|
|
12
|
+
"build:worker": "rollup -c",
|
|
13
|
+
"prepack": "yarn run build",
|
|
14
|
+
"postpack": "rm -rf dist"
|
|
22
15
|
},
|
|
23
16
|
"dependencies": {
|
|
24
|
-
"@atls/
|
|
25
|
-
"@
|
|
26
|
-
"@jest/
|
|
27
|
-
"@jest/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
17
|
+
"@atls/config-jest": "0.0.2",
|
|
18
|
+
"@jest/core": "^27.4.5",
|
|
19
|
+
"@jest/test-result": "^27.4.2",
|
|
20
|
+
"@jest/types": "^27.4.2"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/jest": "^27.0.3",
|
|
24
|
+
"@types/node": "^16.11.12"
|
|
31
25
|
},
|
|
32
26
|
"peerDependenciesMeta": {
|
|
33
27
|
"jest": {
|
package/config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
testRegex: '\\.test\\.(ts|tsx)$',
|
|
3
|
-
modulePathIgnorePatterns: ['dist'],
|
|
4
|
-
snapshotSerializers: [require.resolve('@emotion/jest/serializer')],
|
|
5
|
-
moduleNameMapper: {
|
|
6
|
-
'^.+\\.(jpg|jpeg|gif|png|mp4|mkv|avi|webm|swf|wav|mid)$': 'jest-static-stubs/$1',
|
|
7
|
-
},
|
|
8
|
-
globals: {
|
|
9
|
-
'ts-jest': {
|
|
10
|
-
tsConfig: require.resolve('@atlantis-lab/tsconfig/tsconfig.base.json'),
|
|
11
|
-
diagnostics: false,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
transform: {
|
|
15
|
-
'^.+\\.[tj]sx?$': require.resolve('ts-jest'),
|
|
16
|
-
},
|
|
17
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './jest';
|
package/dist/jest.config.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export declare const unitConfig: {
|
|
2
|
-
testRegex: string;
|
|
3
|
-
modulePathIgnorePatterns: string[];
|
|
4
|
-
snapshotSerializers: string[];
|
|
5
|
-
moduleNameMapper: {
|
|
6
|
-
'^.+\\.(jpg|jpeg|gif|png|mp4|mkv|avi|webm|swf|wav|mid)$': string;
|
|
7
|
-
};
|
|
8
|
-
globals: {
|
|
9
|
-
'ts-jest': {
|
|
10
|
-
tsconfig: {
|
|
11
|
-
lib: string[];
|
|
12
|
-
declaration: boolean;
|
|
13
|
-
emitDecoratorMetadata: boolean;
|
|
14
|
-
experimentalDecorators: boolean;
|
|
15
|
-
esModuleInterop: boolean;
|
|
16
|
-
forceConsistentCasingInFileNames: boolean;
|
|
17
|
-
importHelpers: boolean;
|
|
18
|
-
isolatedModules: boolean;
|
|
19
|
-
module: string;
|
|
20
|
-
moduleResolution: string;
|
|
21
|
-
noFallthroughCasesInSwitch: boolean;
|
|
22
|
-
noImplicitAny: boolean;
|
|
23
|
-
noImplicitReturns: boolean;
|
|
24
|
-
noImplicitThis: boolean;
|
|
25
|
-
noUnusedLocals: boolean;
|
|
26
|
-
noUnusedParameters: boolean;
|
|
27
|
-
pretty: boolean;
|
|
28
|
-
removeComments: boolean;
|
|
29
|
-
resolveJsonModule: boolean;
|
|
30
|
-
strict: boolean;
|
|
31
|
-
strictPropertyInitialization: boolean;
|
|
32
|
-
sourceMap: boolean;
|
|
33
|
-
target: string;
|
|
34
|
-
jsx: string;
|
|
35
|
-
outDir: string;
|
|
36
|
-
};
|
|
37
|
-
diagnostics: boolean;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
transform: {
|
|
41
|
-
'^.+\\.[tj]sx?$': string;
|
|
42
|
-
};
|
|
43
|
-
resolver: string;
|
|
44
|
-
};
|
|
45
|
-
export declare const integrationConfig: {
|
|
46
|
-
testRegex: string;
|
|
47
|
-
modulePathIgnorePatterns: string[];
|
|
48
|
-
snapshotSerializers: string[];
|
|
49
|
-
moduleNameMapper: {
|
|
50
|
-
'^.+\\.(jpg|jpeg|gif|png|mp4|mkv|avi|webm|swf|wav|mid)$': string;
|
|
51
|
-
};
|
|
52
|
-
globals: {
|
|
53
|
-
'ts-jest': {
|
|
54
|
-
tsconfig: {
|
|
55
|
-
lib: string[];
|
|
56
|
-
declaration: boolean;
|
|
57
|
-
emitDecoratorMetadata: boolean;
|
|
58
|
-
experimentalDecorators: boolean;
|
|
59
|
-
esModuleInterop: boolean;
|
|
60
|
-
forceConsistentCasingInFileNames: boolean;
|
|
61
|
-
importHelpers: boolean;
|
|
62
|
-
isolatedModules: boolean;
|
|
63
|
-
module: string;
|
|
64
|
-
moduleResolution: string;
|
|
65
|
-
noFallthroughCasesInSwitch: boolean;
|
|
66
|
-
noImplicitAny: boolean;
|
|
67
|
-
noImplicitReturns: boolean;
|
|
68
|
-
noImplicitThis: boolean;
|
|
69
|
-
noUnusedLocals: boolean;
|
|
70
|
-
noUnusedParameters: boolean;
|
|
71
|
-
pretty: boolean;
|
|
72
|
-
removeComments: boolean;
|
|
73
|
-
resolveJsonModule: boolean;
|
|
74
|
-
strict: boolean;
|
|
75
|
-
strictPropertyInitialization: boolean;
|
|
76
|
-
sourceMap: boolean;
|
|
77
|
-
target: string;
|
|
78
|
-
jsx: string;
|
|
79
|
-
outDir: string;
|
|
80
|
-
};
|
|
81
|
-
diagnostics: boolean;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
transform: {
|
|
85
|
-
'^.+\\.[tj]sx?$': string;
|
|
86
|
-
};
|
|
87
|
-
resolver: string;
|
|
88
|
-
};
|
package/dist/jest.config.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.integrationConfig = exports.unitConfig = void 0;
|
|
4
|
-
const code_typescript_1 = require("@atls/code-typescript");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
exports.unitConfig = {
|
|
7
|
-
testRegex: '\\.test\\.(ts|tsx)$',
|
|
8
|
-
modulePathIgnorePatterns: ['dist', 'integration'],
|
|
9
|
-
snapshotSerializers: [require.resolve('@emotion/jest/serializer')],
|
|
10
|
-
moduleNameMapper: {
|
|
11
|
-
'^.+\\.(jpg|jpeg|gif|png|mp4|mkv|avi|webm|swf|wav|mid)$': 'jest-static-stubs/$1',
|
|
12
|
-
},
|
|
13
|
-
globals: {
|
|
14
|
-
'ts-jest': {
|
|
15
|
-
tsconfig: code_typescript_1.base.compilerOptions,
|
|
16
|
-
diagnostics: false,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
transform: {
|
|
20
|
-
'^.+\\.[tj]sx?$': require.resolve('ts-jest'),
|
|
21
|
-
},
|
|
22
|
-
resolver: (0, path_1.join)(__dirname, '../resolver.js'),
|
|
23
|
-
};
|
|
24
|
-
exports.integrationConfig = {
|
|
25
|
-
testRegex: '/integration/.*\\.test\\.(ts|tsx)$',
|
|
26
|
-
modulePathIgnorePatterns: ['dist'],
|
|
27
|
-
snapshotSerializers: [require.resolve('@emotion/jest/serializer')],
|
|
28
|
-
moduleNameMapper: {
|
|
29
|
-
'^.+\\.(jpg|jpeg|gif|png|mp4|mkv|avi|webm|swf|wav|mid)$': 'jest-static-stubs/$1',
|
|
30
|
-
},
|
|
31
|
-
globals: {
|
|
32
|
-
'ts-jest': {
|
|
33
|
-
tsconfig: code_typescript_1.base.compilerOptions,
|
|
34
|
-
diagnostics: false,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
transform: {
|
|
38
|
-
'^.+\\.[tj]sx?$': require.resolve('ts-jest'),
|
|
39
|
-
},
|
|
40
|
-
resolver: (0, path_1.join)(__dirname, '../resolver.js'),
|
|
41
|
-
};
|
package/dist/jest.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AggregatedResult } from '@jest/test-result';
|
|
2
|
-
import { Config } from '@jest/types';
|
|
3
|
-
declare const unit: (project: string, options?: Partial<Config.Argv> | undefined, files?: string[] | undefined) => Promise<{
|
|
4
|
-
results: AggregatedResult;
|
|
5
|
-
globalConfig: Config.GlobalConfig;
|
|
6
|
-
}>;
|
|
7
|
-
declare const integration: (project: string, options?: Partial<Config.Argv> | undefined, files?: string[] | undefined) => Promise<{
|
|
8
|
-
results: AggregatedResult;
|
|
9
|
-
globalConfig: Config.GlobalConfig;
|
|
10
|
-
}>;
|
|
11
|
-
export { unit, integration };
|
package/dist/jest.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.integration = exports.unit = void 0;
|
|
4
|
-
const core_1 = require("@jest/core");
|
|
5
|
-
const jest_config_1 = require("./jest.config");
|
|
6
|
-
const jest_config_2 = require("./jest.config");
|
|
7
|
-
const unit = async (project, options, files) => {
|
|
8
|
-
process.env.TS_JEST_DISABLE_VER_CHECKER = 'true';
|
|
9
|
-
const argv = Object.assign({ rootDir: project, ci: false, detectLeaks: false, detectOpenHandles: false, errorOnDeprecated: false, listTests: false, passWithNoTests: true, runTestsByPath: false, testLocationInResults: true, config: JSON.stringify(jest_config_2.unitConfig), maxConcurrency: 5, notifyMode: 'failure-change', _: files || [] }, options);
|
|
10
|
-
return (0, core_1.runCLI)(argv, [project]);
|
|
11
|
-
};
|
|
12
|
-
exports.unit = unit;
|
|
13
|
-
const integration = async (project, options, files) => {
|
|
14
|
-
process.env.TS_JEST_DISABLE_VER_CHECKER = 'true';
|
|
15
|
-
const argv = Object.assign({ rootDir: project, ci: false, detectLeaks: false, detectOpenHandles: false, errorOnDeprecated: false, listTests: false, passWithNoTests: true, runTestsByPath: false, testLocationInResults: true, config: JSON.stringify(jest_config_1.integrationConfig), maxConcurrency: 5, notifyMode: 'failure-change', _: files || [] }, options);
|
|
16
|
-
return (0, core_1.runCLI)(argv, [project]);
|
|
17
|
-
};
|
|
18
|
-
exports.integration = integration;
|