Skip to content

Commit

Permalink
[BREAKING] Require karma >= 4.3.0
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
The ui5 framework is now initialized asynchronous, which is only
supported starting with karma v4.3.0.
  • Loading branch information
matz3 committed Apr 2, 2020
1 parent fbfcb09 commit ee0dbc0
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 105 deletions.
9 changes: 2 additions & 7 deletions lib/framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Framework {
config.files.unshift(this.createPluginFilesPattern(`${__dirname}/client/sap-ui-config.js`));
}

init({config, logger}) {
async init({config, logger}) {
this.config = config;
this.logger = logger.create("ui5.framework");
this.config.basePath = config.basePath || "";
Expand Down Expand Up @@ -268,12 +268,7 @@ class Framework {
}

// this.addPreprocessor();
this.setupMiddleware().catch((error) => {
this.logger.log("error", error);
// Can't throw an error here as it won't be caught
// Therefore just killing the process...
process.exit(1);
});
await this.setupMiddleware();
return this;
}

Expand Down
12 changes: 10 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
const {ErrorMessage} = require("./errors");
const Framework = require("./framework");
const framework = new Framework();

function init(config, logger) {
framework.init({config, logger});
async function init(config, logger) {
try {
await framework.init({config, logger});
} catch (error) {
const _logger = logger.create("ui5.framework");
_logger.log("error", error.message);
_logger.log("debug", error.stack);
throw new Error(ErrorMessage.failure());
}
}

init.$inject = ["config", "logger"];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version"
},
"peerDependencies": {
"karma": ">= 1.7.1"
"karma": ">= 4.3.0"
},
"dependencies": {
"@ui5/fs": "^2.0.0",
Expand Down
Loading

0 comments on commit ee0dbc0

Please sign in to comment.