-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add fail-fast option #226
feat: add fail-fast option #226
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #226 +/- ##
==========================================
+ Coverage 92.49% 92.53% +0.04%
==========================================
Files 27 27
Lines 1998 2010 +12
Branches 214 212 -2
==========================================
+ Hits 1848 1860 +12
Misses 143 143
Partials 7 7 ☔ View full report in Codecov by Sentry. |
Muito obrigado, @rodrigo-militao 🚀 Estou pensando se tem uma forma simples de aplicar essa feature na execução paralela: poku/src/services/run-tests.ts Lines 75 to 99 in 5f80fa3
Onde a execução dos testes ocorrem aqui: poku/src/services/run-tests.ts Line 96 in 5f80fa3
|
Mestre, depois de algumas tentativas .. só obtive sucesso utilizando um Assim ficaria: export const runTestsParallel = async (
dir: string,
configs?: Configs
): Promise<boolean> => {
const cwd = process.cwd();
const testDir = path.join(cwd, dir);
const files = IS_FILE(dir) ? [dir] : listFiles(testDir, undefined, configs);
try {
const promises = files.map(async (filePath) => {
const testPassed = await runTestFile(filePath, configs);
if (!testPassed) {
++results.fail;
if (configs?.fastFail)
throw new Error('Test failed with fastFail enabled');
return false;
}
++results.success;
return true;
});
const concurrency = await Promise.all(promises);
return concurrency.every((result) => result);
} catch (error) {
return false;
}
}; |
@rodrigo-militao, parece uma boa abordagem (e bem simples, inclusive) 🌞 |
@rodrigo-militao, muito obrigado pela contribuição 🤝 |
Fail Fast
By setting
failFast
totrue
, Poku will stop the tests at the first failure.API (in-code)
CLI