Skip to content

Commit

Permalink
fix(test): nrwl/nx -> 6.4.0-beta.1
Browse files Browse the repository at this point in the history
lib updates, removed unnecessary karma.conf.ts from (apps/libs)/tsconfig.lib.json, removed
unnecessary src/polyfills.ts from (apps/libs)/tsconfig.spec.json
  • Loading branch information
xmlking committed Sep 22, 2018
1 parent 9cc06aa commit ef34027
Show file tree
Hide file tree
Showing 77 changed files with 760 additions and 736 deletions.
15 changes: 7 additions & 8 deletions PLAYBOOK.md
Expand Up @@ -12,7 +12,7 @@ Do-it-yourself step-by-step instructions to create this project structure from s
| Node | v10.7.0 | |
| NPM | v6.4.0 | |
| Angular CLI | v6.0.8 | |
| @nrwl/schematics | v6.3.0 | |
| @nrwl/schematics | v6.4.0 | |
| @nestjs/cli | v5.3.0 | |

### Install Prerequisites
Expand Down Expand Up @@ -54,7 +54,7 @@ npm remove -g @nrwl/schematics
npm remove -g @nestjs/cli

npm install -g @angular/cli
npm install -g @nrwl/schematics
npm install -g @nrwl/schematics@6.4.0-beta.1
npm install -g @nestjs/cli

npm install -g ndb
Expand Down Expand Up @@ -93,6 +93,10 @@ cd ngx-starter-kit

> remove all ngrx NPM pagages from package.json

# setup your workspace to run tests with jest.
ng generate jest
# you may have to manually remove karma files (karma.conf.js) and dependencies from package.json

# make sure we are up-to-date
ng update
# and update as suggested. e.g.,
Expand All @@ -102,9 +106,6 @@ ng update --all

# generate webapp app
ng g app webapp --routing --style=scss --prefix=ngx --unit-test-runner=jest --tags=app-module

# add Jest to replace karma as testing framework
ng generate jest
```

#### Dependencies
Expand Down Expand Up @@ -200,8 +201,6 @@ ng g lib experiments --routing --lazy --prefix=ngx --parent-module=libs/dashb
ng g lib widgets --routing --lazy --prefix=ngx --parent-module=libs/dashboard/src/lib/dashboard.module.ts --unit-test-runner=jest --tags=child-module
ng g lib grid --routing --lazy --prefix=ngx --parent-module=libs/dashboard/src/lib/dashboard.module.ts --unit-test-runner=jest --tags=child-module


ng g lib aaa --dry-run
ng g lib animations --nomodule -tags=utils --unit-test-runner=jest --dry-run
ng g lib Tree --nomodule --publishable=true --tags=utils --unit-test-runner=jest --dry-run
ng g lib utils --nomodule --tags=utils --unit-test-runner=jest --dry-run
Expand Down Expand Up @@ -489,7 +488,7 @@ $ docker-compose up web # optional: --build, see below
Now open your browser at http://localhost:80


### IntelliJ
### IntelliJ/WebStorm

Right click on `apps/webapp/src/styles` in project vie --> Make Directory as --> Resources Root.
Right click on `apps/webapp/src` in project vie --> Make Directory as --> Resources Root.
Expand Down
28 changes: 8 additions & 20 deletions angular.json
Expand Up @@ -152,26 +152,6 @@
"browserTarget": "webapp:build"
}
},
"test": {
"builder": "@nrwl/builders:jest",
"options": {
"jestConfig": "apps/webapp/jest.config.js",
"tsConfig": "apps/webapp/tsconfig.spec.json",
"setupFile": "apps/webapp/src/test-setup.ts",
"styles": [
{
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
},
"apps/webapp/src/styles.scss"
],
"scripts": [],
"assets": [
"apps/webapp/src/favicon.ico",
"apps/webapp/src/assets",
"apps/webapp/src/manifest.json"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
Expand All @@ -183,6 +163,14 @@
"**/node_modules/**"
]
}
},
"test": {
"builder": "@nrwl/builders:jest",
"options": {
"jestConfig": "apps/webapp/jest.config.js",
"tsConfig": "apps/webapp/tsconfig.spec.json",
"setupFile": "apps/webapp/src/test-setup.ts"
}
}
}
},
Expand Down
6 changes: 4 additions & 2 deletions apps/webapp/browserslist
@@ -1,9 +1,11 @@
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For IE 9-11 support, please uncomment the last line of the file and adjust as needed
#
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed

> 0.5%
last 2 versions
Firefox ESR
not dead
# IE 9-11
not IE 9-11
8 changes: 4 additions & 4 deletions apps/webapp/src/app/app.component.spec.ts
Expand Up @@ -9,20 +9,20 @@ describe('AppComponent', () => {
declarations: [AppComponent],
}).compileComponents();
}));
it('should create the app', async(() => {
it('should create the webapp', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
xit(`should have as title 'app'`, async(() => {
xit(`should have as title 'webapp'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app');
expect(app.title).toEqual('webapp');
}));
xit('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
expect(compiled.querySelector('h1').textContent).toContain('Welcome to webapp!');
}));
});
2 changes: 1 addition & 1 deletion apps/webapp/src/main.ts
Expand Up @@ -10,4 +10,4 @@ if (environment.production) {

platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch(err => console.log(err));
.catch(err => console.error(err));
40 changes: 0 additions & 40 deletions apps/webapp/src/test-setup.ts
@@ -1,41 +1 @@
import 'jest-preset-angular';

// move this to ./jest-global-mocks.ts
// @ts-ignore
global.CSS = null;

const webStorageMock = () => {
let storage: Record<string, any> = {};
return {
getItem: (key: string) => (key in storage ? storage[key] : null),
setItem: (key: string, value: any) => (storage[key] = value || ''),
removeItem: (key: string) => delete storage[key],
clear: () => (storage = {}),
};
};

Object.defineProperty(window, 'localStorage', { value: webStorageMock() });
Object.defineProperty(window, 'sessionStorage', { value: webStorageMock() });
Object.defineProperty(document, 'doctype', {
value: '<!DOCTYPE html>',
});
Object.defineProperty(window, 'getComputedStyle', {
value: () => {
return {
display: 'none',
appearance: ['-webkit-appearance'],
};
},
});
/**
* ISSUE: https://github.com/angular/material2/issues/7101
* Workaround for JSDOM missing transform property
*/
Object.defineProperty(document.body.style, 'transform', {
value: () => {
return {
enumerable: true,
configurable: true,
};
},
});
5 changes: 2 additions & 3 deletions apps/webapp/tsconfig.app.json
Expand Up @@ -4,9 +4,8 @@
"outDir": "../../dist/out-tsc/apps/webapp"
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"src/test-setup.ts",
"**/*.spec.ts"
],
"include": [
"**/*.ts"
Expand Down
3 changes: 1 addition & 2 deletions libs/animations/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/animations/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/app-confirm/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/app-confirm/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/auth/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/auth/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/breadcrumbs/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/breadcrumbs/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/chat-box/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/chat-box/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/clap/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/clap/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/context-menu/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/context-menu/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/core/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/core/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/dashboard/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/dashboard/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/draggable/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/draggable/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/experiments/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion libs/experiments/tsconfig.spec.json
Expand Up @@ -5,6 +5,6 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts", "src/polyfills.ts"],
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions libs/grid/tsconfig.lib.json
Expand Up @@ -28,7 +28,6 @@
},
"exclude": [
"src/test.ts",
"**/*.spec.ts",
"karma.conf.ts"
"**/*.spec.ts"
]
}

0 comments on commit ef34027

Please sign in to comment.