Skip to content

Commit

Permalink
fix: add Lazy-load Axe::API::Run to improve boot time (#396)
Browse files Browse the repository at this point in the history
It saves 95% of load time when doing `require "axe-rspec"`.

The time is actually spent loading the `virtus` library. Deferring the
loading of `Axe::API::Run` until needed does in turn defer the loading
of `virtus` library.

No QA required.

---------

Co-authored-by: Christophe Bliard <christophe.bliard@trux.info>
  • Loading branch information
scottmries and cbliard authored Aug 13, 2024
1 parent 09e659e commit f16172e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defaults: &defaults
working_directory: ~/axe-core-gems

orbs:
browser-tools: circleci/browser-tools@1.4.3
browser-tools: circleci/browser-tools@1.4.8
node: circleci/node@5.0.0

commands:
Expand Down
4 changes: 2 additions & 2 deletions packages/axe-core-api/e2e/selenium/spec/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
require "json" #TODO: REMOVE
require "selenium-webdriver"
require "axe/core"
require "axe/api/run"
require "axe/api"

options = Selenium::WebDriver::Chrome::Options.new
# options.add_argument('--headless')
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
$driver = Selenium::WebDriver.for :chrome, options: options
Expand Down
5 changes: 5 additions & 0 deletions packages/axe-core-api/lib/axe/api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Axe
module API
autoload :Run, "axe/api/run"
end
end
2 changes: 1 addition & 1 deletion packages/axe-core-api/lib/axe/matchers/be_axe_clean.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative "../../chain_mail/chainable"
require_relative "../core"
require_relative "../api/run"
require_relative "../api"

module Axe
module Matchers
Expand Down

0 comments on commit f16172e

Please sign in to comment.