Merge pull request #15 from alsoicode/master
Update Sample Project with Test
This commit is contained in:
commit
3229d43b46
12
README.md
12
README.md
|
|
@ -10,6 +10,7 @@
|
|||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
|
|
@ -27,8 +28,8 @@
|
|||
|
||||
## Description
|
||||
|
||||
[Nest](https://github.com/nestjs/nest) framework **TypeScript** starter repository.
|
||||
|
||||
[Nest](https://github.com/nestjs/nest) framework **TypeScript** starter repository.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
|
|
@ -41,11 +42,16 @@ $ npm install
|
|||
$ npm run start
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
```
|
||||
$ npm run test
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://opencollective.com/nest).
|
||||
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
|
|
|
|||
20
package.json
20
package.json
|
|
@ -7,7 +7,8 @@
|
|||
"start": "node index.js",
|
||||
"start:watch": "nodemon",
|
||||
"prestart:prod": "tsc",
|
||||
"start:prod": "node dist/main.js"
|
||||
"start:prod": "node dist/server.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^4.5.9",
|
||||
|
|
@ -20,10 +21,27 @@
|
|||
"typescript": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.0.39",
|
||||
"@types/jest": "^21.1.8",
|
||||
"@types/node": "^9.3.0",
|
||||
"@types/supertest": "^2.0.4",
|
||||
"jest": "^21.2.1",
|
||||
"nodemon": "^1.14.1",
|
||||
"supertest": "^3.0.0",
|
||||
"tslint": "5.3.2",
|
||||
"ts-jest": "^21.2.4",
|
||||
"ts-node": "^4.1.0",
|
||||
"tsconfig-paths": "^3.1.1"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
"ts"
|
||||
],
|
||||
"testRegex": ".spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { ApplicationModule } from './app.module';
|
||||
|
||||
describe('Basic E2E Test', () => {
|
||||
const server = express();
|
||||
|
||||
beforeAll(async () => {
|
||||
const module = await Test.createTestingModule({
|
||||
modules: [ApplicationModule]
|
||||
})
|
||||
.compile();
|
||||
|
||||
const app = module.createNestApplication(server);
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it('/GET /', () => {
|
||||
return request(server)
|
||||
.get('/')
|
||||
.expect(200)
|
||||
.expect('Hello World!');
|
||||
});
|
||||
});
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
"noImplicitAny": false,
|
||||
"removeComments": true,
|
||||
"noLib": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "es6",
|
||||
|
|
@ -19,4 +20,4 @@
|
|||
"node_modules",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue