Include imports in generated test files #214
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pr fixes an issue here: #136
When running tests which are in JSON mode, the test runner generates the test files for them. Under certain circumstances, these tests fail and are attempted to be restarted. From the error snippet below, we see that setupPage isn't imported into these files, this can be verified by checking the generated files code.
Impact of the issue
This issue is currently causing our pipeline to be very flaky. The problem seems to be occurring once every 4 runs and I can only assume it'll get worse as we increase our storybook count. We currently have about 30.
Fix
I've just added the existing filePrefixer to the generated codes. This contains the required imports and solves the issue. I have also updated the tests accordingly.
Testing and Impact
I have built and tested a build generated from this branch on our pipeline. These changes only affect other Json mode stories ( in theory)