-
-
Notifications
You must be signed in to change notification settings - Fork 708
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
Knapsack pro 7.1.0 #12447
Knapsack pro 7.1.0 #12447
Conversation
Bumps [knapsack_pro](https://github.com/KnapsackPro/knapsack_pro-ruby) from 6.0.4 to 7.1.0. - [Changelog](https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/CHANGELOG.md) - [Commits](KnapsackPro/knapsack_pro-ruby@v6.0.4...v7.1.0) --- updated-dependencies: - dependency-name: knapsack_pro dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Knapsack is replacing some of the RSpec logic, like running before-suite and before-all hooks. Loading the spec helper early means that Knapsack knows about the asset compilation hook when it loads the next batch of specs.
The KnapsackPro queue mode can't predict which specs it will run. So we need to check on each file (top-level describe block) which type of spec it is and if we need to compile assets for it. Old versions of KnapsackPro would execute the `before(:suite)` hooks on every batch, but now it's only run once. With this change, we do the same as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one, it's a surprisingly small change in the end !
Hi @ArturT, nice to see you here. There may be an issue with the execution of
Is the above theory right? Could Knapsack first load the spec file and then run the hooks including one that were just added by loading a spec helper? It's quite common to load additional spec helper files, possibly with new RSpec hooks, within certain spec files. |
Just a thought: I wonder if Knapsack could override the rspec examples method, and raise an exception explaining that you can't use it there. |
Compared with another recent build on master, the overall runtime was reduced by 5min. |
Hi @mkllnk
Yes.
Yes. The test files are loaded after before(:suite) has been executed.
The The change introduced in 7.0.1 The Tests are dynamically fetched in batches from Knapsack Pro Queue API and loaded after If you need to load a specific hook only once for a certain type of tests, you can look at this: |
@dacook Perhaps we could detect that you defined |
I totally understand the Anyway, thank you for all the documentation. I didn't know about |
@mkllnk I think the reason is that your Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f } It means The knapsack_pro gem loads |
I'm not sure if it's worth investigating further, but just for clarification: The problem was solved by loading the base_spec_helper.rb in the |
What? Why?
Knapsack Pro 7 changed the timing of calling RSpec's before-suite calls. Since they are, correctly, only called once before the suite, our before-suite call to compile assets when needed failed. In queue mode, there are no examples loaded yet when the before-suite hook is called and therefore we don't know yet if we need to compile assets or not.
Now we load the RSpec hooks early for Knapsack Pro to recognise them and we check for asset compilation before each batch.
What should we test?
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates