Comments (14)
@caspark What is your version of minitest gem?
from knapsack_pro-ruby.
Sorry, should've included that already. Here are all the minitest-related gems we're using:
guard-minitest-2.4.6
minispec-metadata-3.3.1
minitest-5.13.0
minitest-reporters-1.4.2
minitest-retry-0.1.9
minitest-spec-rails-5.4.0
minitest-stub_any_instance-1.0.1
from knapsack_pro-ruby.
Can you double-check you have RAILS_ENV=test
set before running queue mode?
export RAILS_ENV=test
from knapsack_pro-ruby.
Here is how I run tests in queue mode for minitest
Maybe I should require 'minitest/spec'
as well
I'll try to play more with it tomorrow morning.
from knapsack_pro-ruby.
Yep, definitely setting RAILS_ENV
- invocation is along the lines of env CI_NODE_TOTAL=2 CI_NODE_INDEX=0 RACK_ENV=test KNAPSACK_GENERATE_REPORT=true KNAPSACK_REPORT_PATH=$KNAPSACK_REPORT_PATH KNAPSACK_PRO_BRANCH=SIP-799-knapsack-pro-hacking-local KNAPSACK_PRO_COMMIT_HASH=$(git rev-parse HEAD) KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST=<replaced> bundle exec rake knapsack_pro:queue:minitest
.
from knapsack_pro-ruby.
I managed to reproduce this bug on my local repo.
Can you update your test/test_helper.rb
and add there
# Allow context to be used like describe
class << self
alias :context :describe
end
I found this tip https://stackoverflow.com/a/25811713/905697
This is from my test_helper.rb
:
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
extend MiniTest::Spec::DSL
# Allow context to be used like describe
class << self
alias :context :describe
end
register_spec_type(self) do |desc|
desc < ActiveRecord::Base if desc.is_a?(Class)
end
end
from knapsack_pro-ruby.
Also, I found out if you use RSpec and minitest at the same time then RSpec overrides some stuff and minitest test inside of describe
blocks are not executed at all.
https://stackoverflow.com/questions/23683009/minitest-not-picking-up-describe-blocks
I had to disable loading RSpec when running minitest with ENV:
https://github.com/KnapsackPro/rails-app-with-knapsack_pro/blob/8f8d55a636f3b59d9558be8f0bc39e6bdb25c817/Gemfile#L65,L69
This is my example minitest test file with spec syntax describe/context
https://github.com/KnapsackPro/rails-app-with-knapsack_pro/blob/8f8d55a636f3b59d9558be8f0bc39e6bdb25c817/test/minitest/meme_spec_test.rb#L12,L17
from knapsack_pro-ruby.
@caspark Did my tips help?
from knapsack_pro-ruby.
@caspark Can you try the solution I posted? Thank you.
from knapsack_pro-ruby.
Sorry @ArturT , have been busy with other things. I suspect that aliasing context
-> describe
won't be sufficient (context
being undefined happened for this test case, but something else was undefined for another test case), but haven't tried it yet. Unfortunately with some PTO coming up I likely won't have time to try it any time soon. You can close this issue in the meantime, and if this approach doesn't work then I'll comment again when I have time to investigate further.
from knapsack_pro-ruby.
@caspark I will keep this issue open. You can get back to it when you find some time.
Do you use another test runner like RSpec? I noticed that loading RSpec gem breaks minitest. See my previous tip.
from knapsack_pro-ruby.
@caspark have you had a chance to revisit this issue?
from knapsack_pro-ruby.
No, sorry, haven't looked at this since.
(Also, no, not using an alternative test runner like rspec at the moment.)
from knapsack_pro-ruby.
@caspark If there is anything we can help with, please let me know. If you would revisit this issue that would be helpful. Otherwise, we are going to close this issue.
from knapsack_pro-ruby.
Related Issues (20)
- Include error messages from dry run json report in stdout when knapsack_pro:rspec_test_example_detector fails HOT 8
- rspec_junit_formatter still producing invalid XML after applying suggestion from #40 HOT 3
- Support for Github Actions job summaries HOT 5
- Queue mode causes rspec_junit_formatter to produce invalid XML when a node runs a spec with all examples commented out. HOT 5
- Thread.join causes knapsack to hang on circleCI HOT 13
- Enabled KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES and now get uninitialized constant at end of run HOT 10
- Regular mode (non-queue) rspec outputs all spec file names on startup HOT 4
- All examples skipped after exception in before: suite hook in queue mode HOT 2
- Memory leak HOT 2
- Lots of failures with rolify gem after 4.1 -> 5.0 bump HOT 12
- Docs need to specify ENV var to detect CI provider HOT 1
- Fail gracefully when there's no git HOT 8
- Running `git fetch --shallow-since` to fetch commit author log causes hang on Buildkite runners HOT 12
- rspec-core conflict HOT 4
- Running queue mode locally for troubleshooting with a small subset of tests, but with multiple batches HOT 6
- Does `rake knapsack_pro:rspec_test_example_detector` need to run if there aren't any slow specs? HOT 2
- Slow test analysis runs even when there's no slow tests HOT 2
- Disable example_status_persistence_file_path HOT 3
- Create a replication command on failed node HOT 2
- Incompatibility with rspec --options on 6.0+ HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knapsack_pro-ruby.