c-new-test-njs 1.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/bin/index.js +23 -0
- package/package.json +15 -0
- package/templates/test-nest-js-app/.prettierrc +4 -0
- package/templates/test-nest-js-app/README.md +98 -0
- package/templates/test-nest-js-app/eslint.config.mjs +34 -0
- package/templates/test-nest-js-app/nest-cli.json +8 -0
- package/templates/test-nest-js-app/package-lock.json +11301 -0
- package/templates/test-nest-js-app/package.json +73 -0
- package/templates/test-nest-js-app/src/app.controller.spec.ts +22 -0
- package/templates/test-nest-js-app/src/app.controller.ts +12 -0
- package/templates/test-nest-js-app/src/app.module.ts +10 -0
- package/templates/test-nest-js-app/src/app.service.ts +8 -0
- package/templates/test-nest-js-app/src/main.ts +8 -0
- package/templates/test-nest-js-app/test/app.e2e-spec.ts +25 -0
- package/templates/test-nest-js-app/test/jest-e2e.json +9 -0
- package/templates/test-nest-js-app/tsconfig.build.json +4 -0
- package/templates/test-nest-js-app/tsconfig.json +21 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "test-nest-js-app",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"author": "",
|
|
6
|
+
"private": true,
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "nest build",
|
|
10
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
11
|
+
"start": "nest start",
|
|
12
|
+
"start:dev": "nest start --watch",
|
|
13
|
+
"start:debug": "nest start --debug --watch",
|
|
14
|
+
"start:prod": "node dist/main",
|
|
15
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
16
|
+
"test": "jest",
|
|
17
|
+
"test:watch": "jest --watch",
|
|
18
|
+
"test:cov": "jest --coverage",
|
|
19
|
+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
20
|
+
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@nestjs/common": "^11.0.1",
|
|
24
|
+
"@nestjs/core": "^11.0.1",
|
|
25
|
+
"@nestjs/platform-express": "^11.0.1",
|
|
26
|
+
"reflect-metadata": "^0.2.2",
|
|
27
|
+
"rxjs": "^7.8.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
31
|
+
"@eslint/js": "^9.18.0",
|
|
32
|
+
"@nestjs/cli": "^11.0.0",
|
|
33
|
+
"@nestjs/schematics": "^11.0.0",
|
|
34
|
+
"@nestjs/testing": "^11.0.1",
|
|
35
|
+
"@swc/cli": "^0.6.0",
|
|
36
|
+
"@swc/core": "^1.10.7",
|
|
37
|
+
"@types/express": "^5.0.0",
|
|
38
|
+
"@types/jest": "^29.5.14",
|
|
39
|
+
"@types/node": "^22.10.7",
|
|
40
|
+
"@types/supertest": "^6.0.2",
|
|
41
|
+
"eslint": "^9.18.0",
|
|
42
|
+
"eslint-config-prettier": "^10.0.1",
|
|
43
|
+
"eslint-plugin-prettier": "^5.2.2",
|
|
44
|
+
"globals": "^16.0.0",
|
|
45
|
+
"jest": "^29.7.0",
|
|
46
|
+
"prettier": "^3.4.2",
|
|
47
|
+
"source-map-support": "^0.5.21",
|
|
48
|
+
"supertest": "^7.0.0",
|
|
49
|
+
"ts-jest": "^29.2.5",
|
|
50
|
+
"ts-loader": "^9.5.2",
|
|
51
|
+
"ts-node": "^10.9.2",
|
|
52
|
+
"tsconfig-paths": "^4.2.0",
|
|
53
|
+
"typescript": "^5.7.3",
|
|
54
|
+
"typescript-eslint": "^8.20.0"
|
|
55
|
+
},
|
|
56
|
+
"jest": {
|
|
57
|
+
"moduleFileExtensions": [
|
|
58
|
+
"js",
|
|
59
|
+
"json",
|
|
60
|
+
"ts"
|
|
61
|
+
],
|
|
62
|
+
"rootDir": "src",
|
|
63
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
64
|
+
"transform": {
|
|
65
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
66
|
+
},
|
|
67
|
+
"collectCoverageFrom": [
|
|
68
|
+
"**/*.(t|j)s"
|
|
69
|
+
],
|
|
70
|
+
"coverageDirectory": "../coverage",
|
|
71
|
+
"testEnvironment": "node"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -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,12 @@
|
|
|
1
|
+
import { Controller, Get } from '@nestjs/common';
|
|
2
|
+
import { AppService } from './app.service';
|
|
3
|
+
|
|
4
|
+
@Controller()
|
|
5
|
+
export class AppController {
|
|
6
|
+
constructor(private readonly appService: AppService) {}
|
|
7
|
+
|
|
8
|
+
@Get()
|
|
9
|
+
getHello(): string {
|
|
10
|
+
return this.appService.getHello();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { INestApplication } from '@nestjs/common';
|
|
3
|
+
import * as request from 'supertest';
|
|
4
|
+
import { App } from 'supertest/types';
|
|
5
|
+
import { AppModule } from './../src/app.module';
|
|
6
|
+
|
|
7
|
+
describe('AppController (e2e)', () => {
|
|
8
|
+
let app: INestApplication<App>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
12
|
+
imports: [AppModule],
|
|
13
|
+
}).compile();
|
|
14
|
+
|
|
15
|
+
app = moduleFixture.createNestApplication();
|
|
16
|
+
await app.init();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('/ (GET)', () => {
|
|
20
|
+
return request(app.getHttpServer())
|
|
21
|
+
.get('/')
|
|
22
|
+
.expect(200)
|
|
23
|
+
.expect('Hello World!');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"removeComments": true,
|
|
6
|
+
"emitDecoratorMetadata": true,
|
|
7
|
+
"experimentalDecorators": true,
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"target": "ES2023",
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"incremental": true,
|
|
14
|
+
"skipLibCheck": true,
|
|
15
|
+
"strictNullChecks": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"noImplicitAny": false,
|
|
18
|
+
"strictBindCallApply": false,
|
|
19
|
+
"noFallthroughCasesInSwitch": false
|
|
20
|
+
}
|
|
21
|
+
}
|