Skip to content

Update example app to update to angular 7 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
coverage
angular.json
4 changes: 2 additions & 2 deletions jest/tests-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import 'zone.js/dist/sync-test';
// tslint:disable-next-line:ordered-imports
import 'jest-zone-patch';

import { TestBed } from '@angular/core/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';

TestBed.initTestEnvironment(
getTestBed().initTestEnvironment(
[BrowserDynamicTestingModule, NoopAnimationsModule],
platformBrowserDynamicTesting(),
);
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,40 @@
]
},
"devDependencies": {
"@angular/animations": "6.0.7",
"@angular/common": "6.0.7",
"@angular/compiler": "6.0.7",
"@angular/compiler-cli": "6.0.7",
"@angular/core": "6.0.7",
"@angular/forms": "6.0.7",
"@angular/platform-browser": "6.0.7",
"@angular/platform-browser-dynamic": "6.0.7",
"@angular/router": "6.0.7",
"@angular/animations": "7.1.4",
"@angular/common": "7.1.4",
"@angular/compiler": "7.1.4",
"@angular/compiler-cli": "7.1.4",
"@angular/core": "7.1.4",
"@angular/forms": "7.1.4",
"@angular/platform-browser": "7.1.4",
"@angular/platform-browser-dynamic": "7.1.4",
"@angular/router": "7.1.4",
"@commitlint/cli": "7.0.0",
"@commitlint/config-conventional": "7.0.1",
"@commitlint/prompt-cli": "7.0.0",
"@types/jest": "23.1.6",
"babel-core": "6.26.3",
"babel-jest": "23.4.2",
"codelyzer": "4.4.2",
"codelyzer": "4.5.0",
"husky": "1.1.3",
"jest": "23.4.1",
"jest-junit": "5.1.0",
"jest-preset-angular": "6.0.0",
"jest": "23.6.0",
"jest-junit": "5.2.0",
"jest-preset-angular": "6.0.2",
"jest-zone-patch": "0.0.8",
"lerna": "3.4.3",
"lint-staged": "7.2.0",
"ng-packagr": "3.0.6",
"ng-packagr": "4.4.5",
"npm-run-all": "4.1.3",
"prettier": "1.13.7",
"redux": "4.0.0",
"redux": "4.0.1",
"redux-logger": "2.10.2",
"rimraf": "2.6.2",
"rxjs": "6.2.1",
"rxjs": "6.3.3",
"tsickle": "0.32.1",
"tslib": "1.9.3",
"tslint": "5.11.0",
"typescript": "2.7.2",
"typescript": "3.1.6",
"zone.js": "0.8.26"
}
}
29 changes: 22 additions & 7 deletions packages/example-app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.css"],
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -84,8 +89,13 @@
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
Expand All @@ -111,11 +121,16 @@
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": ["**/node_modules/**"]
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "example-app"
}
"defaultProject": "example-app",
"cli": {
"packageManager": "yarn"
}
}
34 changes: 31 additions & 3 deletions packages/example-app/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
'use strict';

// Jest JUnit Reporter config
process.env.JEST_JUNIT_OUTPUT = './coverage/junit.xml';

module.exports = {
preset: 'jest-preset-angular',
setupTestFrameworkScriptFile: '<rootDir>/src/setupJest.ts',
testMatch: ['**/*.spec.ts'],
globals: {
__TRANSFORM_HTML__: true,
},
transform: {
'^.+\\.(ts|js|html)$':
'<rootDir>/node_modules/jest-preset-angular/preprocessor.js',
},
testMatch: ['**/*.spec.{ts,js}'],
moduleFileExtensions: ['ts', 'js', 'html', 'json'],
setupTestFrameworkScriptFile: '<rootDir>/src/test.ts',
snapshotSerializers: [
'<rootDir>/node_modules/jest-preset-angular/AngularSnapshotSerializer.js',
'<rootDir>/node_modules/jest-preset-angular/HTMLCommentSerializer.js',
],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/src/testing/file.mock.ts',
},
modulePathIgnorePatterns: ['dist'],
reporters: ['default', 'jest-junit'],
collectCoverageFrom: [
'**/packages/**/*.{ts,js}',
'!**/node_modules/**',
'!**/dist/**',
],
coverageReporters: ['lcov', 'text-summary'],
};
20 changes: 11 additions & 9 deletions packages/example-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
"@angular-redux/form": "latest",
"@angular-redux/router": "latest",
"@angular-redux/store": "latest",
"@angular/common": "^7.1.0",
"@angular/compiler": "^7.1.0",
"@angular/core": "^7.1.0",
"@angular/forms": "^7.1.0",
"@angular/http": "^7.1.0",
"@angular/platform-browser": "^7.1.0",
"@angular/platform-browser-dynamic": "^7.1.0",
"@angular/router": "^7.1.0",
"@angular/animations": "7.1.4",
"@angular/common": "^7.1.4",
"@angular/compiler": "^7.1.4",
"@angular/core": "^7.1.4",
"@angular/forms": "^7.1.4",
"@angular/http": "^7.1.4",
"@angular/platform-browser": "^7.1.4",
"@angular/platform-browser-dynamic": "^7.1.4",
"@angular/router": "^7.1.4",
"core-js": "^2.4.1",
"flux-standard-action": "^2.0.3",
"ramda": "^0.26.0",
Expand All @@ -45,7 +46,8 @@
"@types/ramda": "^0.24.18",
"@types/redux-logger": "^3.0.0",
"jest": "^23.6.0",
"jest-preset-angular": "^6.0.2",
"jest-junit": "5.2.0",
"jest-preset-angular": "6.0.2",
"protractor": "^5.4.1",
"ts-node": "^7.0.1",
"typescript": ">=3.1.1 < 3.2"
Expand Down
5 changes: 4 additions & 1 deletion packages/example-app/src/app/animals/api/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export function createAnimalAPIReducer(animalType: AnimalType) {
case AnimalAPIActions.LOAD_SUCCEEDED:
return {
...state,
items: indexBy<Animal>(prop('id'), action.payload!),
items: indexBy<Animal, { [key: string]: Animal }>(
prop('id'),
action.payload!,
),
loading: false,
error: null,
};
Expand Down
23 changes: 9 additions & 14 deletions packages/example-app/src/app/store/module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
MockNgRedux,
NgReduxTestingModule,
} from '@angular-redux/store/testing';
import { async, getTestBed, TestBed } from '@angular/core/testing';
import { async, TestBed } from '@angular/core/testing';
import { RootEpics } from './epics';
import { StoreModule } from './module';

