Skip to content

Commit

Permalink
[WIP] backend tests working but frontend not working because angular-…
Browse files Browse the repository at this point in the history
…cli does not support monorepo yet

see angular/angular-cli/issues/7097 and angular/angular-cli/issues/3864
  • Loading branch information
maxime1992 committed Mar 4, 2018
1 parent f158d97 commit 92f591f
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 70 deletions.
6 changes: 3 additions & 3 deletions .angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "frontend/tsconfig.app.json",
"testTsconfig": "frontend/tsconfig.spec.json",
"tsconfig": "../src/tsconfig.app.json",
"testTsconfig": "../src/tsconfig.spec.json",
"prefix": "app",
"serviceWorker": false,
"styles": [
Expand Down Expand Up @@ -52,7 +52,7 @@
],
"test": {
"karma": {
"config": "./karma.conf.js"
"config": "./frontend/karma.conf.js"
}
},
"defaults": {
Expand Down
25 changes: 0 additions & 25 deletions backend/karma.conf.js

This file was deleted.

21 changes: 21 additions & 0 deletions backend/src/app.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Test } from '@nestjs/testing';

import { AppController } from './app.controller';

describe(`AppController`, () => {
let appController: AppController;

beforeEach(async () => {
const myModule = await Test.createTestingModule({
controllers: [AppController],
}).compile();

appController = myModule.get<AppController>(AppController);
});

describe(`Get /`, () => {
it(`should return "Hello World!"`, () => {
expect(appController.root()).toBe(`Hello World!`);
});
});
});
2 changes: 1 addition & 1 deletion backend/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Get, Controller } from '@nestjs/common';
import { Controller, Get } from '@nestjs/common';

@Controller()
export class AppController {
Expand Down
3 changes: 2 additions & 1 deletion backend/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Module } from '@nestjs/common';

import { AppController } from './app.controller';
import { FeaturesModule } from './features/features.module';

@Module({
imports: [],
imports: [FeaturesModule],
controllers: [AppController],
components: [],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Module } from '@nestjs/common';

@Module({
modules: [],
imports: [],
})
export class ApplicationModule {}
export class FeaturesModule {}
5 changes: 0 additions & 5 deletions backend/src/modules/app.spec.ts

This file was deleted.

14 changes: 7 additions & 7 deletions backend/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
"rules": {
"quotemark": [true, "single"],
"member-access": [false],
"ordered-imports": [false],
"ordered-imports": [true],
"member-ordering": [false],
"curly": false,
"curly": true,
"interface-name": [false],
"array-type": [false],
"array-type": [true],
"no-empty-interface": false,
"no-empty": false,
"no-empty": true,
"arrow-parens": false,
"object-literal-sort-keys": false,
"no-unused-expression": false,
"no-unused-expression": true,
"max-classes-per-file": [false],
"variable-name": [false],
"variable-name": [true],
"one-line": [false],
"one-variable-per-declaration": [false]
"one-variable-per-declaration": [true]
},
"rulesDirectory": []
}
6 changes: 6 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": ["backend/src"],
"ext": "ts",
"ignore": ["backend/src/**/*.spec.ts"],
"exec": "node backend/index.js"
}
48 changes: 34 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,37 @@
}
},
"scripts": {
"prettier": "prettier",
"//-1a": "---------------------------------------------------------------",
"//-1b": "---------------------- from node_modules ----------------------",
"//-1c": "---------------------------------------------------------------",
"ng": "ng",
"prettier": "prettier",
"tslint": "tslint",
"//-2a": "---------------------------------------------------------------",
"//-2b": "--------------------------- backend ---------------------------",
"//-2c": "---------------------------------------------------------------",
"back:start": "node backend/index.js",
"back:start:watch": "nodemon backend/index.js",
"back:prestart:prod": "tsc -p backend/tsconfig.json",
"back:start:prod": "NODE_ENV=production node backend/dist/main.js",
"back:lint:check": "tslint backend/src/**/*",
"back:start:watch": "nodemon",
"back:build:prod": "tsc -p backend/tsconfig.json",
"back:serve:prod": "NODE_ENV=production node backend/dist/main.js",
"back:lint:check": "tslint -c ./backend/tslint.json './backend/src/**/*.ts'",
"back:lint:fix": "yarn run back:lint:check --fix",
"back:check": "yarn run back:lint:check && yarn run back:prettier:check",
"back:check:fix": "yarn run back:lint:fix; yarn run back:prettier:fix",
"back:prettier:base-files": "yarn run prettier './backend/**/*.ts'",
"back:prettier:fix": "yarn run back:prettier:base-files --write",
"back:prettier:check": "yarn run back:prettier:base-files -l",
"back:test": "karma start backend/karma.conf.js ",
"back:test:watch": "yarn run back:test --auto-watch",
"back:test:coverage": "TODO",
"back:test": "ts-node --project backend/tsconfig.json node_modules/jasmine/bin/jasmine ./backend/**/*spec.ts",
"back:test:watch": "watch 'yarn run back:test' backend",
"back:test:coverage": "echo TODO",
"//-3a": "---------------------------------------------------------------",
"//-3b": "-------------------------- frontend ---------------------------",
"//-3c": "---------------------------------------------------------------",
"front:start": "yarn run ng serve",
"front:test": "yarn run ng test",
"front:test:ci": "yarn run front:test --single-run --progress=false",
"front:e2e": "yarn run ng e2e",
"front:e2e:ci": "yarn run ng e2e --prod --progress=false",
"front:cypress:open": "cypress open",
"front:cypress:ci": "cypress run",
"front:build:prod": "yarn run ng build --prod --e=prod --no-sourcemap --build-optimizer",
"front:lint:check": "yarn run ng lint --type-check",
"front:lint:fix": "yarn run front:lint:check --fix",
Expand All @@ -42,11 +50,22 @@
"front:prettier:fix": "yarn run front:prettier:base-files --write",
"front:prettier:check": "yarn run front:prettier:base-files -l",
"front:postbuild": "gulp compress",
"//-4a": "---------------------------------------------------------------",
"//-4b": "--------------------------- cypress ---------------------------",
"//-4c": "---------------------------------------------------------------",
"cy:open": "cypress open",
"cy:headless": "cypress run",
"cy:prettier:base-files": "yarn run prettier \"./cypress/**/*.{js,ts}\"",
"cy:prettier:check:fix": "yarn run front:prettier:base-files --write",
"cy:prettier:fix": "yarn run front:prettier:base-files --write",
"cy:prettier:check": "yarn run front:prettier:base-files -l",
"//-5a": "---------------------------------------------------------------",
"//-5b": "--------------------------- common ----------------------------",
"//-5c": "---------------------------------------------------------------",
"all:check": "yarn run back:check && yarn run front:check && yarn run cy:prettier:check",
"all:check:fix": "yarn run back:check:fix && yarn run front:check:fix && yarn run cy:prettier:check:fix",
"all:check:fix": "yarn run back:check:fix && yarn run front:check:fix && yarn run cy:prettier:fix",
"//-6a": "---------------------------------------------------------------",
"//-6b": "--------------------------- hooks -----------------------------",
"//-6c": "---------------------------------------------------------------",
"precommit": "lint-staged",
"prepush": "yarn run back:lint:check && yarn run front:lint:check"
},
Expand Down Expand Up @@ -118,10 +137,11 @@
"tslint": "5.9.1",
"tslint-config-prettier": "1.9.0",
"tslint-language-service": "0.9.8",
"wait-on": "2.1.0"
"wait-on": "2.1.0",
"watch": "1.0.2"
},
"resolutions": {
"@angular/core": "5.2.6",
"@angular/core": "5.2.7",
"typescript": "2.7.2"
}
}
35 changes: 23 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,6 @@
dependencies:
tslib "^1.7.1"

