Travis integration & example

This commit is contained in:
kamil.mysliwiec
2017-02-05 23:10:43 +01:00
parent 9ec2d6cbc7
commit 14b42280e8
10 changed files with 59 additions and 5 deletions

1
.gitignore vendored
View File

@@ -9,5 +9,4 @@
npm-debug.log
# example
/example
/quick-start

View File

@@ -7,4 +7,4 @@ before_install:
- sh -e /etc/init.d/xvfb start
script:
- npm test
- npm run build
- npm run compile

13
example/app.ts Normal file
View File

@@ -0,0 +1,13 @@
import { NestApplication } from "./../src/";
export class Application implements NestApplication {
constructor(private app) {}
start() {
this.app.listen(3030, () => {
console.log("Application listen on port:", 3030);
});
}
}

View File

@@ -0,0 +1,7 @@
import { UsersModule } from "./users/users.module";
import { Module } from "./../../src/";
@Module({
modules: [ UsersModule ]
})
export class ApplicationModule {}

View File

@@ -0,0 +1,4 @@
import { Component } from "./../../../src/";
@Component()
export class UsersQueryService {}

View File

@@ -0,0 +1,9 @@
import { UsersRoute } from "./users.route";
import { UsersQueryService } from "./users-query.service";
import { Module } from "./../../../src/";
@Module({
controllers: [ UsersRoute ],
components: [ UsersQueryService ]
})
export class UsersModule {}

View File

@@ -0,0 +1,16 @@
import { Request, Response, NextFunction } from "express";
import { UsersQueryService } from "./users-query.service";
import { RequestMethod, Controller, RequestMapping } from "./../../../src/";
@Controller({ path: "users" })
export class UsersRoute {
constructor(private usersQueryService: UsersQueryService) {}
@RequestMapping({
path: "/",
method: RequestMethod.GET
})
getAllUsers(req: Request, res: Response, next: NextFunction) {}
}

5
example/server.ts Normal file
View File

@@ -0,0 +1,5 @@
import { NestRunner } from "./../src/";
import { Application } from "./app";
import { ApplicationModule } from "./modules/app.module";
NestRunner.run(Application, ApplicationModule);

View File

@@ -3,7 +3,7 @@ const webpackConfig = require('./webpack.config.test');
module.exports = function (config) {
config.set({
browsers: [ 'Chrome', 'ChromeCanary' ],
browsers: [ 'Firefox' ],
colors: true,
reporters: [ 'mocha' ],
frameworks: [ 'mocha', 'chai', 'sinon' ],
@@ -14,12 +14,12 @@ module.exports = function (config) {
'tests.webpack.js': [ 'webpack' ]
},
webpack: webpackConfig,
customLaunchers: {
/*customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
},*/
singleRun: true
});

View File

@@ -34,6 +34,7 @@
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.2",
"karma-sinon": "^1.0.5",