Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

run tests in series instead of parallel

+51 -50
+51 -50
js/desktop/src/tests/test-runner.ts
··· 34 34 testFuncs.push(allTests[test]); 35 35 } 36 36 try { 37 - const results = await Promise.all( 38 - testFuncs.map(async (test) => { 39 - let testProc: ChildProcess | undefined; 40 - try { 41 - const { skipNode } = getEnv(); 42 - const hexKey = privateKey.slice(2); // Remove 0x prefix 43 - const exportedKey = new Uint8Array( 44 - hexKey.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)), 45 - ); 46 - const multibaseKey = bytesToMultibase(exportedKey, "base58btc"); 47 - const account = privateKeyToAccount(privateKey); 48 - const tmpDir = await fs.mkdtemp( 49 - path.join(os.tmpdir(), "streamplace-test-"), 50 - ); 37 + const results = []; 38 + for (const test of testFuncs) { 39 + let testProc: ChildProcess | undefined; 40 + try { 41 + const { skipNode } = getEnv(); 42 + const hexKey = privateKey.slice(2); // Remove 0x prefix 43 + const exportedKey = new Uint8Array( 44 + hexKey.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)), 45 + ); 46 + const multibaseKey = bytesToMultibase(exportedKey, "base58btc"); 47 + const account = privateKeyToAccount(privateKey); 48 + const tmpDir = await fs.mkdtemp( 49 + path.join(os.tmpdir(), "streamplace-test-"), 50 + ); 51 51 52 - let testEnv: TestEnv = { 53 - addr: "http://127.0.0.1:38080", 54 - internalAddr: "http://127.0.0.1:39090", 55 - privateKey: privateKey, 56 - publicAddress: account.address.toLowerCase(), 57 - testDuration: parseInt(duration), 58 - multibaseKey, 59 - env: {}, 52 + let testEnv: TestEnv = { 53 + addr: "http://127.0.0.1:38080", 54 + internalAddr: "http://127.0.0.1:39090", 55 + privateKey: privateKey, 56 + publicAddress: account.address.toLowerCase(), 57 + testDuration: parseInt(duration), 58 + multibaseKey, 59 + env: {}, 60 + }; 61 + if (!skipNode) { 62 + testEnv.env = { 63 + SP_HTTP_ADDR: `127.0.0.1:${randomPort()}`, 64 + SP_HTTP_INTERNAL_ADDR: `127.0.0.1:${randomPort()}`, 65 + SP_DATA_DIR: tmpDir, 60 66 }; 61 - if (!skipNode) { 62 - testEnv.env = { 63 - SP_HTTP_ADDR: `127.0.0.1:${randomPort()}`, 64 - SP_HTTP_INTERNAL_ADDR: `127.0.0.1:${randomPort()}`, 65 - SP_DATA_DIR: tmpDir, 66 - }; 67 - } 68 - if (test.setup) { 69 - testEnv = await test.setup(testEnv); 70 - } 71 - if (!skipNode) { 72 - const { addr, internalAddr, proc } = await makeNode({ 73 - env: testEnv.env, 74 - autoQuit: false, 75 - }); 76 - testEnv.addr = addr; 77 - testEnv.internalAddr = internalAddr; 78 - testProc = proc; 79 - } 80 - return await test.test(testEnv); 81 - } catch (e) { 82 - console.error("error running test", e.message); 83 - } finally { 84 - if (testProc) { 85 - testProc.kill("SIGTERM"); 86 - } 67 + } 68 + if (test.setup) { 69 + testEnv = await test.setup(testEnv); 70 + } 71 + if (!skipNode) { 72 + const { addr, internalAddr, proc } = await makeNode({ 73 + env: testEnv.env, 74 + autoQuit: false, 75 + }); 76 + testEnv.addr = addr; 77 + testEnv.internalAddr = internalAddr; 78 + testProc = proc; 79 + } 80 + const result = await test.test(testEnv); 81 + results.push(result); 82 + } catch (e) { 83 + console.error("error running test", e.message); 84 + results.push(e.message); 85 + } finally { 86 + if (testProc) { 87 + testProc.kill("SIGTERM"); 87 88 } 88 - }), 89 - ); 89 + } 90 + } 90 91 const failures = results.filter((r) => r !== null); 91 92 if (failures.length > 0) { 92 93 console.error("tests failed", failures.join(", "));