diff --git a/packages/karma.conf.ci.js b/packages/karma.conf.ci.js new file mode 100644 index 0000000000..d3ca698728 --- /dev/null +++ b/packages/karma.conf.ci.js @@ -0,0 +1,41 @@ +const helpers = require("./stark-testing/helpers"); + +/** + * Load karma config from Stark + */ +const defaultKarmaCIConfig = require("./stark-testing/karma.conf.ci.js").rawKarmaConfig; +const { karmaTypescriptBundlerAlias, karmaTypescriptFiles } = require("./karma.conf"); + +// start customizing the KarmaCI configuration from stark-testing +const starkPackagesSpecificConfiguration = { + ...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(helpers.root("../stark-testing/node_modules/karma-typescript-angular2-transform")), + require(helpers.root("../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 + }) + ] + } + } +}; + +// export the configuration function that karma expects and simply return the stark configuration +module.exports = { + default: function(config) { + return config.set(starkPackagesSpecificConfiguration); + }, + rawKarmaConfig: starkPackagesSpecificConfiguration +}; diff --git a/packages/karma.conf.js b/packages/karma.conf.js new file mode 100644 index 0000000000..0aa040cae3 --- /dev/null +++ b/packages/karma.conf.js @@ -0,0 +1,79 @@ +const helpers = require("./stark-testing/helpers"); + +/** + * Load karma config from Stark + */ +const defaultKarmaConfig = require("./stark-testing/karma.conf.js").rawKarmaConfig; + +// entry files of the "@nationalbankbelgium/stark-ui" module imported in mock files +const karmaTypescriptFiles = [{ pattern: helpers.root("public_api.ts") }, { pattern: helpers.root("testing/**/*.ts") }]; + +const karmaTypescriptBundlerAlias = { + // adapt the resolution of the stark-core module to the UMD module + "@nationalbankbelgium/stark-core": "../../dist/packages/stark-core/bundles/stark-core.umd.js", + "@nationalbankbelgium/stark-core/testing": "../../dist/packages/stark-core/bundles/stark-core-testing.umd.js", + // adapt the resolution of the 3rd party modules used in stark-core + "@angularclass/hmr": "../stark-core/node_modules/@angularclass/hmr/dist/index.js", + "@ng-idle/core": "../stark-core/node_modules/@ng-idle/core/bundles/core.umd.js", + "@ng-idle/keepalive": "../stark-core/node_modules/@ng-idle/keepalive/bundles/keepalive.umd.js", + "@ngrx/store": "../stark-core/node_modules/@ngrx/store/bundles/store.umd.js", + "@ngrx/effects": "../stark-core/node_modules/@ngrx/effects/bundles/effects.umd.js", + "@ngrx/effects/testing": "../stark-core/node_modules/@ngrx/effects/bundles/effects-testing.umd.js", + "@ngx-translate/core": "../stark-core/node_modules/@ngx-translate/core/bundles/ngx-translate-core.umd.js", + "@uirouter/angular": "../stark-core/node_modules/@uirouter/angular/_bundles/ui-router-ng2.js", + "@uirouter/core": "../stark-core/node_modules/@uirouter/core/lib/index.js", + "@uirouter/rx": "../stark-core/node_modules/@uirouter/rx/lib/index.js", + 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", + 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/find": "../stark-core/node_modules/lodash-es/find.js", + "lodash-es/findIndex": "../stark-core/node_modules/lodash-es/findIndex.js", + "lodash-es/floor": "../stark-core/node_modules/lodash-es/floor.js", + "lodash-es/get": "../stark-core/node_modules/lodash-es/get.js", + "lodash-es/isEmpty": "../stark-core/node_modules/lodash-es/isEmpty.js", + "lodash-es/isEqual": "../stark-core/node_modules/lodash-es/isEqual.js", + "lodash-es/merge": "../stark-core/node_modules/lodash-es/merge.js", + "lodash-es/noop": "../stark-core/node_modules/lodash-es/noop.js", + "lodash-es/sortBy": "../stark-core/node_modules/lodash-es/sortBy.js", + "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", + moment: "../stark-core/node_modules/moment/moment.js" +}; + +// start customizing the KarmaCI configuration from stark-testing +const starkPackagesSpecificConfiguration = { + ...defaultKarmaConfig, + // add missing files due to "@nationalbankbelgium/stark-*" 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(helpers.root("../stark-testing/node_modules/karma-typescript-angular2-transform")), + require(helpers.root("../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 + }) + ] + } + } +}; + +// export the configuration function that karma expects and simply return the stark configuration +module.exports = { + default: function(config) { + return config.set(starkPackagesSpecificConfiguration); + }, + karmaTypescriptBundlerAlias, + karmaTypescriptFiles, + rawKarmaConfig: starkPackagesSpecificConfiguration +}; diff --git a/packages/stark-core/karma.conf.ci.js b/packages/stark-core/karma.conf.ci.js index c15ecdf175..01e3e85127 100644 --- a/packages/stark-core/karma.conf.ci.js +++ b/packages/stark-core/karma.conf.ci.js @@ -1,35 +1,11 @@ const helpers = require("../stark-testing/helpers"); /** - * Load karma config from Stark + * Load packages karma config */ -const defaultKarmaCIConfig = require("../stark-testing/karma.conf.ci.js").rawKarmaConfig; -const karmaTypescriptFiles = require("./karma.conf").karmaTypescriptFiles; - -// start customizing the KarmaCI configuration from stark-testing -const starkCoreSpecificConfiguration = Object.assign({}, defaultKarmaCIConfig, { - // change the path of the report so that Coveralls takes the right path to the source files - coverageIstanbulReporter: Object.assign(defaultKarmaCIConfig.coverageIstanbulReporter, { - dir: helpers.root("reports/coverage/packages") - }), - // add missing files due to "@nationalbankbelgium/stark-core" imports used in mock files of the testing sub-package - files: [...defaultKarmaCIConfig.files, ...karmaTypescriptFiles], - // Overwrite the karmaTypescriptConfig to pass the correct preset to karma-typescript-es6-transform - karmaTypescriptConfig: { - ...defaultKarmaCIConfig.karmaTypescriptConfig, - bundlerOptions: { - ...defaultKarmaCIConfig.karmaTypescriptConfig.bundlerOptions, - 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 - }) - ] - } - } -}); +const rawKarmaConfig = require("../karma.conf.ci.js").rawKarmaConfig; // export the configuration function that karma expects and simply return the stark configuration module.exports = config => { - return config.set(starkCoreSpecificConfiguration); + return config.set(rawKarmaConfig); }; diff --git a/packages/stark-core/karma.conf.js b/packages/stark-core/karma.conf.js index a244e57c0a..58f8dd2b42 100644 --- a/packages/stark-core/karma.conf.js +++ b/packages/stark-core/karma.conf.js @@ -1,36 +1,11 @@ const helpers = require("../stark-testing/helpers"); /** - * Load karma config from Stark + * Load packages karma config */ -const defaultKarmaConfig = require("../stark-testing/karma.conf.js").rawKarmaConfig; - -// entry files of the "@nationalbankbelgium/stark-core" module imported in mock files -const karmaTypescriptFiles = [{ pattern: helpers.root("public_api.ts") }, { pattern: helpers.root("testing/**/*.ts") }]; - -// start customizing the Karma configuration from stark-testing -const starkCoreSpecificConfiguration = Object.assign({}, defaultKarmaConfig, { - // add missing files due to "@nationalbankbelgium/stark-core" imports used in mock files of the testing sub-package - files: [...defaultKarmaConfig.files, ...karmaTypescriptFiles], - // Overwrite the karmaTypescriptConfig to pass the correct preset to karma-typescript-es6-transform - karmaTypescriptConfig: { - ...defaultKarmaConfig.karmaTypescriptConfig, - bundlerOptions: { - ...defaultKarmaConfig.karmaTypescriptConfig.bundlerOptions, - 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 - }) - ] - } - } -}); +const rawKarmaConfig = require("../karma.conf.js").rawKarmaConfig; // export the configuration function that karma expects and simply return the stark configuration -module.exports = { - default: function(config) { - return config.set(starkCoreSpecificConfiguration); - }, - karmaTypescriptFiles: karmaTypescriptFiles +module.exports = config => { + return config.set(rawKarmaConfig); }; diff --git a/packages/stark-rbac/karma.conf.ci.js b/packages/stark-rbac/karma.conf.ci.js index 9d3cac497e..01e3e85127 100644 --- a/packages/stark-rbac/karma.conf.ci.js +++ b/packages/stark-rbac/karma.conf.ci.js @@ -1,37 +1,11 @@ const helpers = require("../stark-testing/helpers"); /** - * Load karma config from Stark + * Load packages karma config */ -const defaultKarmaCIConfig = require("../stark-testing/karma.conf.ci.js").rawKarmaConfig; -const karmaTypescriptBundlerAliasResolution = require("./karma.conf").karmaTypescriptBundlerAliasResolution; -const karmaTypescriptFiles = require("./karma.conf").karmaTypescriptFiles; - -// start customizing the KarmaCI configuration from stark-testing -const starkRBACSpecificConfiguration = { - ...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-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 - }) - ] - } - } -}; +const rawKarmaConfig = require("../karma.conf.ci.js").rawKarmaConfig; // export the configuration function that karma expects and simply return the stark configuration module.exports = config => { - return config.set(starkRBACSpecificConfiguration); + return config.set(rawKarmaConfig); }; diff --git a/packages/stark-rbac/karma.conf.js b/packages/stark-rbac/karma.conf.js index 9644c4a4b9..58f8dd2b42 100644 --- a/packages/stark-rbac/karma.conf.js +++ b/packages/stark-rbac/karma.conf.js @@ -1,71 +1,11 @@ const helpers = require("../stark-testing/helpers"); /** - * Load karma config from Stark + * Load packages karma config */ -const defaultKarmaConfig = require("../stark-testing/karma.conf.js").rawKarmaConfig; - -// entry files of the "@nationalbankbelgium/stark-rbac" module imported in mock files -const karmaTypescriptFiles = [{ pattern: helpers.root("public_api.ts") }, { pattern: helpers.root("testing/**/*.ts") }]; - -const karmaTypescriptBundlerAliasResolution = { - resolve: { - alias: { - // adapt the resolution of the stark-core module to the UMD module - "@nationalbankbelgium/stark-core": "../../dist/packages/stark-core/bundles/stark-core.umd.js", - "@nationalbankbelgium/stark-core/testing": "../../dist/packages/stark-core/bundles/stark-core-testing.umd.js", - // adapt the resolution of the 3rd party modules used in stark-core - "@angularclass/hmr": "../stark-core/node_modules/@angularclass/hmr/dist/index.js", - "@ng-idle/core": "../stark-core/node_modules/@ng-idle/core/bundles/core.umd.js", - "@ng-idle/keepalive": "../stark-core/node_modules/@ng-idle/keepalive/bundles/keepalive.umd.js", - "@ngrx/store": "../stark-core/node_modules/@ngrx/store/bundles/store.umd.js", - "@ngrx/effects": "../stark-core/node_modules/@ngrx/effects/bundles/effects.umd.js", - "@ngx-translate/core": "../stark-core/node_modules/@ngx-translate/core/bundles/ngx-translate-core.umd.js", - "@uirouter/angular": "../stark-core/node_modules/@uirouter/angular/_bundles/ui-router-ng2.js", - "@uirouter/core": "../stark-core/node_modules/@uirouter/core/lib/index.js", - "@uirouter/rx": "../stark-core/node_modules/@uirouter/rx/lib/index.js", - 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", - 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, - // 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 - }) - ] - } - } -}; +const rawKarmaConfig = require("../karma.conf.js").rawKarmaConfig; // export the configuration function that karma expects and simply return the stark configuration -module.exports = { - default: function(config) { - return config.set(starkRBACSpecificConfiguration); - }, - karmaTypescriptBundlerAliasResolution: karmaTypescriptBundlerAliasResolution, - karmaTypescriptFiles: karmaTypescriptFiles +module.exports = config => { + return config.set(rawKarmaConfig); }; diff --git a/packages/stark-ui/karma.conf.ci.js b/packages/stark-ui/karma.conf.ci.js index 65eda4585c..01e3e85127 100644 --- a/packages/stark-ui/karma.conf.ci.js +++ b/packages/stark-ui/karma.conf.ci.js @@ -1,39 +1,11 @@ const helpers = require("../stark-testing/helpers"); /** - * Load karma config from Stark + * Load packages karma config */ -const defaultKarmaCIConfig = require("../stark-testing/karma.conf.ci.js").rawKarmaConfig; -const karmaTypescriptBundlerAlias = require("./karma.conf").karmaTypescriptBundlerAlias; -const karmaTypescriptFiles = require("./karma.conf").karmaTypescriptFiles; - -// start customizing the KarmaCI configuration from stark-testing -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 - }) - ] - } - } -}; +const rawKarmaConfig = require("../karma.conf.ci.js").rawKarmaConfig; // export the configuration function that karma expects and simply return the stark configuration module.exports = config => { - return config.set(starkUiSpecificConfiguration); + return config.set(rawKarmaConfig); }; diff --git a/packages/stark-ui/karma.conf.js b/packages/stark-ui/karma.conf.js index 4d5c79c727..58f8dd2b42 100644 --- a/packages/stark-ui/karma.conf.js +++ b/packages/stark-ui/karma.conf.js @@ -1,78 +1,11 @@ const helpers = require("../stark-testing/helpers"); /** - * Load karma config from Stark + * Load packages karma config */ -const defaultKarmaConfig = require("../stark-testing/karma.conf.js").rawKarmaConfig; - -// entry files of the "@nationalbankbelgium/stark-ui" module imported in mock files -const karmaTypescriptFiles = [{ pattern: helpers.root("public_api.ts") }, { pattern: helpers.root("testing/**/*.ts") }]; - -const karmaTypescriptBundlerAlias = { - // adapt the resolution of the stark-core module to the UMD module - "@nationalbankbelgium/stark-core": "../../dist/packages/stark-core/bundles/stark-core.umd.js", - "@nationalbankbelgium/stark-core/testing": "../../dist/packages/stark-core/bundles/stark-core-testing.umd.js", - // adapt the resolution of the 3rd party modules used in stark-core - "@angularclass/hmr": "../stark-core/node_modules/@angularclass/hmr/dist/index.js", - "@ng-idle/core": "../stark-core/node_modules/@ng-idle/core/bundles/core.umd.js", - "@ng-idle/keepalive": "../stark-core/node_modules/@ng-idle/keepalive/bundles/keepalive.umd.js", - "@ngrx/store": "../stark-core/node_modules/@ngrx/store/bundles/store.umd.js", - "@ngrx/effects": "../stark-core/node_modules/@ngrx/effects/bundles/effects.umd.js", - "@ngrx/effects/testing": "../stark-core/node_modules/@ngrx/effects/bundles/effects-testing.umd.js", - "@ngx-translate/core": "../stark-core/node_modules/@ngx-translate/core/bundles/ngx-translate-core.umd.js", - "@uirouter/angular": "../stark-core/node_modules/@uirouter/angular/_bundles/ui-router-ng2.js", - "@uirouter/core": "../stark-core/node_modules/@uirouter/core/lib/index.js", - "@uirouter/rx": "../stark-core/node_modules/@uirouter/rx/lib/index.js", - 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", - 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/find": "../stark-core/node_modules/lodash-es/find.js", - "lodash-es/findIndex": "../stark-core/node_modules/lodash-es/findIndex.js", - "lodash-es/floor": "../stark-core/node_modules/lodash-es/floor.js", - "lodash-es/get": "../stark-core/node_modules/lodash-es/get.js", - "lodash-es/isEmpty": "../stark-core/node_modules/lodash-es/isEmpty.js", - "lodash-es/isEqual": "../stark-core/node_modules/lodash-es/isEqual.js", - "lodash-es/merge": "../stark-core/node_modules/lodash-es/merge.js", - "lodash-es/noop": "../stark-core/node_modules/lodash-es/noop.js", - "lodash-es/sortBy": "../stark-core/node_modules/lodash-es/sortBy.js", - "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", - moment: "../stark-core/node_modules/moment/moment.js" -}; - -// start customizing the KarmaCI configuration from stark-testing -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 - }) - ] - } - } -}; +const rawKarmaConfig = require("../karma.conf.js").rawKarmaConfig; // export the configuration function that karma expects and simply return the stark configuration -module.exports = { - default: function(config) { - return config.set(starkUiSpecificConfiguration); - }, - karmaTypescriptBundlerAlias, - karmaTypescriptFiles: karmaTypescriptFiles +module.exports = config => { + return config.set(rawKarmaConfig); }; diff --git a/showcase/karma.conf.ci.js b/showcase/karma.conf.ci.js index 7b4bd85e5f..e3356dbbc7 100644 --- a/showcase/karma.conf.ci.js +++ b/showcase/karma.conf.ci.js @@ -2,15 +2,10 @@ * Load karma config from Stark */ const defaultKarmaCIConfig = require("./node_modules/@nationalbankbelgium/stark-testing/karma.conf.ci.js").rawKarmaConfig; -const karmaTypescriptBundlerAliasResolution = require("./karma.conf").karmaTypescriptBundlerAliasResolution; const karmaTypescriptExclusions = require("./karma.conf").karmaTypescriptExclusions; // start customizing the KarmaCI configuration from stark-testing const starkShowcaseSpecificConfiguration = Object.assign({}, defaultKarmaCIConfig, { - // change the module resolution for the KarmaTypescript bundler - karmaTypescriptConfig: Object.assign(defaultKarmaCIConfig.karmaTypescriptConfig, { - bundlerOptions: Object.assign(defaultKarmaCIConfig.karmaTypescriptConfig.bundlerOptions, karmaTypescriptBundlerAliasResolution) - }), exclude: [...defaultKarmaCIConfig.exclude, ...karmaTypescriptExclusions] }); diff --git a/showcase/karma.conf.js b/showcase/karma.conf.js index f3bd66c10f..4ff339e9d5 100644 --- a/showcase/karma.conf.js +++ b/showcase/karma.conf.js @@ -11,25 +11,8 @@ const defaultKarmaConfig = require("./node_modules/@nationalbankbelgium/stark-te // exclude all code example files imported in the demo pages const karmaTypescriptExclusions = [...defaultKarmaConfig.exclude, "src/assets/examples/**"]; -const karmaTypescriptBundlerAliasResolution = { - resolve: { - alias: { - // adapt the resolution of "angular-in-memory-web-api" modules because we don't want to add "@angular/http" to the Showcase npm dependencies! - // see https://github.com/angular/in-memory-web-api/issues/215 - "angular-in-memory-web-api/http-client-in-memory-web-api.module": - "./node_modules/angular-in-memory-web-api/bundles/in-memory-web-api.umd.js", - "angular-in-memory-web-api/interfaces": "./node_modules/angular-in-memory-web-api/bundles/in-memory-web-api.umd.js", - "@angular/http": "./node_modules/@angular/common/bundles/common-http.umd.js" - } - } -}; - // start customizing the KarmaCI configuration from stark-testing const starkShowcaseSpecificConfiguration = Object.assign({}, defaultKarmaConfig, { - // change the module resolution for the KarmaTypescript bundler - karmaTypescriptConfig: Object.assign(defaultKarmaConfig.karmaTypescriptConfig, { - bundlerOptions: Object.assign(defaultKarmaConfig.karmaTypescriptConfig.bundlerOptions, karmaTypescriptBundlerAliasResolution) - }), // list of files to exclude exclude: karmaTypescriptExclusions }); @@ -39,6 +22,5 @@ module.exports = { default: function(config) { return config.set(starkShowcaseSpecificConfiguration); }, - karmaTypescriptBundlerAliasResolution: karmaTypescriptBundlerAliasResolution, karmaTypescriptExclusions: karmaTypescriptExclusions };