test: remove timeout from login test

This commit is contained in:
thecodrr
2021-09-13 11:08:28 +05:00
parent 92537acca9
commit e9780306c7
5 changed files with 18 additions and 49 deletions

View File

@@ -1,39 +0,0 @@
const find = require("find-process");
const { p, updateSnapshots, file, noServer } = argv;
if (!noServer) {
await killServer();
const res = nothrow($`yarn debug -p ${p || 3000}`);
res.stdout.on("data", async (data) => {
const message = data.toString();
if (
message.includes("create a production build, use yarn build.") ||
message.includes("Compiled with warnings")
) {
const testRes = await startTestRunner();
await killServer();
process.exit(testRes.exitCode);
}
});
} else {
const testRes = await startTestRunner();
process.exit(testRes.exitCode);
}
async function killServer() {
const nodeProcesses = await find("name", "node");
const reactServerProcesses = nodeProcesses.filter((p) =>
p.cmd.includes("react-scripts")
);
for (let rprocess of reactServerProcesses) {
process.kill(rprocess.pid, "SIGINT");
}
}
async function startTestRunner() {
if (!updateSnapshots && !file) return $`yarn playwright test`;
else if (updateSnapshots && file) return $`yarn playwright test -u ${file}`;
else if (file) return $`yarn playwright test ${file}`;
else if (updateSnapshots) return $`yarn playwright test -u`;
}