Skip to content

Commit

Permalink
(chore) remove hard coded version check
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Apr 13, 2021
1 parent 562662e commit 55c8e61
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions test/builds/browser_build_as_commonjs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
const hljs = require("../../build/highlight");

let major = parseInt(majorVersion=hljs.versionString.split("."))
if (major != 10) {
process.exit(1)
}
const API = [
"getLanguage",
"registerLanguage",
"highlight",
"highlightAuto",
"highlightAll",
"highlightElement"
];

const assert = (f,msg) => {
if (!f()) {
console.error(msg);
process.exit(1);
}
};
const keys = Object.keys(hljs);

API.forEach(n => {
assert(_ => keys.includes(n), `API should include ${n}`);
});

console.log("Pass: browser build works with Node.js just fine.")

0 comments on commit 55c8e61

Please sign in to comment.