Skip to content

Commit

Permalink
Enable lint test by default in Travis and AppVeyor (lunchclass#528)
Browse files Browse the repository at this point in the history
This change fixes all lint errors in the current implementation and then
enable lint test by default in Travis and AppVeyor to prevent unexpected
behaviors and errors.

ISSUE=lunchclass#467
  • Loading branch information
romandev authored Nov 13, 2017
1 parent d9e0818 commit 654436b
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ branches:
- master

test_script:
- absolute test
- absolute lint && absolute test
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ install:
- ./absolute node -v

script:
- ./absolute test
- ./absolute lint && ./absolute test
7 changes: 4 additions & 3 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ gulp.task('lint:fix', () => {
gulp.task('test', ['webpack'], runCommand('jest'));

gulp.task('run_server', () => {
process.env.NODE_PATH = "out/";
nodemon({
script: 'out/server.js',
script: 'out/server/server.js',
ignore: ['out/']
});
});
Expand All @@ -73,7 +74,7 @@ gulp.task('build_server', () => {
return tsProject.src()
.pipe(tsProject())
.js
.pipe(gulp.dest('out/'));
.pipe(gulp.dest('out/server/'));
});

const mongodb_path = './third_party/mongodb';
Expand All @@ -88,4 +89,4 @@ function runCommand(command: string) {
cb(error);
});
}
}
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"webpack-stream": "^4.0.0"
},
"jest": {
"moduleDirectories": [
".",
"node_modules"
],
"moduleFileExtensions": [
"js",
"json",
Expand Down
2 changes: 1 addition & 1 deletion server/base/application.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import {} from 'jest';
import {Application} from 'server/base/application';
import * as supertest from 'supertest';
import {Application} from '../base/application';

test('GET /', async() => {
const request: {} = supertest(await Application.START_FOR_TESTING());
Expand Down
7 changes: 6 additions & 1 deletion server/base/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import * as express from 'express';
import * as path from 'path';

/**
* Application
*/
export class Application {
private static app: express.Application = express();

Expand All @@ -29,13 +32,15 @@ export class Application {
public static async START_FOR_TESTING(): Promise<express.Application> {
await import('../example/example.router');
this.app.use(express.static(path.join(__dirname, '../../out/client')));

return this.app;
}

public static ROUTE(url: string) {
public static ROUTE(url: string): Function {
const app: express.Application = this.app;

return <T>(routerClass: { new(...args: {}[]): T}): void => {
// tslint:disable-next-line
const routerHandler: any = new routerClass();
const router: express.Router = express.Router();

Expand Down
7 changes: 5 additions & 2 deletions server/example/example.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
*/

import * as express from 'express';
import {Application} from '../base/application';
import {Application} from 'server/base/application';

/**
* ExampleRouter
*/
@Application.ROUTE('/example')
export class Test {
export class ExampleRouter {
public get(request: express.Request, response: express.Response): void {
response.send('hello world');
}
Expand Down
2 changes: 1 addition & 1 deletion server/example/example.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import {} from 'jest';
import {Application} from 'server/base/application';
import * as supertest from 'supertest';
import {Application} from '../base/application';

test('GET /example', async() => {
const request: {} = supertest(await Application.START_FOR_TESTING());
Expand Down
2 changes: 1 addition & 1 deletion server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
* limitations under the License.
*/

import {Application} from './base/application';
import {Application} from 'server/base/application';

Application.START();
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compileOnSave": true,
"compilerOptions": {
"baseUrl": ".",
"experimentalDecorators": true,
"lib": ["webworker", "es6", "scripthost"],
"noImplicitAny": true,
Expand Down
8 changes: 7 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "tslint-microsoft-contrib"
"extends": "tslint-microsoft-contrib",
"rules": {
"export-name": false,
"no-backbone-get-set-outside-model": false,
"no-reserved-keywords": false,
"no-stateless-class": false
}
}

0 comments on commit 654436b

Please sign in to comment.