Skip to content

Commit

Permalink
tests: added JSON-RPC tests to web browser CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jan 13, 2025
1 parent afd613a commit 1c0c23c
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib.commonjs/_tests/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "./test-hash-typeddata.js";
import "./test-providers-avatar.js";
import "./test-providers-ccip.js";
import "./test-providers-fallback.js";
import "./test-providers-send.js";
import "./test-providers-jsonrpc.js";
import "./test-providers-wildcard.js";
import "./test-rlp.js";
import "./test-transaction.js";
Expand Down
2 changes: 1 addition & 1 deletion lib.commonjs/_tests/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib.commonjs/_tests/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.commonjs/_tests/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.esm/_admin/test-browser.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions lib.esm/_admin/test-browser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.esm/_admin/test-browser.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib.esm/_tests/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "./test-hash-typeddata.js";
import "./test-providers-avatar.js";
import "./test-providers-ccip.js";
import "./test-providers-fallback.js";
import "./test-providers-send.js";
import "./test-providers-jsonrpc.js";
import "./test-providers-wildcard.js";
import "./test-rlp.js";
import "./test-transaction.js";
Expand Down
2 changes: 1 addition & 1 deletion lib.esm/_tests/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib.esm/_tests/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.esm/_tests/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions src.ts/_admin/test-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ const TestData = (function() {
const tag = filename.split(".")[0];
data.push(`fs.set(${ JSON.stringify(tag) }, ${ JSON.stringify(load(tag)) });`);
}

data.push(`export function loadTests(tag) {`);
data.push(` const data = fs.get(tag);`);
data.push(` if (data == null) { throw new Error("missing tag: " + tag); }`);
Expand All @@ -220,12 +221,18 @@ const TestData = (function() {
data.push(` return JSON.parse(ethers.toUtf8String(result))`);
data.push(`}`);
data.push(``);
data.push(`export const FAUCET_PRIVATEKEY = ${ JSON.stringify(process.env.FAUCET_PRIVATEKEY) };`);

try {
data.push(`export const FAUCET_PRIVATEKEY = ${ JSON.stringify(process.env.FAUCET_PRIVATEKEY || "0x0123456789012345678901234567890123456789") };`);
} catch (e) {
console.log(e);
data.push(`export const FAUCET_PRIVATEKEY = "0x0123456789012345678901234567890123456789";`);
}
data.push(``);

return data.join("\n");
})();


export function start(_root: string, options: Options): Promise<Server> {

if (options == null) { options = { }; }
Expand Down Expand Up @@ -348,7 +355,7 @@ export function start(_root: string, options: Options): Promise<Server> {

const cmd = cmds[0];

const args = [ "--headless", "--disable-gpu", "--remote-debugging-port=8023" ];
const args = [ "--headless", "--disable-gpu", "--remote-debugging-port=8022" ];
const browser = child_process.spawn(cmd, args);

let url: string = await new Promise((resolve, reject) => {
Expand Down Expand Up @@ -377,6 +384,7 @@ export function start(_root: string, options: Options): Promise<Server> {
const status = await session.done;
console.log("STATUS:", status);
process.exit(status);

})().catch((error) => {
console.log("ERROR");
console.log(error);
Expand Down
4 changes: 2 additions & 2 deletions src.ts/_tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import "./test-providers-ccip.js";
//import "./test-providers-errors.js";
//import "./test-providers-extra.js";
import "./test-providers-fallback.js";
//import "./test-providers-jsonrpc.js";
import "./test-providers-send.js";
import "./test-providers-jsonrpc.js";
//import "./test-providers-send.js";
import "./test-providers-wildcard.js";
import "./test-rlp.js"
import "./test-transaction.js";
Expand Down

0 comments on commit 1c0c23c

Please sign in to comment.