Expand All @@ -15,20 +15,15 @@ describe('Store Module', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [NgReduxTestingModule],
})
.compileComponents()
.then(() => {
const testbed = getTestBed();
});

mockEpics = {
createEpics() {
return [];
},
};

devTools = testbed.get(DevToolsExtension);
mockNgRedux = MockNgRedux.getInstance();
});
mockEpics = {
createEpics() {
return [];
},
};
devTools = TestBed.get(DevToolsExtension);
mockNgRedux = MockNgRedux.getInstance();
}));

it('should configure the store when the module is loaded', async(() => {
Expand Down
2 changes: 0 additions & 2 deletions packages/example-app/src/jestGlobalMocks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
declare const window: any;

const mock = () => {
let storage: { [key: string]: any } = {};
return {
Expand Down
2 changes: 0 additions & 2 deletions packages/example-app/src/setupJest.ts

This file was deleted.

23 changes: 23 additions & 0 deletions packages/example-app/src/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// tslint:disable:no-implicit-dependencies
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import 'zone.js/dist/proxy';
import 'zone.js/dist/sync-test';
// This must be loaded in after ZoneJS
// tslint:disable-next-line:ordered-imports
import 'jest-zone-patch';

import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';

getTestBed().initTestEnvironment(
[BrowserDynamicTestingModule, NoopAnimationsModule],
platformBrowserDynamicTesting(),
);
1 change: 1 addition & 0 deletions packages/example-app/src/testing/file.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
4 changes: 2 additions & 2 deletions packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"peerDependencies": {
"@angular-redux/store": "^9.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/core": "^7.0.0",
"@angular/forms": "^7.0.0",
"redux": "^4.0.0",
"rxjs": "^6.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
},
"peerDependencies": {
"@angular-redux/store": "^9.0.0",
"@angular/common": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/router": "^6.0.0",
"@angular/common": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/router": "^7.0.0",
"redux": "^4.0.0",
"rxjs": "^6.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"doc": "typedoc --out docs --excludeExternals --excludePrivate --excludeNotExported -theme minimal --sourcefile-url-prefix \"https://github.com/angular-redux/store/blob/master/src/\" --name @angular-redux/store --mode file --module commonjs --tsconfig tsconfig.docs.json src"
},
"peerDependencies": {
"@angular/core": "^6.0.0",
"@angular/core": "^7.0.0",
"redux": "^4.0.0",
"rxjs": "^6.0.0"
},
Expand Down
Loading