Skip to content

Commit

Permalink
Fix karma configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover committed Apr 22, 2020
1 parent a5fcb31 commit b54665f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/legacy/core_plugins/tests_bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ export default kibana => {
.type('text/css');
},
});

// Sets global variables normally set by the bootstrap.js script
kbnServer.server.route({
path: '/test_bundle/karma/globals.js',
method: 'GET',
async handler(req, h) {
const basePath = config.get('server.basePath');

const file = `window.__kbnPublicPath__ = { 'kbn-ui-shared-deps': "${basePath}/bundles/kbn-ui-shared-deps/" };`;

return h.response(file).header('content-type', 'application/json');
},
});
},

__globalImportAliases__: {
Expand Down
2 changes: 2 additions & 0 deletions tasks/config/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ module.exports = function(grunt) {
function getKarmaFiles(shardNum) {
return [
'http://localhost:5610/test_bundle/built_css.css',
// Sets global variables normally set by the bootstrap.js script
'http://localhost:5610/test_bundle/karma/globals.js',

...UiSharedDeps.jsDepFilenames.map(
chunkFilename => `http://localhost:5610/bundles/kbn-ui-shared-deps/${chunkFilename}`
Expand Down

0 comments on commit b54665f

Please sign in to comment.