KnapsackPro / knapsack-pro-js

Run your 1-hour test suite in 2 minutes with optimal parallelisation on your existing CI infrastructure
https://knapsackpro.com
MIT License
3 stars 0 forks source link

Use 0 seconds as execution time when a test file was not executed by test runner #22

Open ArturT opened 5 years ago

ArturT commented 5 years ago

This should help with edge case when test file cannot be executed by test runner and because of that we won't record timing of that test file.

Edge case could happen when:

In such case, we could assume the test file has some default timing like 0.1s of 0 seconds.

Solution idea

We should improve this part of code:

// src/knapsack-pro-core.ts
        onSuccess(queueTestFiles).then(({ recordedTestFiles, isTestSuiteGreen }) => {
          // here we should take all tests from queueTestFiles and assume 0s of execution time for them
          // and merge them with recordedTestFiles.
          // In case recordedTestFiles has less test files than queueTestFiles then 
          // we would have 0s execution time for not executed test files by test runner
          // recordedTestFiles could have less tests when the test runner like Cypress/Jest won't be able to run it and it won't report the test file back to us
          this.recordedTestFiles = this.recordedTestFiles.concat(recordedTestFiles);
          this.isTestSuiteGreen = this.isTestSuiteGreen && isTestSuiteGreen;

          this.fetchTestsFromQueue(false, onSuccess, onFailure);
        });

Related

A similar issue was solved here: https://github.com/KnapsackPro/knapsack_pro-ruby/pull/71 (this is old PR, we should use 0s as default time for not executed tests).

ArturT commented 4 years ago

Just note: It's possible now to set tests timing to 0 seconds. Knapsack Pro API will accept such time. When tests will be split in the queue then tests with 0 seconds will be served one by one similar as test file with not recorded time.

ArturT commented 1 year ago

Use 0 seconds as execution time when a test file was not executed by a test runner (Cypress/Jest)

This issue solves 2 problems:

solution

Should be done on @knapsack-pro/core level as described in the PR description.

story

https://trello.com/c/voKluDGW