-
Notifications
You must be signed in to change notification settings - Fork 672
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
Remove regex check for test files #2074
Comments
Hi @bdwain, In your example, simple parsing of the We can't get fixture/test names during script execution, because it can cause side effects. E.g. you have a |
Could the regex just be removed and not replaced then? It seems like it’s only used to filter out source files that have no tests and fixtures. But you could just assume there are tests in each file and error if there are not.
My example works if I just add a commented out test, so it seems like actually checking is unnecessary.
…On Jan 26, 2018, 6:47 AM -0600, Boris Kirov ***@***.***>, wrote:
Hi @bdwain,
In your example, simple parsing of the main test file won't find the fixture as well.
Besides, it'll be much slower than regexp. If we start parsing all dependencies, it can require much time, because it should also parse all your modules/libraries/node_modules... which were imported in the test file.
We can't get fixture/test names during script execution, because it can cause side effects. E.g. you have a .js file to setup test database script in a directory with tests. We can't execute it to check if it's a fixture file. So we need static file analysis anyway.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yes, it's correct.
As I said before, we can't run every file by glob patterns like testcafe chrome tests/**/*.js instead of testcafe chrome tests/e2e/fixtures/**/*.js It can matter if you're going to add testcafe tests to an existing project with a complex directory structure. |
I am already using the node api. Could the regex check be disabled with an option then? This way it's a new behavior that only affects people who opt-in. something like runner.run({runAllFiles: true}) |
Unfortunately, we wouldn't like to add an option that can cause unexpected effects on a user's computer. As a workaround, you can regroup tests or change a directory structure. |
@kirovboris It would not be an unexpected effect. The entire point of the option is to run every file in the user's regex, so if they enable it, they should know what it does (and it would presumably be explained in the docs). This would prevent needing a hacky workaround to share suites across different files, so I really think it's something that should be addressed. |
Any update on this? In order to share suites across files I have to add something like
to my files, which is extremely hack-y... |
I also think these regexes should be removed for two reasons:
I also do not agree with @kirovboris's previous points:
Most people probably name their tests files something like For now I will put a comment like this into every test file:
Which unlike Evan's solution does not require any actual code but still is very hack-y. |
agreed with @bxt . bump. This issue really should be addressed. |
awesome! thanks! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow. |
Are you requesting a feature or reporting a bug?
request a feature
What is the current behavior?
There are regexes that each test file is run against, and if they do not match, you get an error
What is the desired behavior?
Can this regex test be disabled and instead look for tests when actually running/parsing the code? I've found valid use cases where those regexes might not match.
In my project, I've broken up my app into several "subapp" libraries, and each subapp exports a suite of tests, which are run in the main repo's testcafe suite.
for example:
library test file
main test file
currently, this fails when i try to run the tests pointing at the main test file. However, it works if i add a commented out fixture and test. Ideally, I would not need to add a commented out fixture and test just to satisfy the regex.
The text was updated successfully, but these errors were encountered: