-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apparently mocha-headless doesn’t work with newer Chrome/Chromium versions – it broke on my local system a while ago, and eventually also in CI. I haven’t been able to find a working replacement (Karma looked most promising, but seems to be married to RequireJS too tightly to support modules as test files), and in the meantime Node released experimental fetch() support – it’s not good enough to replace the axios backend (no cookie support), but enough to run the browser tests. So for now, we run the “browser” tests under Node as well, at least in CI and when you run `npm t`; but also add a browser-test.html file that can be loaded manually in a browser (using `python -m http.server` or equivalent – it won’t work using the file:// protocol), and tweak browser.test.js so that the Chai import works in Node and browser. This requires bumping the test-full CI job to Node 18; I’m generally happy to do that, since test-most (Node 12) still checks support for older Node versions, but at some point Node removed the --harmony-top-level-await option, so we need to tweak the test:readme command to retry running Node without it. (Fortunately we don’t have to repeat the sed command, when Node complains about the invalid option it doesn’t consume any stdin.) I hope to eventually replace this with proper testing in a browser again, see #23.
- Loading branch information
1 parent
42d2771
commit 2a8449f
Showing
6 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>m3api Browser Tests</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="stylesheet" href="node_modules/mocha/mocha.css" /> | ||
</head> | ||
<body> | ||
<div id="mocha"></div> | ||
|
||
<script src="node_modules/mocha/mocha.js"></script> | ||
<script class="mocha-init"> | ||
mocha.setup('bdd'); | ||
mocha.checkLeaks(); | ||
</script> | ||
|
||
<script type="module" src="test/integration/browser.test.js"></script> | ||
<script type="module">mocha.run()</script> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"rules": { | ||
"es/no-global-this": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters