{"id":25180373,"url":"https://github.com/floraison/probatio","last_synced_at":"2025-05-07T06:04:32.181Z","repository":{"id":268850172,"uuid":"905128405","full_name":"floraison/probatio","owner":"floraison","description":"testing tools for floraison and flor","archived":false,"fork":false,"pushed_at":"2025-05-07T05:56:52.000Z","size":153,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T06:04:27.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/floraison.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-18T08:10:22.000Z","updated_at":"2025-05-07T05:56:55.000Z","dependencies_parsed_at":"2024-12-19T09:35:07.916Z","dependency_job_id":"2f1d665f-b30f-4856-bf80-6469bbc8813c","html_url":"https://github.com/floraison/probatio","commit_stats":null,"previous_names":["floraison/probatio"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floraison%2Fprobatio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floraison%2Fprobatio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floraison%2Fprobatio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floraison%2Fprobatio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floraison","download_url":"https://codeload.github.com/floraison/probatio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252823920,"owners_count":21809713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-09T16:17:49.523Z","updated_at":"2025-05-07T06:04:32.172Z","avatar_url":"https://github.com/floraison.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# probatio\n\n\u003c!-- [![tests](https://github.com/floraison/fugit/workflows/test/badge.svg)](https://github.com/floraison/fugit/actions) --\u003e\n[![Gem Version](https://badge.fury.io/rb/probatio.svg)](https://badge.fury.io/rb/probatio)\n\nTest tools for floraison and flor. Somewhere between Minitest and Rspec, but not as excellent.\n\n\n## Goals\n\n* versatile `bundle exec proba`, run this or these tests, at the line\n* `bundle exec proba first` for first failing tests\n* `bundle exec proba last` for last failing tests\n* `bundle exec proba .` for the test currently edited `.test-point`\n* `bundle exec proba f` for the test file currently edited `.test-point`\n* `bundle exec proba list.txt` to run a list of tests\n* `bundle exec proba list.rb` to run a list of tests (Ruby array)\n\n\n## Usage\n\n```\nUsage: bundle exec proba [OPTIONS] [DIRS] [FILES] [OTHERS] [ENVS]\n\n  A test runner for Ruby.\n\n  Options:\n    -h, --help             Show this help message and quit\n    --version              Show proba's version and exit\n    -c, --color            Enable colour output anyway\n    -C, --no-color         Disable colour output\n    -y, --dry              Don't run the tests, just flag them as successes\n    -n, --name PATTERN     include tests matching /regexp/ or string in run\n    -e, --exclude PATTERN  Exclude /regexp/ or string from run\n    -p, --print            Dumps the test tree\n    -m, --map              Dumps the test file map\n    -s, --seed             Sets random seed\n    -d, --debug smr        's' for start opts, 'm' for messages, 'r' for $DEBUG\n    -x, --example          Outputs an example test file\n    -X, --plugin-example   Outputs an example plugin file\n    --mangle               Turns the given _spec.rb files into proba _test.rb\n\n  Dirs:\n    Defaults to test/ if no files nor dir are given.\n    Probatio will look at all the *_helper[s].rb, *_test[s].rb files\n    under the given dirs and also at the setup.rb, *_setup.rb files\n\n  Files:\n    List of test files to scan for tests.\n    A file may end with `:123` to indicate that the test at line 123 should\n    be run. Multiple \"colon-lnumber\" suffixes may be specified, as in\n    `test/fun/that_test.rb:123:456`\n\n  Others:\n    Short codes like\n    * `bundle exec proba -1`\n    * `bundle exec proba last` run the last failing test of the last run\n    * `bundle exec proba first`\n    * `bundle exec proba 1st`\n    * `bundle exec proba 0` run the first failing test of the last run\n  Lists:\n    * `bundle exec proba list.txt` will run all the tests in list.txt\n    * `bundle exec proba a_list.rb` will eval and lists the arrayed tests\n\n\n  Envs:\n    Short FULLCAPS environment variable setters driven by a\n    `.probatio-environments.rb` file in the current work directory.\n\n    ```\n    # .probatio-environments.rb\n    {\n      D: { 'FLOR_DEBUG' =\u003e 'dbg,stdout' },\n      DD: { 'FLOR_DEBUG' =\u003e 'dbg,sto,stdout' },\n    }\n    ```\n\n  Examples:\n    # Run all tests in a dir\n    bundle exec proba test/\n\n    # Run all the tests in a file\n    bundle exec proba test/this_test.rb\n```\n\n## Test files\n\nBy default probatio looks into `test/` for test files ending in `_test.rb` or `_tests.rb` but first look at helpers ending in `_helper.rb` or `_helpers.rb`.\n\nA typical test hierarchy:\n```\ntest/\n|-- helpers/\n|   |-- some_helpers.rb\n|   `-- some_other_helpers.rb\n|-- this_test.rb\n|-- that_test.rb\n`-- more_tests.rb\n```\n\n```ruby\ngroup 'core' do\n\n  setup do\n    # occurs once before tests and sub-groups in group 'core'\n  end\n  teadowm do\n    # occurs once after tests and sub-groups in group 'core'\n  end\n\n  group 'alpha' do\n\n    before do\n      # is run in the separate test context before _each_ test\n    end\n    after do\n      # is run in the separate test context after _each_ test\n    end\n\n    test 'one' do\n\n      MyLib.do_this_or_that()\n\n      assert_nil nil\n      assert_not_nil [], 1\n\n      assert_true true\n      assert_false 1 \u003e 2\n\n      assert_truthy \"yes\", \"no\"\n      assert_trueish \"yes\", \"no\"\n      assert_falsy nil, false\n      assert_falsey nil, false\n      assert_falseish nil, false\n\n      assert_any %w[ an array ], 'a string'\n      assert_empty [], ''\n\n      assert_size [], 0\n      assert_size 'foo', 3\n      assert_size { a: 1 }, 1\n      assert_count %w[ a b c ], 3\n\n      assert_equal 'one', 'o' + 'ne'\n        # checks that all its arguments are equal\n\n      assert_match 'one', /^one$/\n        # checks that it receives a regex and one or more strings\n        # and that all those strings match the regex\n\n      assert_start_with 'one', 'one two or three'\n        # checks that the shortest string is the start of the remaining string\n        # arguments\n      assert_end_with 'three', 'one two or three'\n        # checks that the shortest string is the end of the remaining string\n        # arguments\n\n      assert_include 1, [ 1, 'two' ]\n        # checks that the first array argument includes all other arguments\n\n      assert_error(ArgumentError) { do_this_or_that() }\n        # checks that the given block raises an ArgumentError\n      assert_error(ArgumentError, /bad/) { do_this_or_that() }\n        # checks that the given block raises an ArgumentError and\n        # the error message matches the /bad/ regexp\n      assert_error lambda { do_this_or_that() }, ArgumentError\n        # checks that the given Proc raises an ArgumentError\n      assert_error lambda { do_this_or_that() }, ArgumentError, 'bad'\n        # checks that the given Proc raises an ArgumentError and\n        # the error message == \"bad\"\n\n      assert_no_error { do_this_or_that() }\n      assert_no_error lambda { do_this_or_that() }\n      assert_not_error { do_this_or_that() }\n      assert_not_error lambda { do_this_or_that() }\n        # checks that the block or Proc does not raise an error\n\n      assert_hashy(\n        this_thing =\u003e 1,\n        that_thing =\u003e 'two')\n          # combines two assert_equals in one\n\n      assert_instance_of 1, Integer\n      assert_is_a Integer, 123\n        # checks that value or set of values are of a given of class\n\n      assert 1, 1\n        # behaves like assert_equal\n      assert 'one', /one/i\n        # behaves like assert_match\n      assert 11 =\u003e '10'.to_i + 1\n        # assert equality between key and value\n      assert 'one' =\u003e 'on' + 'e', 'two' =\u003e :two.to_s\n        # assert equality between keys and values\n    end\n  end\n\n  group 'bravo' do\n  end\nend\n\ngroup 'core' do\n  #\n  # it's OK to re-open a group to add sub-groups, tests,\n  # and setups, teardowns, befores, or afters\n  #\n  # it's OK to re-open a group in another file, as long\n  # as it's the same name at the same point in the name hierarchy\n\n  _test 'not yet' do\n    #\n    # prefix a test, a group, or other element with _\n    # marks it as _pending\n  end\nend\n\ngroup 'core', 'sub-core', 'sub-sub-core' do\n  #\n  # it's OK to specifiy a path of group names\n\n  test 'this' do\n  end\nend\n\ngroup 'core \u003c sub-core \u003c sub-sub-core' do\n  #\n  # this is also ok...\n\n  test 'that' do\n  end\nend\n```\n\n\n## .test-point\n\nBy running `bx proba .`, one tells probatio to run the test pointed at in the file `.test-point`.\n\nHere is an example of `.test-point` content:\n```\ntest/wma/dwm/onboarding_benchmark_non_star_test.rb:189\n```\n\nFor Vim users, here is a snippet that saves the current path and line number to `.test-point` every 700ms:\n```vim\nau BufEnter test/*_test.rb,test/**/*_test.rb :set updatetime=700\n\nau BufEnter,CursorHold,BufWrite test/*_test.rb,test/**/*_test.rb :call writefile([ expand('%') . ':' . line('.') ], '.test-point', 'b')\n```\n\n\n## .probatio-output.rb\n\nBy default, probatio summarizes a run in a `.probatio-output.rb` file.\n\nHere is an example of such a file:\n```ruby\n# .probatio-output.rb\n{\nargv: [ \"test/alpha_test.rb:23\" ],\nfailures:\n  [\n  { n: \"test_fail\", p: \"test/alpha_test.rb\", l: 24, t: \"0s000_077\" },\n  { n: \"test_fail\", p: \"test/alpha_test.rb\", l: 29, t: \"0s000_033\" },\n  ],\nduration: \"0s001_297\",\nprobatio: { v: \"1.0.0\" },\nruby:\n  {\n  p: \"/usr/local/bin/ruby33\",\n  d: \"ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-openbsd]\",\n  l: 100,\n  },\nsome_env:\n  {\n  USER: \"jmettraux\",\n  HOME: \"/home/jmettraux\",\n  PATH: \"/home/jmettraux/.gem/ruby/3.3/bin:/home/jmettraux/.pkg_rubies/ruby33:/usr/local/jdk-21/bin:/home/jmettraux/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin\",\n  SHELL: \"/usr/local/bin/fish\",\n  GEM_HOME: \"/home/jmettraux/.gem/ruby/3.3\",\n  PWD: \"/home/jmettraux/w/probatio/test\",\n  },\n}\n```\n\nProbatio uses it when servicing `bundle exec proba 0` or `bundle exe proba -1`.\n\nIt can also be useful to other tools around probatio.\n\n\n## Warnings\n\n```\n$ RUBYOPT=\"-w $RUBYOPT\" bundle exec proba\n```\n\n\n## Plugins\n\n```ruby\n#\n# examples of probatio plugins\n\nclass MyProbatioPlugin\n\n  def on_test_succeed(ev)\n\n    puts \"GREAT SUCCESS! \" + ev.to_s\n  end\nend\n\nProbatio.plug(MyProbatioPlugin.new)\n```\n\n\n## LICENSE\n\nMIT, see [LICENSE.txt](LICENSE.txt)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloraison%2Fprobatio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloraison%2Fprobatio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloraison%2Fprobatio/lists"}