diff --git a/packages/devp2p/examples/simple.ts b/packages/devp2p/examples/simple.ts index 817f5940f3..ec9da7871e 100644 --- a/packages/devp2p/examples/simple.ts +++ b/packages/devp2p/examples/simple.ts @@ -43,5 +43,5 @@ for (const bootnode of BOOTNODES) { } setTimeout(() => { - process.exit() + throw new Error('Test timed out') }, TIMEOUT) diff --git a/packages/vm/examples/run-blockchain.ts b/packages/vm/examples/run-blockchain.ts index 2bf149bcf7..e9e5ff1840 100644 --- a/packages/vm/examples/run-blockchain.ts +++ b/packages/vm/examples/run-blockchain.ts @@ -94,8 +94,3 @@ async function putBlocks(blockchain: Blockchain, common: Common, data: typeof te } main() - .then(() => process.exit(0)) - .catch((err) => { - console.error(err) - process.exit(1) - }) diff --git a/packages/vm/examples/run-solidity-contract.ts b/packages/vm/examples/run-solidity-contract.ts index be27a79ccc..8fad4f84c5 100644 --- a/packages/vm/examples/run-solidity-contract.ts +++ b/packages/vm/examples/run-solidity-contract.ts @@ -228,8 +228,3 @@ async function main() { } main() - .then(() => process.exit(0)) - .catch((err) => { - console.error(err) - process.exit(1) - }) diff --git a/packages/vm/examples/vmWithGenesisState.ts b/packages/vm/examples/vmWithGenesisState.ts index 248e48b102..892d360e9f 100644 --- a/packages/vm/examples/vmWithGenesisState.ts +++ b/packages/vm/examples/vmWithGenesisState.ts @@ -12,6 +12,7 @@ const main = async () => { const account = await vm.stateManager.getAccount( createAddressFromString('0x000d836201318ec6899a67540690382780743280'), ) + console.log(account) console.log( `This balance for account 0x000d836201318ec6899a67540690382780743280 in this chain's genesis state is ${Number( account?.balance, diff --git a/scripts/examples-runner.ts b/scripts/examples-runner.ts index 62d60db054..0537b46c8e 100644 --- a/scripts/examples-runner.ts +++ b/scripts/examples-runner.ts @@ -1,5 +1,5 @@ +import { readdirSync } from 'fs' import { extname, join } from 'path' -import { readdir } from 'fs' const pkg = process.argv[3] if (!pkg) { @@ -9,17 +9,16 @@ if (!pkg) { const examplesPath = `../packages/${pkg}/examples/` const path = join(__dirname, examplesPath) -readdir(path, async (err, files) => { - if (err) { - throw new Error('Error loading examples directory: ' + err.message) - } - - const getTsFiles = (fileName: string): Promise | undefined => { - if (extname(fileName) === '.cts' || extname(fileName) === '.ts') { - return import(examplesPath + fileName) - } +const getTsFiles = (fileName: string): Promise | undefined => { + if (extname(fileName) === '.cts' || extname(fileName) === '.ts') { + return import(examplesPath + fileName) } +} +const main = async () => { + const files = readdirSync(path) const importedFiles = files.map(getTsFiles).filter((file) => file) await Promise.all(importedFiles) -}) +} + +main()