Use Cypress config file to determine where test source files are located
Opened this issue · 3 comments
Cypress already has a config file that says where the test source files are located. We could use that. Thanks to that user would not have to set KNAPSACK_PRO_TEST_FILE_PATTERN
if he keeps tests in non-standard directory.
Here is an example of how to define a node-glob pattern for KNAPSACK_PRO_TEST_FILE_PATTERN
.
https://knapsackpro.com/faq/question/how-to-run-tests-only-from-specific-directory-in-cypress
I'm not sure if the issue still makes sense. I think the option to set your own KNAPSACK_PRO_TEST_FILE_PATTERN
gives users more flexibility. For instance, you can run 2 different sets of tests on CI by specifying different KNAPSACK_PRO_TEST_FILE_PATTERN
values per the @knapsack-pro/cypress
command.
I'd like to hear feedback from users. What's your use case? Do you always have a single pattern in your cypress.config.js
file? Do you use a few patterns? How?
Here is another related solution.
We've released the @knapsack-pro/cypress
5.3.0 version. Here is an example of how to use KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE
to define a list of test files in the .txt
file.
KnapsackPro/knapsack-pro-core-js#62
You could generate any list of test files you like and provide it to Knapsack Pro.
I feel like this feature is a bit Cypress-specific and further away from how the Knapsack Pro architecture works now.
But maybe it could be combined with KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE
. For example, we could detect test files based on the pattern defined in the cypress config file and then feed the txt file defined with KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE
.
https://docs.knapsackpro.com/cypress/reference/#knapsack_pro_test_file_list_source_file