Skip to content

Commit c823bae

Browse files
committed
Get Vault generator and its tests running in the browser
1 parent 44e3b23 commit c823bae

7 files changed

Lines changed: 32 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.keychain
22
node_modules
33
package-lock.json
4-
spec/*bundle*
4+
test/browser/*bundle*

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ PATH := node_modules/.bin:$(PATH)
44
.PHONY: all clean
55

66
all:
7-
webpack --display-modules --watch
7+
esbuild --bundle --sourcemap --watch \
8+
test/browser/index.js \
9+
--outfile=test/browser/bundle.js
810

911
clean:
10-
rm -rf spec/browser_bundle.js*
12+
rm -rf test/browser/bundle*

lib/crypto/web_crypto.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const { Buffer } = require('buffer')
34
const { subtle } = crypto
45

56
function randomBytes (n) {

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
"preferGlobal": true,
2020
"dependencies": {
2121
"@escodb/core": "github:escodb/core",
22+
"buffer": "^6.0.3",
2223
"prompt": "~1.3.0",
2324
"sequin": "~0.1.0",
2425
"ssh-agent": "~0.2.1"
2526
},
2627
"devDependencies": {
2728
"chai": "^4.5.0",
29+
"esbuild": "^0.25.5",
2830
"mocha": "^9.2.2",
2931
"sinon": "^9.2.4"
3032
},

spec/index.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/browser/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Vault test suite</title>
6+
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css">
7+
</head>
8+
<body>
9+
10+
<div id="mocha"></div>
11+
12+
<script src="../../node_modules/mocha/mocha.js"></script>
13+
<script src="./bundle.js"></script>
14+
15+
</body>
16+
</html>

test/browser/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict'
2+
3+
mocha.setup('bdd')
4+
mocha.checkLeaks()
5+
6+
require('../vault_test')
7+
8+
mocha.run()

0 commit comments

Comments
 (0)