Skip to content

Commit

Permalink
Merge pull request #1242 from christophercr/feature/typescript-3.2
Browse files Browse the repository at this point in the history
feat(stark-all): upgrade to TypeScript 3.2 (latest version supported in Angular 7.2)
  • Loading branch information
SuperITMan authored Apr 9, 2019
2 parents 8bae536 + 8d656e6 commit 1100c62
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 75 deletions.
2 changes: 1 addition & 1 deletion greenkeeper.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"packages": ["showcase/package.json", "starter/package.json"]
}
},
"ignore": ["@angular/flex-layout", "@compodoc/compodoc", "@types/node", "typescript"]
"ignore": ["@compodoc/compodoc", "@types/node", "typescript"]
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.17.0",
"tslint-sonarts": "^1.8.0",
"typescript": "~3.1.6",
"typescript": "~3.2.4",
"uglify-es": "^3.3.9",
"zone.js": "~0.8.26"
},
Expand Down Expand Up @@ -154,7 +154,7 @@
"test:showcase:e2e:browserstack": "cd showcase && npm run e2e:browserstack && cd ../..",
"test:starter": "cd starter && npm run test-fast && cd ../..",
"test:starter:e2e": "cd starter && npm run e2e && cd ../..",
"test:ci:all": "npm run test:ci:stark-core && npm run test:ci:stark-ui && npm run test:ci:starter && npm run test:ci:showcase",
"test:ci:all": "npm run test:ci:stark-core && npm run test:ci:stark-ui && npm run test:ci:stark-rbac && npm run test:ci:starter && npm run test:ci:showcase",
"test:ci:stark-core": "cd packages/stark-core && npm run test-fast:ci && cd ../..",
"test:ci:stark-rbac": "cd packages/stark-rbac && npm run test-fast:ci && cd ../..",
"test:ci:stark-ui": "cd packages/stark-ui && npm run test-fast:ci && cd ../..",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const deepFreeze: Function = require("deep-freeze-strict");
const resourcePath = "/something/:somethingId/else/:elseId/next";
const resourceUuid = "dummyUUID";
const resourceEtag = "123456789";
const mockDate: Date = new Date();
const mockDate = new Date();
const mockFrozenPathParamsWithoutUUID: StarkHttpRequestParams = deepFreeze({
pathParameters: { someId: "1234" }
});
Expand Down
14 changes: 7 additions & 7 deletions packages/stark-core/src/util/date.util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Util: DateUtil", () => {

