@absterr/nestkit 0.0.0-stage → 0.1.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/LICENSE +22 -0
- package/README.md +92 -2
- package/dist/args.js +37 -0
- package/dist/choices/compat.js +15 -0
- package/dist/choices/preset.js +40 -0
- package/dist/choices/stack.js +111 -0
- package/dist/choices/testing.js +110 -0
- package/dist/choices/types.js +1 -0
- package/dist/cli.js +10 -0
- package/dist/new.js +114 -0
- package/dist/options.js +21 -0
- package/dist/overlays.js +61 -0
- package/dist/package-managers.js +23 -0
- package/dist/rules.js +19 -0
- package/dist/scaffold/esm.js +30 -0
- package/dist/scaffold/files.js +44 -0
- package/dist/scaffold/generate.js +24 -0
- package/dist/scaffold/install.js +33 -0
- package/dist/scaffold/json.js +4 -0
- package/dist/scaffold/package-json.js +62 -0
- package/dist/settings.js +52 -0
- package/dist/ui.js +24 -0
- package/dist/versions.js +33 -0
- package/package.json +53 -4
- package/templates/agent-files/11/AGENTS.md +24 -0
- package/templates/agent-files/12/AGENTS.md +39 -0
- package/templates/agent-files/common/CLAUDE.md +1 -0
- package/templates/base/README.md +70 -0
- package/templates/base/gitattributes +1 -0
- package/templates/base/gitignore +8 -0
- package/templates/base/nest-cli.json +11 -0
- package/templates/base/package.json +32 -0
- package/templates/base/src/app.controller.ts +12 -0
- package/templates/base/src/app.module.ts +10 -0
- package/templates/base/src/app.service.ts +8 -0
- package/templates/base/src/main.ts +13 -0
- package/templates/code-quality/biome/biome.json +47 -0
- package/templates/code-quality/biome/package.json +14 -0
- package/templates/code-quality/eslint/eslint.config.mjs +35 -0
- package/templates/code-quality/eslint/package.json +14 -0
- package/templates/code-quality/oxlint/.oxlintrc.json +8 -0
- package/templates/code-quality/oxlint/package.json +10 -0
- package/templates/code-quality/prettier/.prettierignore +10 -0
- package/templates/code-quality/prettier/.prettierrc +7 -0
- package/templates/code-quality/prettier/package.json +9 -0
- package/templates/e2e-tests/cypress/gitignore +2 -0
- package/templates/e2e-tests/cypress/package.json +12 -0
- package/templates/e2e-tests/cypress/test/app.cy.ts +10 -0
- package/templates/e2e-tests/cypress/test/cypress.config.mjs +9 -0
- package/templates/e2e-tests/cypress/test/tsconfig.json +8 -0
- package/templates/e2e-tests/e2e-scripts/package.json +5 -0
- package/templates/e2e-tests/e2e-scripts/scripts/test-e2e.mjs +48 -0
- package/templates/e2e-tests/playwright/gitignore +2 -0
- package/templates/e2e-tests/playwright/package.json +8 -0
- package/templates/e2e-tests/playwright/test/app.e2e-spec.ts +8 -0
- package/templates/e2e-tests/playwright/test/playwright.config.mjs +9 -0
- package/templates/e2e-tests/runner-configs/jest/test/jest-e2e.json +9 -0
- package/templates/e2e-tests/runner-configs/mocha/cjs-mocha/test/.mocharc.e2e.json +5 -0
- package/templates/e2e-tests/runner-configs/mocha/esm-mocha/test/.mocharc.e2e.json +5 -0
- package/templates/e2e-tests/runner-configs/vitest/test/vitest.config.e2e.mjs +15 -0
- package/templates/e2e-tests/selenium/jest-selenium/package.json +5 -0
- package/templates/e2e-tests/selenium/jest-selenium/test/app.e2e-spec.ts +25 -0
- package/templates/e2e-tests/selenium/mocha-selenium/package.json +5 -0
- package/templates/e2e-tests/selenium/mocha-selenium/test/app.e2e-spec.ts +28 -0
- package/templates/e2e-tests/selenium/package.json +6 -0
- package/templates/e2e-tests/selenium/vitest-selenium/package.json +5 -0
- package/templates/e2e-tests/selenium/vitest-selenium/test/app.e2e-spec.ts +26 -0
- package/templates/e2e-tests/supertest/jest-supertest/package.json +5 -0
- package/templates/e2e-tests/supertest/jest-supertest/test/app.e2e-spec.ts +29 -0
- package/templates/e2e-tests/supertest/mocha-supertest/package.json +5 -0
- package/templates/e2e-tests/supertest/mocha-supertest/test/app.e2e-spec.ts +30 -0
- package/templates/e2e-tests/supertest/package.json +6 -0
- package/templates/e2e-tests/supertest/vitest-supertest/package.json +5 -0
- package/templates/e2e-tests/supertest/vitest-supertest/test/app.e2e-spec.ts +30 -0
- package/templates/environment/arktype/package.json +5 -0
- package/templates/environment/arktype/src/config/env/env.schema.ts +12 -0
- package/templates/environment/arktype/src/config/env/validate.ts +12 -0
- package/templates/environment/class-validator/package.json +6 -0
- package/templates/environment/class-validator/src/config/env/env.schema.ts +15 -0
- package/templates/environment/class-validator/src/config/env/validate.ts +15 -0
- package/templates/environment/common/package.json +5 -0
- package/templates/environment/common/src/app.module.ts +11 -0
- package/templates/environment/common/src/config/env/env.module.ts +17 -0
- package/templates/environment/common/src/config/env/env.provider.ts +17 -0
- package/templates/environment/common/src/main.ts +15 -0
- package/templates/environment/joi/package.json +5 -0
- package/templates/environment/joi/src/config/env/env.schema.ts +16 -0
- package/templates/environment/joi/src/config/env/validate.ts +16 -0
- package/templates/environment/valibot/package.json +5 -0
- package/templates/environment/valibot/src/config/env/env.schema.ts +20 -0
- package/templates/environment/valibot/src/config/env/validate.ts +16 -0
- package/templates/environment/vanilla/src/config/env/env.schema.ts +26 -0
- package/templates/environment/vanilla/src/config/env/validate.ts +18 -0
- package/templates/environment/zod/package.json +5 -0
- package/templates/environment/zod/src/config/env/env.schema.ts +11 -0
- package/templates/environment/zod/src/config/env/validate.ts +19 -0
- package/templates/test-runners/common/package.json +5 -0
- package/templates/test-runners/jest/eslint-jest/eslint.config.mjs +36 -0
- package/templates/test-runners/jest/package.json +7 -0
- package/templates/test-runners/mocha/package.json +8 -0
- package/templates/test-runners/vitest/eslint-vitest/eslint.config.mjs +43 -0
- package/templates/test-runners/vitest/package.json +7 -0
- package/templates/unit-tests/common/gitignore +1 -0
- package/templates/unit-tests/common/nest-cli.json +8 -0
- package/templates/unit-tests/jest/jest.config.json +10 -0
- package/templates/unit-tests/jest/package.json +7 -0
- package/templates/unit-tests/jest/src/app.controller.spec.ts +22 -0
- package/templates/unit-tests/mocha/cjs-mocha/.mocharc.json +5 -0
- package/templates/unit-tests/mocha/cjs-mocha/package.json +5 -0
- package/templates/unit-tests/mocha/esm-mocha/.mocharc.json +5 -0
- package/templates/unit-tests/mocha/package.json +9 -0
- package/templates/unit-tests/mocha/src/app.controller.spec.ts +23 -0
- package/templates/unit-tests/vitest/package.json +10 -0
- package/templates/unit-tests/vitest/src/app.controller.spec.ts +23 -0
- package/templates/unit-tests/vitest/vitest.config.mjs +14 -0
- package/templates/versions/11/tsconfig.build.json +4 -0
- package/templates/versions/11/tsconfig.json +26 -0
- package/templates/versions/12/tsconfig.build.json +8 -0
- package/templates/versions/12/tsconfig.json +27 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Module } from "@nestjs/common";
|
|
2
|
+
import { EnvModule } from "./config/env/env.module";
|
|
3
|
+
import { AppController } from "./app.controller";
|
|
4
|
+
import { AppService } from "./app.service";
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
imports: [EnvModule],
|
|
8
|
+
controllers: [AppController],
|
|
9
|
+
providers: [AppService],
|
|
10
|
+
})
|
|
11
|
+
export class AppModule {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Module } from "@nestjs/common";
|
|
2
|
+
import { ConfigModule } from "@nestjs/config";
|
|
3
|
+
import { EnvProvider } from "./env.provider";
|
|
4
|
+
import validate from "./validate";
|
|
5
|
+
|
|
6
|
+
@Module({
|
|
7
|
+
imports: [
|
|
8
|
+
ConfigModule.forRoot({
|
|
9
|
+
validate,
|
|
10
|
+
isGlobal: true,
|
|
11
|
+
envFilePath: [".env.local", ".env"],
|
|
12
|
+
}),
|
|
13
|
+
],
|
|
14
|
+
providers: [EnvProvider],
|
|
15
|
+
exports: [EnvProvider],
|
|
16
|
+
})
|
|
17
|
+
export class EnvModule {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Injectable } from "@nestjs/common";
|
|
2
|
+
import { ConfigService } from "@nestjs/config";
|
|
3
|
+
import { type EnvironmentVariables } from "./env.schema";
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class EnvProvider {
|
|
7
|
+
constructor(private configService: ConfigService<EnvironmentVariables>) {}
|
|
8
|
+
|
|
9
|
+
get<T extends keyof EnvironmentVariables>(key: T) {
|
|
10
|
+
const value = this.configService.get(key, { infer: true });
|
|
11
|
+
if (value === undefined) {
|
|
12
|
+
throw new Error(`Config error: ${key} is undefined`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NestFactory } from "@nestjs/core";
|
|
2
|
+
import { AppModule } from "./app.module";
|
|
3
|
+
import { EnvProvider } from "./config/env/env.provider";
|
|
4
|
+
|
|
5
|
+
async function bootstrap() {
|
|
6
|
+
const app = await NestFactory.create(AppModule);
|
|
7
|
+
const env = app.get(EnvProvider);
|
|
8
|
+
const PORT = env.get("PORT");
|
|
9
|
+
await app.listen(PORT);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
bootstrap().catch((err) => {
|
|
13
|
+
console.error(err);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
|
|
3
|
+
// Include the env type in this interface
|
|
4
|
+
export interface EnvironmentVariables {
|
|
5
|
+
NODE_ENV: "development" | "production" | "test";
|
|
6
|
+
PORT: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Add environment variables types here
|
|
10
|
+
export const envSchema = Joi.object({
|
|
11
|
+
NODE_ENV: Joi.string()
|
|
12
|
+
.valid("development", "production", "test")
|
|
13
|
+
.default("development"),
|
|
14
|
+
|
|
15
|
+
PORT: Joi.number().integer().min(1).max(65535).default(3000),
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
import { envSchema } from "./env.schema";
|
|
3
|
+
|
|
4
|
+
export default function validate(config: Record<string, unknown>) {
|
|
5
|
+
const result: Joi.ValidationResult<Record<string, unknown>> =
|
|
6
|
+
envSchema.validate(config, {
|
|
7
|
+
allowUnknown: true,
|
|
8
|
+
abortEarly: false,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
if (result.error) {
|
|
12
|
+
throw new Error(`Config validation error:\n${result.error.message}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return result.value;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
|
|
3
|
+
const port = v.pipe(
|
|
4
|
+
v.unknown(),
|
|
5
|
+
v.transform(Number),
|
|
6
|
+
v.integer(),
|
|
7
|
+
v.minValue(1),
|
|
8
|
+
v.maxValue(65535)
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
// Add environment variables types here
|
|
12
|
+
export const envSchema = v.object({
|
|
13
|
+
NODE_ENV: v.optional(
|
|
14
|
+
v.picklist(["development", "production", "test"]),
|
|
15
|
+
"development"
|
|
16
|
+
),
|
|
17
|
+
PORT: v.optional(port, 3000),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type EnvironmentVariables = v.InferOutput<typeof envSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { envSchema } from "./env.schema";
|
|
3
|
+
|
|
4
|
+
export default function validate(config: Record<string, unknown>) {
|
|
5
|
+
const result = v.safeParse(envSchema, config, { abortPipeEarly: true });
|
|
6
|
+
|
|
7
|
+
if (!result.success) {
|
|
8
|
+
const formatted = result.issues.map(formatIssue).join("\n");
|
|
9
|
+
throw new Error(`Config validation error:\n${formatted}`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return result.output;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const formatIssue = (issue: v.BaseIssue<unknown>) =>
|
|
16
|
+
`${v.getDotPath(issue)}: ${issue.message}`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Add environment variables types and rules here
|
|
2
|
+
export const envSchema = {
|
|
3
|
+
NODE_ENV: {
|
|
4
|
+
default: "development" as const,
|
|
5
|
+
validate: (value: unknown) =>
|
|
6
|
+
["development", "production", "test"].includes(String(value)),
|
|
7
|
+
},
|
|
8
|
+
PORT: {
|
|
9
|
+
default: 3000,
|
|
10
|
+
validate: (value: unknown) => {
|
|
11
|
+
const port = Number(value);
|
|
12
|
+
return Number.isInteger(port) && port >= 1 && port <= 65535;
|
|
13
|
+
},
|
|
14
|
+
transform: Number,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type Schema = typeof envSchema;
|
|
19
|
+
|
|
20
|
+
export type EnvironmentVariables = {
|
|
21
|
+
[K in keyof Schema]: Schema[K]["default"] extends string
|
|
22
|
+
? Schema[K]["default"] extends "development"
|
|
23
|
+
? "development" | "production" | "test"
|
|
24
|
+
: Schema[K]["default"]
|
|
25
|
+
: number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type EnvironmentVariables, envSchema } from "./env.schema";
|
|
2
|
+
|
|
3
|
+
export default function validate(config: Record<string, unknown>) {
|
|
4
|
+
const result: Record<string, unknown> = {};
|
|
5
|
+
|
|
6
|
+
for (const [key, rule] of Object.entries(envSchema)) {
|
|
7
|
+
const value = config[key] ?? rule.default;
|
|
8
|
+
const parsed = "transform" in rule ? rule.transform(value) : value;
|
|
9
|
+
|
|
10
|
+
if (!rule.validate(parsed)) {
|
|
11
|
+
throw new Error(`Config validation error: ${key} is invalid`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
result[key] = parsed;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return result as EnvironmentVariables;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// Add environment variables types here
|
|
4
|
+
export const envSchema = z.object({
|
|
5
|
+
NODE_ENV: z
|
|
6
|
+
.enum(["development", "production", "test"])
|
|
7
|
+
.default("development"),
|
|
8
|
+
PORT: z.coerce.number().int().min(1).max(65535).default(3000),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type EnvironmentVariables = z.infer<typeof envSchema>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { envSchema } from "./env.schema";
|
|
3
|
+
|
|
4
|
+
export default function validate(config: Record<string, unknown>) {
|
|
5
|
+
const parsed = envSchema.safeParse(config);
|
|
6
|
+
|
|
7
|
+
if (!parsed.success) {
|
|
8
|
+
const formatted = formatZodIssues(parsed.error.issues);
|
|
9
|
+
throw new Error(`Config validation error:\n${formatted}`);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return parsed.data;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const formatZodIssue = (issue: z.core.$ZodIssue) =>
|
|
16
|
+
`${issue.path.join(".")}: ${issue.message}`;
|
|
17
|
+
|
|
18
|
+
const formatZodIssues = (issues: z.core.$ZodIssue[]) =>
|
|
19
|
+
issues.map(formatZodIssue).join("\n");
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import eslint from "@eslint/js";
|
|
3
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
4
|
+
import { defineConfig } from "eslint/config";
|
|
5
|
+
import globals from "globals";
|
|
6
|
+
import tseslint from "typescript-eslint";
|
|
7
|
+
|
|
8
|
+
export default defineConfig(
|
|
9
|
+
{
|
|
10
|
+
ignores: ["eslint.config.mjs", "**/*.mjs", "dist/**"],
|
|
11
|
+
},
|
|
12
|
+
eslint.configs.recommended,
|
|
13
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
14
|
+
eslintPluginPrettierRecommended,
|
|
15
|
+
{
|
|
16
|
+
languageOptions: {
|
|
17
|
+
globals: {
|
|
18
|
+
...globals.node,
|
|
19
|
+
...globals.jest,
|
|
20
|
+
},
|
|
21
|
+
sourceType: "commonjs",
|
|
22
|
+
parserOptions: {
|
|
23
|
+
projectService: true,
|
|
24
|
+
tsconfigRootDir: import.meta.dirname,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
rules: {
|
|
30
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
31
|
+
"@typescript-eslint/no-floating-promises": "warn",
|
|
32
|
+
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
33
|
+
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import eslint from "@eslint/js";
|
|
3
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
4
|
+
import { defineConfig } from "eslint/config";
|
|
5
|
+
import globals from "globals";
|
|
6
|
+
import tseslint from "typescript-eslint";
|
|
7
|
+
|
|
8
|
+
export default defineConfig(
|
|
9
|
+
{
|
|
10
|
+
ignores: ["eslint.config.mjs", "**/*.mjs", "dist/**"],
|
|
11
|
+
},
|
|
12
|
+
eslint.configs.recommended,
|
|
13
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
14
|
+
eslintPluginPrettierRecommended,
|
|
15
|
+
{
|
|
16
|
+
languageOptions: {
|
|
17
|
+
globals: {
|
|
18
|
+
...globals.node,
|
|
19
|
+
},
|
|
20
|
+
sourceType: "commonjs",
|
|
21
|
+
parserOptions: {
|
|
22
|
+
projectService: true,
|
|
23
|
+
tsconfigRootDir: import.meta.dirname,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
rules: {
|
|
29
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
30
|
+
"@typescript-eslint/no-floating-promises": "warn",
|
|
31
|
+
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
32
|
+
"prettier/prettier": ["error", { endOfLine: "auto" }],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
files: ["src/**/*.spec.ts", "test/**/*.ts"],
|
|
37
|
+
rules: {
|
|
38
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
39
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
40
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/coverage
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Test, TestingModule } from "@nestjs/testing";
|
|
2
|
+
import { AppController } from "./app.controller";
|
|
3
|
+
import { AppService } from "./app.service";
|
|
4
|
+
|
|
5
|
+
describe("AppController", () => {
|
|
6
|
+
let appController: AppController;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const app: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [AppController],
|
|
11
|
+
providers: [AppService],
|
|
12
|
+
}).compile();
|
|
13
|
+
|
|
14
|
+
appController = app.get<AppController>(AppController);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe("root", () => {
|
|
18
|
+
it('should return "Hello World!"', () => {
|
|
19
|
+
expect(appController.getHello()).toBe("Hello World!");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Test, TestingModule } from "@nestjs/testing";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { AppController } from "./app.controller";
|
|
4
|
+
import { AppService } from "./app.service";
|
|
5
|
+
|
|
6
|
+
describe("AppController", () => {
|
|
7
|
+
let appController: AppController;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
const app: TestingModule = await Test.createTestingModule({
|
|
11
|
+
controllers: [AppController],
|
|
12
|
+
providers: [AppService],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
appController = app.get<AppController>(AppController);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe("root", () => {
|
|
19
|
+
it('should return "Hello World!"', () => {
|
|
20
|
+
assert.equal(appController.getHello(), "Hello World!");
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Test, TestingModule } from "@nestjs/testing";
|
|
2
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
3
|
+
import { AppController } from "./app.controller";
|
|
4
|
+
import { AppService } from "./app.service";
|
|
5
|
+
|
|
6
|
+
describe("AppController", () => {
|
|
7
|
+
let appController: AppController;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
const app: TestingModule = await Test.createTestingModule({
|
|
11
|
+
controllers: [AppController],
|
|
12
|
+
providers: [AppService],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
appController = app.get<AppController>(AppController);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe("root", () => {
|
|
19
|
+
it('should return "Hello World!"', () => {
|
|
20
|
+
expect(appController.getHello()).toBe("Hello World!");
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import swc from "unplugin-swc";
|
|
2
|
+
import { defineConfig } from "vitest/config";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
swc.vite({
|
|
7
|
+
module: { type: "es6" },
|
|
8
|
+
}),
|
|
9
|
+
],
|
|
10
|
+
test: {
|
|
11
|
+
environment: "node",
|
|
12
|
+
include: ["src/**/*.spec.ts"],
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "nodenext",
|
|
4
|
+
"moduleResolution": "nodenext",
|
|
5
|
+
"resolvePackageJsonExports": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"removeComments": true,
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"target": "ES2023",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"outDir": "./dist",
|
|
16
|
+
"baseUrl": "./",
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"strictNullChecks": true,
|
|
20
|
+
"forceConsistentCasingInFileNames": true,
|
|
21
|
+
"noImplicitAny": false,
|
|
22
|
+
"strictBindCallApply": false,
|
|
23
|
+
"noFallthroughCasesInSwitch": false
|
|
24
|
+
},
|
|
25
|
+
"include": ["src/**/*", "test/**/*"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "nodenext",
|
|
4
|
+
"moduleResolution": "nodenext",
|
|
5
|
+
"resolvePackageJsonExports": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"removeComments": true,
|
|
10
|
+
"emitDecoratorMetadata": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"target": "ES2023",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"outDir": "./dist",
|
|
16
|
+
"rootDir": "./",
|
|
17
|
+
"types": ["node"],
|
|
18
|
+
"incremental": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"strictNullChecks": true,
|
|
21
|
+
"forceConsistentCasingInFileNames": true,
|
|
22
|
+
"noImplicitAny": false,
|
|
23
|
+
"strictBindCallApply": false,
|
|
24
|
+
"noFallthroughCasesInSwitch": false
|
|
25
|
+
},
|
|
26
|
+
"include": ["src/**/*", "test/**/*"]
|
|
27
|
+
}
|