@tsed/cli-plugin-jest 5.3.1 → 6.0.0-alpha.2
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/lib/esm/CliPluginJestModule.js +1 -3
- package/lib/esm/CliPluginJestModule.js.map +1 -1
- package/lib/esm/hooks/JestGenerateHook.js +1 -2
- package/lib/esm/hooks/JestGenerateHook.js.map +1 -1
- package/lib/esm/hooks/JestInitHook.js +1 -5
- package/lib/esm/hooks/JestInitHook.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/templateDir.js +3 -5
- package/lib/esm/utils/templateDir.js.map +1 -1
- package/lib/types/CliPluginJestModule.d.ts +1 -1
- package/lib/types/index.d.ts +2 -2
- package/package.json +20 -18
- package/scripts/templateDir.esm.js +2 -1
- package/templates/generate/decorator.class.spec.hbs +1 -1
- package/templates/generate/decorator.endpoint.spec.hbs +1 -1
- package/templates/generate/decorator.method.spec.hbs +1 -1
- package/templates/generate/decorator.param.spec.hbs +1 -1
- package/templates/generate/decorator.parameter.spec.hbs +1 -1
- package/templates/generate/decorator.prop.spec.hbs +1 -1
- package/templates/generate/decorator.property.spec.hbs +1 -1
- package/templates/generate/generic.integration.hbs +2 -2
- package/templates/generate/generic.spec.hbs +1 -1
- package/templates/generate/server.integration.hbs +1 -1
- package/vitest.config.mts +21 -0
- package/.eslintignore +0 -13
- package/.eslintrc.js +0 -1
- package/jest.config.js +0 -15
- package/lib/cjs/CliPluginJestModule.js +0 -53
- package/lib/cjs/CliPluginJestModule.js.map +0 -1
- package/lib/cjs/hooks/JestGenerateHook.js +0 -65
- package/lib/cjs/hooks/JestGenerateHook.js.map +0 -1
- package/lib/cjs/hooks/JestInitHook.js +0 -51
- package/lib/cjs/hooks/JestInitHook.js.map +0 -1
- package/lib/cjs/index.js +0 -7
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/utils/templateDir.js +0 -6
- package/lib/cjs/utils/templateDir.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/tsconfig.esm.tsbuildinfo +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/tsconfig.esm.json +0 -39
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { Module, OnAdd, ProjectPackageJson } from "@tsed/cli-core";
|
|
3
2
|
import { RuntimesModule } from "@tsed/cli";
|
|
3
|
+
import { Module, OnAdd, ProjectPackageJson } from "@tsed/cli-core";
|
|
4
4
|
import { Inject } from "@tsed/di";
|
|
5
5
|
import { JestGenerateHook } from "./hooks/JestGenerateHook.js";
|
|
6
6
|
import { JestInitHook } from "./hooks/JestInitHook.js";
|
|
7
7
|
let CliPluginJestModule = class CliPluginJestModule {
|
|
8
|
-
runtimes;
|
|
9
|
-
packageJson;
|
|
10
8
|
install() {
|
|
11
9
|
this.addScripts();
|
|
12
10
|
this.addDevDependencies();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CliPluginJestModule.js","sourceRoot":"","sources":["../../src/CliPluginJestModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"CliPluginJestModule.js","sourceRoot":"","sources":["../../src/CliPluginJestModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAK9C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAQ9B,OAAO;QACL,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAED,UAAU;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAEpC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;YAC1B,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG;YACvE,WAAW,EAAE,8BAA8B;YAC3C,eAAe,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG;SAChD,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC;YAClC,aAAa,EAAE,QAAQ;YACvB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,QAAQ;SACpB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA7BC;IAAC,MAAM,EAAE;8BACC,cAAc;qDAAC;AAEzB;IAAC,MAAM,EAAE;8BACI,kBAAkB;wDAAC;AAEhC;IAAC,KAAK,CAAC,uBAAuB,CAAC;;;;kDAI9B;AAXU,mBAAmB;IAH/B,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;KAC1C,CAAC;GACW,mBAAmB,CA8B/B;SA9BY,mBAAmB"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import normalizePath from "normalize-path";
|
|
3
2
|
import { Inject, Injectable, OnExec, SrcRendererService } from "@tsed/cli-core";
|
|
3
|
+
import normalizePath from "normalize-path";
|
|
4
4
|
import { TEMPLATE_DIR } from "../utils/templateDir.js";
|
|
5
5
|
let JestGenerateHook = class JestGenerateHook {
|
|
6
|
-
srcRenderService;
|
|
7
6
|
onGenerateExec(ctx) {
|
|
8
7
|
const { symbolPath } = ctx;
|
|
9
8
|
const { specTemplate, integrationTemplate, relativeSrcPath } = this.mapOptions(ctx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JestGenerateHook.js","sourceRoot":"","sources":["../../../src/hooks/JestGenerateHook.ts"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"JestGenerateHook.js","sourceRoot":"","sources":["../../../src/hooks/JestGenerateHook.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAQ,MAAM,gBAAgB,CAAC;AACrF,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAG9C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAK3B,cAAc,CAAC,GAAuB;QACpC,MAAM,EAAC,UAAU,EAAC,GAAG,GAAG,CAAC;QACzB,MAAM,EAAC,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAElF,OAAO;YACL;gBACE,KAAK,EAAE,YAAY,GAAG,CAAC,IAAI,kBAAkB,UAAU,WAAW;gBAClE,OAAO;oBACL,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;gBAC1G,CAAC;gBACD,IAAI,EAAE,GAAG,EAAE,CACT,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAC1B,YAAY,EACZ,EAAC,GAAG,GAAG,EAAE,eAAe,EAAC,EACzB;oBACE,MAAM,EAAE,GAAG,UAAU,UAAU;oBAC/B,WAAW,EAAE,YAAY;iBAC1B,CACF;aACJ;YACD;gBACE,KAAK,EAAE,YAAY,GAAG,CAAC,IAAI,sBAAsB,UAAU,uBAAuB;gBAClF,OAAO;oBACL,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC,Q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,12 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { Inject, Injectable, OnExec, ProjectPackageJson, RootRendererService, ScriptsRendererService, SrcRendererService } from "@tsed/cli-core";
|
|
3
3
|
import { TEMPLATE_DIR } from "../utils/templateDir.js";
|
|
4
4
|
let JestInitHook = class JestInitHook {
|
|
5
|
-
packageJson;
|
|
6
|
-
srcRenderer;
|
|
7
|
-
rootRenderer;
|
|
8
|
-
scriptsRenderer;
|
|
9
5
|
onInitExec() {
|
|
10
6
|
return [
|
|
11
7
|
{
|
|
12
8
|
title: "Generate files for jest",
|
|
13
9
|
task: (ctx) => {
|
|
14
|
-
return this.rootRenderer.renderAll(["
|
|
10
|
+
return this.rootRenderer.renderAll(["vi.config.js.hbs"], ctx, {
|
|
15
11
|
templateDir: `${TEMPLATE_DIR}/init`
|
|
16
12
|
});
|
|
17
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JestInitHook.js","sourceRoot":"","sources":["../../../src/hooks/JestInitHook.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"JestInitHook.js","sourceRoot":"","sources":["../../../src/hooks/JestInitHook.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,MAAM,EACN,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAG9C,IAAM,YAAY,GAAlB,MAAM,YAAY;IAcvB,UAAU;QACR,OAAO;YACL;gBACE,KAAK,EAAE,yBAAyB;gBAChC,IAAI,EAAE,CAAC,GAAQ,EAAE,EAAE;oBACjB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE;wBAC5D,WAAW,EAAE,GAAG,YAAY,OAAO;qBACpC,CAAC,CAAC;gBACL,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAzBC;IAAC,MAAM,EAAE;8BACc,kBAAkB;iDAAC;AAE1C;IAAC,MAAM,EAAE;8BACc,kBAAkB;iDAAC;AAE1C;IAAC,MAAM,EAAE;8BACe,mBAAmB;kDAAC;AAE5C;IAAC,MAAM,EAAE;8BACkB,sBAAsB;qDAAC;AAElD;IAAC,MAAM,CAAC,MAAM,CAAC;;;;8CAYd;AAzBU,YAAY;IADxB,UAAU,EAAE;GACA,YAAY,CA0BxB;SA1BY,YAAY"}
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAE7D,cAAc,wBAAwB,CAAC;AAEvC,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {getTemplateDirectory} from "@tsed/cli-core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const TEMPLATE_DIR = getTemplateDirectory(path.dirname(fileURLToPath(import.meta.url)));
|
|
1
|
+
import { getTemplateDirectory } from "@tsed/cli-core";
|
|
2
|
+
export const TEMPLATE_DIR = getTemplateDirectory(import.meta.dirname);
|
|
3
|
+
//# sourceMappingURL=templateDir.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateDir.js","sourceRoot":"","sources":["../../../src/utils/templateDir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"templateDir.js","sourceRoot":"","sources":["../../../src/utils/templateDir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CliPluginJestModule } from "./CliPluginJestModule";
|
|
2
|
-
export * from "./utils/templateDir";
|
|
1
|
+
import { CliPluginJestModule } from "./CliPluginJestModule.js";
|
|
2
|
+
export * from "./utils/templateDir.js";
|
|
3
3
|
export default CliPluginJestModule;
|
package/package.json
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/cli-plugin-jest",
|
|
3
|
-
"version": "5.3.1",
|
|
4
3
|
"description": "Ts.ED CLI plugin. Add Jest support",
|
|
4
|
+
"version": "6.0.0-alpha.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/esm/index.js",
|
|
5
7
|
"source": "./src/index.ts",
|
|
6
|
-
"main": "./lib/cjs/index.js",
|
|
7
8
|
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"default": "./lib/esm/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "yarn build:ts",
|
|
17
|
-
"build:ts": "tsc --build tsconfig.json
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2 --passWithNoTests && jest-coverage-thresholds-bumper"
|
|
19
|
+
"build:ts": "tsc --build tsconfig.json",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@tsed/cli": "
|
|
24
|
-
"@tsed/cli-core": "
|
|
25
|
-
"@tsed/
|
|
26
|
-
"@tsed/jest-config": "5.3.1",
|
|
27
|
-
"@tsed/typescript": "5.3.1",
|
|
24
|
+
"@tsed/cli": "6.0.0-alpha.2",
|
|
25
|
+
"@tsed/cli-core": "6.0.0-alpha.2",
|
|
26
|
+
"@tsed/typescript": "6.0.0-alpha.2",
|
|
28
27
|
"cross-env": "7.0.3",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
28
|
+
"typescript": "4.9.5",
|
|
29
|
+
"vitest": "2.1.1"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"tslib": "2.3.1"
|
|
@@ -39,5 +38,8 @@
|
|
|
39
38
|
},
|
|
40
39
|
"homepage": "https://github.com/tsedio/tsed-cli/tree/master/packages/cli-plugin-jest",
|
|
41
40
|
"author": "Romain Lenzotti",
|
|
42
|
-
"license": "MIT"
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"tag": "alpha"
|
|
44
|
+
}
|
|
43
45
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {getTemplateDirectory} from "@tsed/cli-core";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import {fileURLToPath} from "node:url";
|
|
4
3
|
|
|
4
|
+
import {getTemplateDirectory} from "@tsed/cli-core";
|
|
5
|
+
|
|
5
6
|
export const TEMPLATE_DIR = getTemplateDirectory(path.dirname(fileURLToPath(import.meta.url)));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlatformTest } from "@tsed/common";
|
|
2
2
|
import SuperTest from "supertest";
|
|
3
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}";
|
|
4
|
-
import { Server } from "{{relativeSrcPath}}/Server";
|
|
3
|
+
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
4
|
+
import { Server } from "{{relativeSrcPath}}/Server.js";
|
|
5
5
|
|
|
6
6
|
describe("{{symbolName}}", () => {
|
|
7
7
|
beforeEach(PlatformTest.bootstrap(Server, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PlatformTest } from "@tsed/common";
|
|
2
2
|
import SuperTest from "supertest";
|
|
3
|
-
import { {{symbolName}} } from "./{{symbolPathBasename}}";
|
|
3
|
+
import { {{symbolName}} } from "./{{symbolPathBasename}}.js";
|
|
4
4
|
|
|
5
5
|
describe("{{symbolName}}", () => {
|
|
6
6
|
beforeEach(PlatformTest.bootstrap({{symbolName}}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
coverage: {
|
|
11
|
+
...presets.test.coverage,
|
|
12
|
+
thresholds: {
|
|
13
|
+
statements: 0,
|
|
14
|
+
branches: 0,
|
|
15
|
+
functions: 0,
|
|
16
|
+
lines: 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("@tsed/eslint/node.js");
|
package/jest.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
...require("@tsed/jest-config"),
|
|
6
|
-
roots: ["<rootDir>/src", "<rootDir>/test"],
|
|
7
|
-
coverageThreshold: {
|
|
8
|
-
global: {
|
|
9
|
-
statements: 80,
|
|
10
|
-
branches: 37.5,
|
|
11
|
-
functions: 60,
|
|
12
|
-
lines: 80
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CliPluginJestModule = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
6
|
-
const cli_1 = require("@tsed/cli");
|
|
7
|
-
const di_1 = require("@tsed/di");
|
|
8
|
-
const JestGenerateHook_1 = require("./hooks/JestGenerateHook");
|
|
9
|
-
const JestInitHook_1 = require("./hooks/JestInitHook");
|
|
10
|
-
let CliPluginJestModule = class CliPluginJestModule {
|
|
11
|
-
runtimes;
|
|
12
|
-
packageJson;
|
|
13
|
-
install() {
|
|
14
|
-
this.addScripts();
|
|
15
|
-
this.addDevDependencies();
|
|
16
|
-
}
|
|
17
|
-
addScripts() {
|
|
18
|
-
const runtime = this.runtimes.get();
|
|
19
|
-
this.packageJson.addScripts({
|
|
20
|
-
test: `${runtime.run("test:lint")} && ${runtime.run("test:coverage")} `,
|
|
21
|
-
"test:unit": "cross-env NODE_ENV=test jest",
|
|
22
|
-
"test:coverage": `${runtime.run("test:unit")} `
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
addDevDependencies() {
|
|
26
|
-
this.packageJson.addDevDependencies({
|
|
27
|
-
"@types/jest": "latest",
|
|
28
|
-
jest: "latest",
|
|
29
|
-
"ts-jest": "latest"
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
tslib_1.__decorate([
|
|
34
|
-
(0, di_1.Inject)(),
|
|
35
|
-
tslib_1.__metadata("design:type", cli_1.RuntimesModule)
|
|
36
|
-
], CliPluginJestModule.prototype, "runtimes", void 0);
|
|
37
|
-
tslib_1.__decorate([
|
|
38
|
-
(0, di_1.Inject)(),
|
|
39
|
-
tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
|
|
40
|
-
], CliPluginJestModule.prototype, "packageJson", void 0);
|
|
41
|
-
tslib_1.__decorate([
|
|
42
|
-
(0, cli_core_1.OnAdd)("@tsed/cli-plugin-jest"),
|
|
43
|
-
tslib_1.__metadata("design:type", Function),
|
|
44
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
45
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
46
|
-
], CliPluginJestModule.prototype, "install", null);
|
|
47
|
-
CliPluginJestModule = tslib_1.__decorate([
|
|
48
|
-
(0, cli_core_1.Module)({
|
|
49
|
-
imports: [JestInitHook_1.JestInitHook, JestGenerateHook_1.JestGenerateHook]
|
|
50
|
-
})
|
|
51
|
-
], CliPluginJestModule);
|
|
52
|
-
exports.CliPluginJestModule = CliPluginJestModule;
|
|
53
|
-
//# sourceMappingURL=CliPluginJestModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CliPluginJestModule.js","sourceRoot":"","sources":["../../src/CliPluginJestModule.ts"],"names":[],"mappings":";;;;AAAA,6CAAiE;AACjE,mCAAyC;AACzC,iCAAgC;AAChC,+DAA0D;AAC1D,uDAAkD;AAK3C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAE9B,QAAQ,CAAiB;IAGzB,WAAW,CAAqB;IAGhC,OAAO;QACL,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAED,UAAU;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAEpC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;YAC1B,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG;YACvE,WAAW,EAAE,8BAA8B;YAC3C,eAAe,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG;SAChD,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC;YAClC,aAAa,EAAE,QAAQ;YACvB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,QAAQ;SACpB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA7BC;IAAC,IAAA,WAAM,GAAE;sCACC,oBAAc;qDAAC;AAEzB;IAAC,IAAA,WAAM,GAAE;sCACI,6BAAkB;wDAAC;AAEhC;IAAC,IAAA,gBAAK,EAAC,uBAAuB,CAAC;;;;kDAI9B;AAXU,mBAAmB;IAH/B,IAAA,iBAAM,EAAC;QACN,OAAO,EAAE,CAAC,2BAAY,EAAE,mCAAgB,CAAC;KAC1C,CAAC;GACW,mBAAmB,CA8B/B;AA9BY,kDAAmB"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JestGenerateHook = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const normalize_path_1 = tslib_1.__importDefault(require("normalize-path"));
|
|
6
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
7
|
-
const templateDir_1 = require("../utils/templateDir");
|
|
8
|
-
let JestGenerateHook = class JestGenerateHook {
|
|
9
|
-
srcRenderService;
|
|
10
|
-
onGenerateExec(ctx) {
|
|
11
|
-
const { symbolPath } = ctx;
|
|
12
|
-
const { specTemplate, integrationTemplate, relativeSrcPath } = this.mapOptions(ctx);
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
title: `Generate ${ctx.type} spec file to '${symbolPath}.spec.ts'`,
|
|
16
|
-
enabled() {
|
|
17
|
-
return !(ctx.type === "server" || ctx.type.includes(":dataSource") || ctx.type.includes(":connection"));
|
|
18
|
-
},
|
|
19
|
-
task: () => this.srcRenderService.render(specTemplate, { ...ctx, relativeSrcPath }, {
|
|
20
|
-
output: `${symbolPath}.spec.ts`,
|
|
21
|
-
templateDir: templateDir_1.TEMPLATE_DIR
|
|
22
|
-
})
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
title: `Generate ${ctx.type} integration file '${symbolPath}.integration.spec.ts'`,
|
|
26
|
-
enabled() {
|
|
27
|
-
return ["controller", "server"].includes(ctx.type);
|
|
28
|
-
},
|
|
29
|
-
task: () => this.srcRenderService.render(integrationTemplate, { ...ctx, relativeSrcPath }, {
|
|
30
|
-
output: `${symbolPath}.integration.spec.ts`,
|
|
31
|
-
templateDir: templateDir_1.TEMPLATE_DIR
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
mapOptions(options) {
|
|
37
|
-
const type = [options.type, options.templateType].filter(Boolean).join(".");
|
|
38
|
-
const specTemplate = this.srcRenderService.templateExists(`generate/${type}.spec.hbs`, { templateDir: templateDir_1.TEMPLATE_DIR })
|
|
39
|
-
? `generate/${type}.spec.hbs`
|
|
40
|
-
: "generate/generic.spec.hbs";
|
|
41
|
-
const integrationTemplate = this.srcRenderService.templateExists(`generate/${type}.integration.hbs`, { templateDir: templateDir_1.TEMPLATE_DIR })
|
|
42
|
-
? `generate/${type}.integration.hbs`
|
|
43
|
-
: "generate/generic.integration.hbs";
|
|
44
|
-
return {
|
|
45
|
-
specTemplate,
|
|
46
|
-
integrationTemplate,
|
|
47
|
-
relativeSrcPath: (0, normalize_path_1.default)(this.srcRenderService.relativeFrom(`${options.symbolPath}.integration.spec.ts`))
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
tslib_1.__decorate([
|
|
52
|
-
(0, cli_core_1.Inject)(),
|
|
53
|
-
tslib_1.__metadata("design:type", cli_core_1.SrcRendererService)
|
|
54
|
-
], JestGenerateHook.prototype, "srcRenderService", void 0);
|
|
55
|
-
tslib_1.__decorate([
|
|
56
|
-
(0, cli_core_1.OnExec)("generate"),
|
|
57
|
-
tslib_1.__metadata("design:type", Function),
|
|
58
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
59
|
-
tslib_1.__metadata("design:returntype", Array)
|
|
60
|
-
], JestGenerateHook.prototype, "onGenerateExec", null);
|
|
61
|
-
JestGenerateHook = tslib_1.__decorate([
|
|
62
|
-
(0, cli_core_1.Injectable)()
|
|
63
|
-
], JestGenerateHook);
|
|
64
|
-
exports.JestGenerateHook = JestGenerateHook;
|
|
65
|
-
//# sourceMappingURL=JestGenerateHook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JestGenerateHook.js","sourceRoot":"","sources":["../../../src/hooks/JestGenerateHook.ts"],"names":[],"mappings":";;;;AACA,4EAA2C;AAC3C,6CAAqF;AAErF,sDAAkD;AAG3C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAE3B,gBAAgB,CAAqB;IAGrC,cAAc,CAAC,GAAuB;QACpC,MAAM,EAAC,UAAU,EAAC,GAAG,GAAG,CAAC;QACzB,MAAM,EAAC,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAElF,OAAO;YACL;gBACE,KAAK,EAAE,YAAY,GAAG,CAAC,IAAI,kBAAkB,UAAU,WAAW;gBAClE,OAAO;oBACL,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;gBAC1G,CAAC;gBACD,IAAI,EAAE,GAAG,EAAE,CACT,IAAI,CAAC,g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AC,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,UAAU,sBAAsB,CAAC,CAAC;SAChH,CAAC;IACJ,CAAC;CACF,CAAA;AA3DC;IAAC,IAAA,iBAAM,GAAE;sCACS,6BAAkB;0DAAC;AAErC;IAAC,IAAA,iBAAM,EAAC,UAAU,CAAC;;;;sDAqClB;AAzCU,gBAAgB;IAD5B,IAAA,qBAAU,GAAE;GACA,gBAAgB,CA4D5B;AA5DY,4CAAgB"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JestInitHook = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
6
|
-
const templateDir_1 = require("../utils/templateDir");
|
|
7
|
-
let JestInitHook = class JestInitHook {
|
|
8
|
-
packageJson;
|
|
9
|
-
srcRenderer;
|
|
10
|
-
rootRenderer;
|
|
11
|
-
scriptsRenderer;
|
|
12
|
-
onInitExec() {
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
title: "Generate files for jest",
|
|
16
|
-
task: (ctx) => {
|
|
17
|
-
return this.rootRenderer.renderAll(["jest.config.js.hbs"], ctx, {
|
|
18
|
-
templateDir: `${templateDir_1.TEMPLATE_DIR}/init`
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
tslib_1.__decorate([
|
|
26
|
-
(0, cli_core_1.Inject)(),
|
|
27
|
-
tslib_1.__metadata("design:type", cli_core_1.ProjectPackageJson)
|
|
28
|
-
], JestInitHook.prototype, "packageJson", void 0);
|
|
29
|
-
tslib_1.__decorate([
|
|
30
|
-
(0, cli_core_1.Inject)(),
|
|
31
|
-
tslib_1.__metadata("design:type", cli_core_1.SrcRendererService)
|
|
32
|
-
], JestInitHook.prototype, "srcRenderer", void 0);
|
|
33
|
-
tslib_1.__decorate([
|
|
34
|
-
(0, cli_core_1.Inject)(),
|
|
35
|
-
tslib_1.__metadata("design:type", cli_core_1.RootRendererService)
|
|
36
|
-
], JestInitHook.prototype, "rootRenderer", void 0);
|
|
37
|
-
tslib_1.__decorate([
|
|
38
|
-
(0, cli_core_1.Inject)(),
|
|
39
|
-
tslib_1.__metadata("design:type", cli_core_1.ScriptsRendererService)
|
|
40
|
-
], JestInitHook.prototype, "scriptsRenderer", void 0);
|
|
41
|
-
tslib_1.__decorate([
|
|
42
|
-
(0, cli_core_1.OnExec)("init"),
|
|
43
|
-
tslib_1.__metadata("design:type", Function),
|
|
44
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
45
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
46
|
-
], JestInitHook.prototype, "onInitExec", null);
|
|
47
|
-
JestInitHook = tslib_1.__decorate([
|
|
48
|
-
(0, cli_core_1.Injectable)()
|
|
49
|
-
], JestInitHook);
|
|
50
|
-
exports.JestInitHook = JestInitHook;
|
|
51
|
-
//# sourceMappingURL=JestInitHook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JestInitHook.js","sourceRoot":"","sources":["../../../src/hooks/JestInitHook.ts"],"names":[],"mappings":";;;;AAAA,6CAQwB;AACxB,sDAAkD;AAG3C,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEb,WAAW,CAAqB;IAGhC,WAAW,CAAqB;IAGhC,YAAY,CAAsB;IAGlC,eAAe,CAAyB;IAGlD,UAAU;QACR,OAAO;YACL;gBACE,KAAK,EAAE,yBAAyB;gBAChC,IAAI,EAAE,CAAC,GAAQ,EAAE,EAAE;oBACjB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE;wBAC9D,WAAW,EAAE,GAAG,0BAAY,OAAO;qBACpC,CAAC,CAAC;gBACL,CAAC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAzBC;IAAC,IAAA,iBAAM,GAAE;sCACc,6BAAkB;iDAAC;AAE1C;IAAC,IAAA,iBAAM,GAAE;sCACc,6BAAkB;iDAAC;AAE1C;IAAC,IAAA,iBAAM,GAAE;sCACe,8BAAmB;kDAAC;AAE5C;IAAC,IAAA,iBAAM,GAAE;sCACkB,iCAAsB;qDAAC;AAElD;IAAC,IAAA,iBAAM,EAAC,MAAM,CAAC;;;;8CAYd;AAzBU,YAAY;IADxB,IAAA,qBAAU,GAAE;GACA,YAAY,CA0BxB;AA1BY,oCAAY"}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const CliPluginJestModule_1 = require("./CliPluginJestModule");
|
|
5
|
-
tslib_1.__exportStar(require("./utils/templateDir"), exports);
|
|
6
|
-
exports.default = CliPluginJestModule_1.CliPluginJestModule;
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAA0D;AAE1D,8DAAoC;AAEpC,kBAAe,yCAAmB,CAAC"}
|
package/lib/cjs/package.json
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEMPLATE_DIR = void 0;
|
|
4
|
-
const cli_core_1 = require("@tsed/cli-core");
|
|
5
|
-
exports.TEMPLATE_DIR = (0, cli_core_1.getTemplateDirectory)(__dirname);
|
|
6
|
-
//# sourceMappingURL=templateDir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templateDir.js","sourceRoot":"","sources":["../../../src/utils/templateDir.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAEvC,QAAA,YAAY,GAAG,IAAA,+BAAoB,EAAC,SAAS,CAAC,CAAC"}
|
package/lib/esm/package.json
DELETED