Skip to content

Commit 1fd24ca

Browse files
feat: added browser example (#72)
* feat: added browser example * formatting * fix: remove unnecessary script * chore: delete package-lock.json
1 parent 161148e commit 1fd24ca

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

packages/browser/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Browser Example
2+
3+
See full documentation about [running Mocha in the browser](https://mochajs.org/#running-mocha-in-the-browser).
4+
5+
After `npm install`, open `index.html` in a browser.

packages/browser/index.html

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Mocha Tests</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<link rel="stylesheet" href="node_modules/mocha/mocha.css" />
8+
</head>
9+
<body>
10+
<div id="mocha"></div>
11+
12+
<script src="node_modules/chai/chai.js"></script>
13+
<script src="node_modules/mocha/mocha.js"></script>
14+
15+
<script class="mocha-init">
16+
mocha.setup("bdd");
17+
mocha.checkLeaks();
18+
</script>
19+
<script src="test.example.js"></script>
20+
<script class="mocha-exec">
21+
mocha.run();
22+
</script>
23+
</body>
24+
</html>

packages/browser/package.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "example-browser",
3+
"version": "1.0.0",
4+
"description": "Browser example",
5+
"engines": {
6+
"node": ">=10.0.0"
7+
},
8+
"license": "ISC",
9+
"devDependencies": {
10+
"chai": "^4.4.1",
11+
"mocha": "latest"
12+
}
13+
}

packages/browser/test.example.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe("example", () => {
2+
it("2 + 2", () => {
3+
chai.expect(2 + 2).to.be.eql(4);
4+
});
5+
});

0 commit comments

Comments
 (0)