"@angular/[email protected]":
version "5.2.6"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-5.2.6.tgz#483fb0b720d563d3ec4d1895878249beafa39b9b"
dependencies:
tslib "^1.7.1"

"@angular/[email protected]":
version "5.2.7"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-5.2.7.tgz#e5607fc39d90f9fe4fbaaeeeb6cdb9371966bfe3"
Expand Down Expand Up @@ -3387,6 +3381,12 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
md5.js "^1.3.4"
safe-buffer "^5.1.1"

exec-sh@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.1.tgz#163b98a6e89e6b65b47c2a28d215bc1f63989c38"
dependencies:
merge "^1.1.3"

execa@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
Expand Down Expand Up @@ -4474,8 +4474,8 @@ html-entities@^1.2.0:
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f"

html-minifier@^3.2.3:
version "3.5.9"
resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.9.tgz#74424014b872598d4bb0e20ac420926ec61024b6"
version "3.5.10"
resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.10.tgz#8522c772c388db81aa5c26f62033302d906ea1c7"
dependencies:
camel-case "3.0.x"
clean-css "4.1.x"
Expand Down Expand Up @@ -5752,8 +5752,8 @@ [email protected]:
resolved "https://registry.yarnpkg.com/libqp/-/libqp-1.1.0.tgz#f5e6e06ad74b794fb5b5b66988bf728ef1dedbe8"

license-webpack-plugin@^1.0.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/license-webpack-plugin/-/license-webpack-plugin-1.1.2.tgz#283519c77ef3878f467c50fcdcf9b5760bfbcd4b"
version "1.2.3"
resolved "https://registry.yarnpkg.com/license-webpack-plugin/-/license-webpack-plugin-1.2.3.tgz#170272565db467d692ca782e4a6ad90cf81553ec"
dependencies:
ejs "^2.5.7"

Expand Down Expand Up @@ -6286,6 +6286,10 @@ [email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"

merge@^1.1.3:
version "1.2.0"
resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da"

methods@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
Expand Down Expand Up @@ -9368,8 +9372,8 @@ uglify-es@^3.3.4:
source-map "~0.6.1"

[email protected]:
version "3.3.12"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.12.tgz#efd87c16a1f4c674a8a5ede571001ef634dcc883"
version "3.3.13"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.3.13.tgz#8a1a89eeb16e2d6a66b0db2b04cb871af3c669cf"
dependencies:
commander "~2.14.1"
source-map "~0.6.1"
Expand Down Expand Up @@ -9685,6 +9689,13 @@ [email protected]:
request "^2.78.0"
rx "^4.1.0"

[email protected]:
version "1.0.2"
resolved "https://registry.yarnpkg.com/watch/-/watch-1.0.2.tgz#340a717bde765726fa0aa07d721e0147a551df0c"
dependencies:
exec-sh "^0.2.0"
minimist "^1.2.0"

watchpack@^1.4.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.5.0.tgz#231e783af830a22f8966f65c4c4bacc814072eed"
Expand Down

0 comments on commit 92f591f

Please sign in to comment.