Skip to content

Commit

Permalink
fix(stark-ui): fix wrong code coverage report generation path in karm…
Browse files Browse the repository at this point in the history
…a CI config (bug introduced in NationalBankBelgium#1147)
  • Loading branch information
christophercr committed Apr 9, 2019
1 parent 600f88e commit 8d656e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
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
9 changes: 5 additions & 4 deletions packages/stark-rbac/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,23 @@ const karmaTypescriptBundlerAliasResolution = {
// 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
14 changes: 8 additions & 6 deletions packages/stark-ui/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,28 @@ const karmaTypescriptBundlerAlias = {
};

// 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

0 comments on commit 8d656e6

Please sign in to comment.