Skip to content

Commit

Permalink
feat(api): merged e2e projects into parent project
Browse files Browse the repository at this point in the history
merged api, api-e2e projects and wepapp and webapp-e2e projects

nrwl/nx#1098
  • Loading branch information
xmlking committed May 10, 2019
1 parent 7f53ed7 commit 195ef66
Show file tree
Hide file tree
Showing 32 changed files with 434 additions and 334 deletions.
10 changes: 5 additions & 5 deletions PLAYBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ ng g workspace-schematic store
# *** always delete ./dist folder when you change schematic implementation ***
yarn workspace-schematic store models/sumoDemo -- --project=grid -d
# build workspace tools
yarn workspace tools schematic:build
yarn workspace @ngx-starter-kit/tools build
```

### Install
Expand Down Expand Up @@ -607,13 +607,13 @@ ng test <module>
### E2E Test

```bash
ng e2e webapp-e2e
ng e2e webapp
# headless tests (CI)
ng e2e webapp-e2e --headless
ng e2e webapp --headless
# Production target
ng e2e webapp-e2e --prod
ng e2e webapp --prod
# Watching for changes
ng e2e webapp-e2e --watch
ng e2e webapp --watch
```

### Serve from dist
Expand Down
62 changes: 25 additions & 37 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["apps/webapp/tsconfig.app.json", "apps/webapp/tsconfig.spec.json"],
"tsConfig": [
"apps/webapp/tsconfig.app.json",
"apps/webapp/tsconfig.spec.json",
"apps/webapp/e2e/tsconfig.json"
],
"exclude": ["**/node_modules/**", "**/*.json"]
}
},
Expand All @@ -193,33 +197,19 @@
"tsConfig": "apps/webapp/tsconfig.spec.json",
"setupFile": "apps/webapp/src/test-setup.ts"
}
}
}
},
"webapp-e2e": {
"root": "apps/webapp-e2e",
"sourceRoot": "apps/webapp-e2e/src",
"projectType": "application",
"architect": {
},
"e2e": {
"builder": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/webapp-e2e/cypress.json",
"tsConfig": "apps/webapp-e2e/tsconfig.e2e.json",
"cypressConfig": "apps/webapp/e2e/cypress.json",
"tsConfig": "apps/webapp/e2e/tsconfig.json",
"devServerTarget": "webapp:serve"
},
"configurations": {
"production": {
"devServerTarget": "webapp:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "apps/webapp-e2e/tsconfig.e2e.json",
"exclude": ["**/node_modules/**", "**/*.json"]
}
}
}
},
Expand Down Expand Up @@ -284,7 +274,7 @@
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["apps/api/tsconfig.app.json", "apps/api/tsconfig.spec.json"],
"tsConfig": ["apps/api/tsconfig.app.json", "apps/api/tsconfig.spec.json", "apps/api/e2e/tsconfig.json"],
"exclude": ["**/node_modules/**", "**/*.json"]
}
},
Expand All @@ -294,28 +284,26 @@
"jestConfig": "apps/api/jest.config.js",
"tsConfig": "apps/api/tsconfig.spec.json"
}
}
}
},
"api-e2e": {
"root": "apps/api-e2e",
"sourceRoot": "apps/api-e2e/src",
"projectType": "application",
"prefix": "api",
"schematics": {},
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "apps/api-e2e/tsconfig.e2e.json",
"exclude": ["**/node_modules/**", "**/*.json"]
}
},
"e2e": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/api-e2e/jest.config.js",
"tsConfig": "apps/api-e2e/tsconfig.e2e.json"
"jestConfig": "apps/api/e2e/jest.config.js",
"tsConfig": "apps/api/e2e/tsconfig.json"
}
},
"typeorm": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"commands": [
{
"command": "echo $PWD"
},
{
"command": "ts-node -r tsconfig-paths/register --project apps/api/tsconfig.app.json node_modules/.bin/typeorm migration:create"
}
],
"parallel": false
}
}
}
Expand Down
12 changes: 0 additions & 12 deletions apps/api-e2e/tsconfig.e2e.json

This file was deleted.

9 changes: 0 additions & 9 deletions apps/api-e2e/tsconfig.json

This file was deleted.

12 changes: 0 additions & 12 deletions apps/api-e2e/tsconfig.spec.json

This file was deleted.

7 changes: 0 additions & 7 deletions apps/api-e2e/tslint.json

This file was deleted.

12 changes: 7 additions & 5 deletions apps/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ node dist/apps/api/main.js
```bash
ng build api --prod
# or
yarn workspace @ngx-starter-kit/api build:prod
```

### Commands
```bash
# to run custom commands, `check api:sumo in angular.json`
ng run api:sumo
# to run custom commands, `check api:typeorm in angular.json`
ng run api:typeorm
```

### Generate
Expand Down Expand Up @@ -126,11 +128,11 @@ ng test api --runInBand
### E2E Test

```bash
ng e2e api-e2e
ng e2e api
# e2e test with watch mode
ng e2e api-e2e --watch
ng e2e api --watch
# e2e test in CI env
ng e2e api-e2e --forceExit --detectOpenHandles
ng e2e api --forceExit --detectOpenHandles
```

### Reference
Expand Down
4 changes: 2 additions & 2 deletions apps/api-e2e/jest.config.js → apps/api/e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
name: "api-e2e",
preset: "../../jest.config.js",
preset: "../../../jest.config.js",
testMatch: ["**/+(*.)+(e2e-spec|e2e-test).+(ts|js)?(x)"],
coverageDirectory: "../../coverage/apps/api-e2e",
coverageDirectory: "../../../coverage/apps/api-e2e",
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import * as request from 'supertest';
import { Test } from '@nestjs/testing';
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
// @ts-ignore
import { AppModule } from 'api/src/app/app.module';
require('require-context/register');
import { AppModule } from '../../src/app/app.module';

jest.setTimeout(30000);

describe('AppController (e2e)', () => {
let app: INestApplication;

beforeAll(async () => {
const moduleFixture = await Test.createTestingModule({
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();

Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/api/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/apps/api-e2e",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["src/**/*.e2e-spec.ts", "src/**/*.d.ts"]
}
6 changes: 3 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"typeorm:create": "typeorm migration:create",
"typeorm:preserve": "yarn typeorm:sync -- -f=ormconfig && yarn typeorm:seeds -- -f=ormconfig",
"start": "ts-node -r tsconfig-paths/register --project apps/api/tsconfig.app.json src/main.ts",
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json"
"build": "ng build api",
"build:prod": "ng build api --prod"
},
"dependencies": {
"@godaddy/terminus": "^4.1.0",
Expand Down Expand Up @@ -40,7 +40,7 @@
"pg": "^7.10.0",
"pug": "^2.0.3",
"reflect-metadata": "^0.1.13",
"rxjs": "^6.5.1",
"rxjs": "^6.5.2",
"sharp": "^0.22.1",
"swagger-ui-express": "^4.0.2",
"typeorm": "^0.2.17",
Expand Down
4 changes: 2 additions & 2 deletions apps/api/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"target": "es2017",
"types": ["node"]
},
"exclude": ["**/*.spec.ts"],
"include": ["**/*.ts"]
"exclude": ["src/**/*.spec.ts"],
"include": ["src/**/*.ts"]
}
2 changes: 1 addition & 1 deletion apps/api/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
}
11 changes: 0 additions & 11 deletions apps/webapp-e2e/cypress.json

This file was deleted.

8 changes: 0 additions & 8 deletions apps/webapp-e2e/tsconfig.e2e.json

This file was deleted.

7 changes: 0 additions & 7 deletions apps/webapp-e2e/tsconfig.json

This file was deleted.

11 changes: 11 additions & 0 deletions apps/webapp/e2e/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"fileServerFolder": "../../../dist/apps/webapp-e2e",
"fixturesFolder": "../../../dist/apps/webapp-e2e/src/fixtures",
"integrationFolder": "../../../dist/apps/webapp-e2e/src/integration",
"pluginsFile": "../../../dist/apps/webapp-e2e/src/plugins/index.js",
"supportFile": false,
"video": true,
"videosFolder": "../../../dist/apps/webapp-e2e/videos",
"screenshotsFolder": "../../../dist/apps/webapp-e2e/screenshots",
"chromeWebSecurity": false
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/webapp/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../../dist/apps/webapp-e2e/src",
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts"]
}
4 changes: 2 additions & 2 deletions apps/webapp/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"angularCompilerOptions": {
"enableIvy": false
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "src/**/*.spec.ts"],
"include": [
"**/*.ts",
"src/**/*.ts",
"../../libs/home/src/index.ts",
"../../libs/dashboard/src/index.ts",
"../../libs/experiments/src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
}
8 changes: 0 additions & 8 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,9 @@
"webapp": {
"tags": ["app-module"]
},
"webapp-e2e": {
"tags": [],
"implicitDependencies": ["webapp"]
},
"api": {
"tags": ["api-module"]
},
"api-e2e": {
"tags": [],
"implicitDependencies": ["api"]
},
"backend": {
"tags": ["api-module"]
},
Expand Down
Loading

0 comments on commit 195ef66

Please sign in to comment.