describe("parseDateWithFormat", () => {
it("should return a valid Date when different valid dateStrings are provided using the same format", () => {
const expectedDate: Date = new Date();
const expectedDate = new Date();

// full date-time
expectedDate.setFullYear(2016, 2, 18);
Expand Down Expand Up @@ -60,7 +60,7 @@ describe("Util: DateUtil", () => {
});

it("should return a valid Date when the same dateString is used and passing different formats", () => {
const expectedDate: Date = new Date();
const expectedDate = new Date();

// full date-time (UTC format and including milliseconds)
expectedDate.setUTCFullYear(2016, 2, 18);
Expand Down Expand Up @@ -124,7 +124,7 @@ describe("Util: DateUtil", () => {
});

it("should return a valid Date when the same date is represented in different formats", () => {
const expectedDate: Date = new Date();
const expectedDate = new Date();
expectedDate.setUTCFullYear(2016, 2, 18);
expectedDate.setUTCHours(17, 25, 43, 511);

Expand Down Expand Up @@ -185,10 +185,10 @@ describe("Util: DateUtil", () => {
it("should return the date in a formatted string based on the given format", () => {
// IMPORTANT: in case the date string has a timezone, it should have a ':' between the hours and the minutes
// otherwise IE will fail to parse it returning "Invalid Date"
const mockDate: Date = new Date("2016-03-18T10:25:43.511+01:00");
const mockDate = new Date("2016-03-18T10:25:43.511+01:00");

// another way to create a date
// const mockDate: Date = new Date();
// const mockDate = new Date();
// mockDate.setFullYear(2016, 2, 18);
// mockDate.setHours(10, 25, 43, 511);

Expand Down Expand Up @@ -222,7 +222,7 @@ describe("Util: DateUtil", () => {
});

it("should return the date in a formatted string based on the default format if no format is defined", () => {
const mockDate: Date = new Date();
const mockDate = new Date();
mockDate.setFullYear(2016, 2, 18);
mockDate.setHours(10, 25, 43, 511);

Expand All @@ -231,7 +231,7 @@ describe("Util: DateUtil", () => {
});

it("should return 'invalid format' when the given format is invalid", () => {
const mockDate: Date = new Date();
const mockDate = new Date();
mockDate.setFullYear(2016, 2, 18);
mockDate.setHours(10, 25, 43, 511);

Expand Down
5 changes: 3 additions & 2 deletions packages/stark-rbac/base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ if (window.NodeList && !NodeList.prototype.forEach) {
}

/* tslint:disable:no-import-side-effect */
// FIXME: change when https://github.com/monounity/karma-typescript/issues/320 is resolved
// tslint:disable-next-line:import-blacklist
import "lodash-es"; // see https://github.com/monounity/karma-typescript/issues/150#issuecomment-318620280
import "zone.js/dist/zone";
import "zone.js/dist/long-stack-trace-zone";
import "zone.js/dist/proxy"; // since zone.js 0.6.15
import "zone.js/dist/sync-test";
import "zone.js/dist/jasmine-patch"; // put here since zone.js 0.6.14
import "zone.js/dist/async-test";
import "zone.js/dist/fake-async-test";
import "zone.js/dist/zone-patch-rxjs";
import "zone.js/dist/zone-patch-rxjs-fake-async";
/* tslint:enable:no-import-side-effect */

import { TestBed } from "@angular/core/testing";
Expand Down
13 changes: 7 additions & 6 deletions packages/stark-rbac/karma.conf.ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,25 @@ const karmaTypescriptFiles = require("./karma.conf").karmaTypescriptFiles;
// start customizing the KarmaCI configuration from stark-testing
const starkRBACSpecificConfiguration = {
...defaultKarmaCIConfig,
// change the module resolution for the KarmaTypescript bundler
// change the path of the report so that Coveralls takes the right path to the source files
coverageIstanbulReporter: { ...defaultKarmaCIConfig.coverageIstanbulReporter, dir: helpers.root("reports/coverage/packages") },
// add missing files due to "@nationalbankbelgium/stark-rbac" imports used in mock files of the testing sub-package
files: [...defaultKarmaCIConfig.files, ...karmaTypescriptFiles],
karmaTypescriptConfig: {
...defaultKarmaCIConfig.karmaTypescriptConfig,
bundlerOptions: {
...defaultKarmaCIConfig.karmaTypescriptConfig.bundlerOptions,
// change the module resolution for the KarmaTypescript bundler
...karmaTypescriptBundlerAliasResolution,
// Overwrite the karmaTypescriptConfig to pass the correct preset to karma-typescript-es6-transform
transforms: [
require("../stark-testing/node_modules/karma-typescript-angular2-transform"),
require("../stark-testing/node_modules/karma-typescript-es6-transform")({
presets: [helpers.root("../stark-testing/node_modules/babel-preset-env")] // add preset in a way that the package can find it
})
]
}
},
// change the path of the report so that Coveralls takes the right path to the source files
coverageIstanbulReporter: { ...defaultKarmaCIConfig.coverageIstanbulReporter, dir: helpers.root("reports/coverage/packages") },
// add missing files due to "@nationalbankbelgium/stark-rbac" imports used in mock files of the testing sub-package
files: [...defaultKarmaCIConfig.files, ...karmaTypescriptFiles]
}
};

// export the configuration function that karma expects and simply return the stark configuration
Expand Down
19 changes: 13 additions & 6 deletions packages/stark-rbac/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,38 @@ const karmaTypescriptBundlerAliasResolution = {
cerialize: "../stark-core/node_modules/cerialize/index.js",
"class-validator": "../stark-core/node_modules/class-validator/index.js",
"deep-freeze-strict": "../stark-core/node_modules/deep-freeze-strict/index.js",
moment: "../stark-core/node_modules/moment/moment.js",
ibantools: "../stark-core/node_modules/ibantools/build/ibantools.js"
ibantools: "../stark-core/node_modules/ibantools/build/ibantools.js",
"lodash-es": "../stark-core/node_modules/lodash-es/lodash.js",
"lodash-es/cloneDeep": "../stark-core/node_modules/lodash-es/cloneDeep.js",
"lodash-es/floor": "../stark-core/node_modules/lodash-es/floor.js",
"lodash-es/isEmpty": "../stark-core/node_modules/lodash-es/isEmpty.js",
"lodash-es/noop": "../stark-core/node_modules/lodash-es/noop.js",
"lodash-es/reduce": "../stark-core/node_modules/lodash-es/reduce.js",
moment: "../stark-core/node_modules/moment/moment.js"
}
}
};

// start customizing the KarmaCI configuration from stark-testing
const starkRBACSpecificConfiguration = {
...defaultKarmaConfig,
// change the module resolution for the KarmaTypescript bundler
// add missing files due to "@nationalbankbelgium/stark-rbac" imports used in mock files of the testing sub-package
files: [...defaultKarmaConfig.files, ...karmaTypescriptFiles],
karmaTypescriptConfig: {
...defaultKarmaConfig.karmaTypescriptConfig,
bundlerOptions: {
...defaultKarmaConfig.karmaTypescriptConfig.bundlerOptions,
// change the module resolution for the KarmaTypescript bundler
...karmaTypescriptBundlerAliasResolution,
// Overwrite the karmaTypescriptConfig to pass the correct preset to karma-typescript-es6-transform
transforms: [
require("../stark-testing/node_modules/karma-typescript-angular2-transform"),
require("../stark-testing/node_modules/karma-typescript-es6-transform")({
presets: [helpers.root("../stark-testing/node_modules/babel-preset-env")] // add preset in a way that the package can find it
})
]
}
},
// add missing files due to "@nationalbankbelgium/stark-rbac" imports used in mock files of the testing sub-package
files: [...defaultKarmaConfig.files, ...karmaTypescriptFiles]
}
};

// export the configuration function that karma expects and simply return the stark configuration
Expand Down
16 changes: 10 additions & 6 deletions packages/stark-ui/karma.conf.ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,30 @@ const karmaTypescriptBundlerAlias = require("./karma.conf").karmaTypescriptBundl
const karmaTypescriptFiles = require("./karma.conf").karmaTypescriptFiles;

// start customizing the KarmaCI configuration from stark-testing
const starkUiSpecificConfiguration = Object.assign({}, defaultKarmaCIConfig, {
// change the module resolution for the KarmaTypescript bundler
const starkUiSpecificConfiguration = {
...defaultKarmaCIConfig,
// change the path of the report so that Coveralls takes the right path to the source files
coverageIstanbulReporter: { ...defaultKarmaCIConfig.coverageIstanbulReporter, dir: helpers.root("reports/coverage/packages") },
// add missing files due to "@nationalbankbelgium/stark-ui" imports used in mock files of the testing sub-package
files: [...defaultKarmaCIConfig.files, ...karmaTypescriptFiles],
karmaTypescriptConfig: {
...defaultKarmaCIConfig.karmaTypescriptConfig,
bundlerOptions: {
...defaultKarmaCIConfig.karmaTypescriptConfig.bundlerOptions,
// change the module resolution for the KarmaTypescript bundler
resolve: {
alias: karmaTypescriptBundlerAlias
},
// Overwrite the karmaTypescriptConfig to pass the correct preset to karma-typescript-es6-transform
transforms: [
require("../stark-testing/node_modules/karma-typescript-angular2-transform"),
require("../stark-testing/node_modules/karma-typescript-es6-transform")({
presets: [helpers.root("../stark-testing/node_modules/babel-preset-env")] // add preset in a way that the package can find it
})
]
}
},
// add missing files due to "@nationalbankbelgium/stark-ui" imports used in mock files of the testing sub-package
files: [...defaultKarmaCIConfig.files, ...karmaTypescriptFiles]
});
}
};

// export the configuration function that karma expects and simply return the stark configuration
module.exports = config => {
Expand Down
18 changes: 10 additions & 8 deletions packages/stark-ui/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const karmaTypescriptBundlerAlias = {
cerialize: "../stark-core/node_modules/cerialize/index.js",
"class-validator": "../stark-core/node_modules/class-validator/index.js",
"deep-freeze-strict": "../stark-core/node_modules/deep-freeze-strict/index.js",
moment: "../stark-core/node_modules/moment/moment.js",
ibantools: "../stark-core/node_modules/ibantools/build/ibantools.js",
"lodash-es": "../stark-core/node_modules/lodash-es/lodash.js",
"lodash-es/cloneDeep": "../stark-core/node_modules/lodash-es/cloneDeep.js",
"lodash-es/findIndex": "../stark-core/node_modules/lodash-es/findIndex.js",
Expand All @@ -39,30 +39,32 @@ const karmaTypescriptBundlerAlias = {
"lodash-es/reduce": "../stark-core/node_modules/lodash-es/reduce.js",
"lodash-es/startCase": "../stark-core/node_modules/lodash-es/startCase.js",
"lodash-es/uniqueId": "../stark-core/node_modules/lodash-es/uniqueId.js",
ibantools: "../stark-core/node_modules/ibantools/build/ibantools.js"
moment: "../stark-core/node_modules/moment/moment.js"
};

// start customizing the KarmaCI configuration from stark-testing
const starkUiSpecificConfiguration = Object.assign({}, defaultKarmaConfig, {
// change the module resolution for the KarmaTypescript bundler
const starkUiSpecificConfiguration = {
...defaultKarmaConfig,
// add missing files due to "@nationalbankbelgium/stark-ui" imports used in mock files of the testing sub-package
files: [...defaultKarmaConfig.files, ...karmaTypescriptFiles],
karmaTypescriptConfig: {
...defaultKarmaConfig.karmaTypescriptConfig,
bundlerOptions: {
...defaultKarmaConfig.karmaTypescriptConfig.bundlerOptions,
// change the module resolution for the KarmaTypescript bundler
resolve: {
alias: karmaTypescriptBundlerAlias
},
// Overwrite the karmaTypescriptConfig to pass the correct preset to karma-typescript-es6-transform
transforms: [
require("../stark-testing/node_modules/karma-typescript-angular2-transform"),
require("../stark-testing/node_modules/karma-typescript-es6-transform")({
presets: [helpers.root("../stark-testing/node_modules/babel-preset-env")] // add preset in a way that the package can find it
})
]
}
},
// add missing files due to "@nationalbankbelgium/stark-ui" imports used in mock files of the testing sub-package
files: [...defaultKarmaConfig.files, ...karmaTypescriptFiles]
});
}
};

// export the configuration function that karma expects and simply return the stark configuration
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,23 @@ describe("DatePickerComponent", () => {
});

it("the MatDatepickerInput min date should be minDate", () => {
const minDate: Date = new Date(2018, 6, 1);
const minDate = new Date(2018, 6, 1);
component.min = minDate;
hostFixture.detectChanges();
expect(component.pickerInput.min).not.toBeNull();
expect((<moment.Moment>component.pickerInput.min).toDate()).toEqual(minDate);
});

it("the MatDatepickerInput max date should be maxDate", () => {
const maxDate: Date = new Date(2018, 6, 2);
const maxDate = new Date(2018, 6, 2);
component.max = maxDate;
hostFixture.detectChanges();
expect(component.pickerInput.max).not.toBeNull();
expect((<moment.Moment>component.pickerInput.max).toDate()).toEqual(maxDate);
});

it("the MatDatepickerInput value should be date", () => {
const date: Date = new Date(2018, 6, 3);
const date = new Date(2018, 6, 3);
hostComponent.formControl.setValue(date);
hostFixture.detectChanges();
expect(component.pickerInput.value).not.toBeNull();
Expand Down Expand Up @@ -341,23 +341,23 @@ describe("DatePickerComponent", () => {
});

it("the MatDatepickerInput min date should be minDate", () => {
const minDate: Date = new Date(2018, 6, 1);
const minDate = new Date(2018, 6, 1);
component.min = minDate;
hostFixture.detectChanges();
expect(component.pickerInput.min).not.toBeNull();
expect((<moment.Moment>component.pickerInput.min).toDate()).toEqual(minDate);
});

it("the MatDatepickerInput max date should be maxDate", () => {
const maxDate: Date = new Date(2018, 6, 2);
const maxDate = new Date(2018, 6, 2);
component.max = maxDate;
hostFixture.detectChanges();
expect(component.pickerInput.max).not.toBeNull();
expect((<moment.Moment>component.pickerInput.max).toDate()).toEqual(maxDate);
});

it("the MatDatepickerInput value should be date", () => {
const date: Date = new Date(2018, 6, 3);
const date = new Date(2018, 6, 3);
hostComponent.value = date;
hostFixture.detectChanges();
expect(component.pickerInput.value).not.toBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe("DateRangePickerComponent", () => {
});

it("the datepickers min date should be set correctly", () => {
const minDate: Date = new Date(2018, 6, 1);
const minDate = new Date(2018, 6, 1);
component.startMinDate = minDate;
component.endMinDate = minDate;
fixture.detectChanges();
Expand All @@ -121,7 +121,7 @@ describe("DateRangePickerComponent", () => {
});

it("the datepickers max date should be set correctly", () => {
const maxDate: Date = new Date(2018, 6, 2);
const maxDate = new Date(2018, 6, 2);
component.startMaxDate = maxDate;
component.endMaxDate = maxDate;
fixture.detectChanges();
Expand All @@ -132,7 +132,7 @@ describe("DateRangePickerComponent", () => {
});

it("the datepickers value should be set correctly", () => {
const date: Date = new Date(2018, 6, 3);
const date = new Date(2018, 6, 3);
component.startDate = date;
component.endDate = date;
fixture.detectChanges();
Expand All @@ -153,7 +153,7 @@ describe("DateRangePickerComponent", () => {
});

it("the end date should be correctly set if after the start date", () => {
const endDate: Date = new Date(2018, 6, 7);
const endDate = new Date(2018, 6, 7);
component.startDate = new Date(2018, 6, 6);
component.endDate = endDate;
fixture.detectChanges();
Expand All @@ -162,7 +162,7 @@ describe("DateRangePickerComponent", () => {
});

it("the end date should be correctly set if after the start date is undefined", () => {
const endDate: Date = new Date(2018, 6, 8);
const endDate = new Date(2018, 6, 8);
component.startDate = undefined;
component.endDate = endDate;
fixture.detectChanges();
Expand Down
Loading

0 comments on commit 1100c62

Please sign in to comment.