importmap_mocha-rails 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/config/importmap.rb +16 -0
- data/lib/importmap_mocha/engine.rb +59 -0
- data/lib/importmap_mocha/version.rb +5 -0
- data/lib/importmap_mocha-rails.rb +5 -0
- data/lib/tasks/importmap_mocha/rails_tasks.rake +4 -0
- data/vendor/javascripts/@mswjs--interceptors--presets--browser.js +1146 -0
- data/vendor/javascripts/@mswjs--interceptors.js +238 -0
- data/vendor/javascripts/@open-draft--deferred-promise.js +2 -0
- data/vendor/javascripts/@open-draft--logger.js +2 -0
- data/vendor/javascripts/@open-draft--until.js +2 -0
- data/vendor/javascripts/chai.js +231 -0
- data/vendor/javascripts/is-node-process.js +2 -0
- data/vendor/javascripts/mocha.js +20624 -0
- data/vendor/javascripts/outvariant.js +2 -0
- data/vendor/javascripts/strict-event-emitter.js +2 -0
- data/vendor/stylesheets/mocha.css +392 -0
- metadata +18 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e2388d036fdd25a99fc77e9cc413445cd9c8ddea2907191c9c3845dece76ef66
         | 
| 4 | 
            +
              data.tar.gz: a6866270afd51bde1557343d5dff4dc766b27eac94ccf6f4f21810d98762fd89
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 299fc3a872ce6a8fbcde9c158af2c665f8599455e7574456538bd1bff1b89026e8309589191518825dbcbe32233cace2c5b9949c18cf96f420753b3e079fda9c
         | 
| 7 | 
            +
              data.tar.gz: dc0352d3e1d13feb44dba890569af26b07230eef0578cb95060417d9a4efd8348c211d407f1bd8c7104672a3d9ad83d84f8ef7b293de26e20307517319a02b63
         | 
    
        data/README.md
    CHANGED
    
    
    
        data/config/importmap.rb
    ADDED
    
    | @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            pin "importmap_mocha"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            pin "@mswjs/interceptors", to: "@mswjs--interceptors.js"
         | 
| 4 | 
            +
            pin "@mswjs/interceptors/presets/browser" , to: "@mswjs--interceptors--presets--browser.js"
         | 
| 5 | 
            +
            pin "chai", to: "chai.js"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            pin "@open-draft/logger", to: "@open-draft--logger.js" # @0.3.0
         | 
| 8 | 
            +
            pin "is-node-process", to: "is-node-process.js" # @1.2.0
         | 
| 9 | 
            +
            pin "outvariant", to: "outvariant.js" # @1.4.0
         | 
| 10 | 
            +
            pin "@open-draft/until", to: "@open-draft--until.js" # @2.1.0
         | 
| 11 | 
            +
            pin "@open-draft/deferred-promise", to: "@open-draft--deferred-promise.js" # @2.2.0
         | 
| 12 | 
            +
            pin "strict-event-emitter", to: "strict-event-emitter.js" # @0.5.1
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            Rails.application.config.importmap_mocha_path.each do |path|
         | 
| 15 | 
            +
              pin_all_from path
         | 
| 16 | 
            +
            end
         | 
| @@ -0,0 +1,59 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module ImportmapMocha
         | 
| 4 | 
            +
              class Engine < ::Rails::Engine
         | 
| 5 | 
            +
                config.before_initialize do
         | 
| 6 | 
            +
                  Rails.application.config.importmap_mocha_path = []
         | 
| 7 | 
            +
                  %w[test spec].each do |d|
         | 
| 8 | 
            +
                    path = Rails.root.join(d, 'javascripts')
         | 
| 9 | 
            +
                    Rails.application.config.importmap_mocha_path << path if path.exist?
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                initializer 'importmap_mocha.assets' do
         | 
| 14 | 
            +
                  if Rails.application.config.respond_to?(:assets)
         | 
| 15 | 
            +
                    Rails.application.config.assets.paths << Engine.root.join('app/assets/javascripts')
         | 
| 16 | 
            +
                    Rails.application.config.assets.paths << Engine.root.join('app/assets/stylesheets')
         | 
| 17 | 
            +
                    Rails.application.config.assets.paths << Engine.root.join('vendor/javascripts')
         | 
| 18 | 
            +
                    Rails.application.config.assets.paths << Engine.root.join('vendor/stylesheets')
         | 
| 19 | 
            +
                    Rails.application.config.assets.paths += Rails.application.config.importmap_mocha_path
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                PRECOMPILE_ASSETS = %w[importmap_mocha.js chai.js mocha.js mocha.css].freeze
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                initializer 'turbo.assets' do
         | 
| 26 | 
            +
                  Rails.application.config.assets.precompile += PRECOMPILE_ASSETS if Rails.application.config.respond_to?(:assets)
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                initializer 'importmap_mocha.importmap', before: 'importmap' do |app|
         | 
| 30 | 
            +
                  app.config.importmap.paths << Engine.root.join('config/importmap.rb') if Rails.application.respond_to?(:importmap)
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                initializer "importmap_mocha.cache_sweeper", before: "importmap.cache_sweeper" do |app|
         | 
| 34 | 
            +
                  if app.config.importmap.sweep_cache && !app.config.cache_classes
         | 
| 35 | 
            +
                    app.config.importmap.cache_sweepers << Engine.root.join('app/assets/javascripts')
         | 
| 36 | 
            +
                    app.config.importmap.cache_sweepers << Engine.root.join('vendor/javascripts')
         | 
| 37 | 
            +
                    app.config.importmap.cache_sweepers  += Rails.application.config.importmap_mocha_path
         | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
             | 
| 42 | 
            +
                initializer 'importmap_mocha.routes' do
         | 
| 43 | 
            +
                  Rails.application.routes.prepend do
         | 
| 44 | 
            +
                    scope module: 'importmap_mocha' do
         | 
| 45 | 
            +
                      get '/rails/info/mocha' => 'test#index'
         | 
| 46 | 
            +
                    end
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                initializer 'importmap_mocha.config' do
         | 
| 51 | 
            +
                  unless Rails.application.config.respond_to?(:importmap_mocha_style)
         | 
| 52 | 
            +
                    Rails.application.config.importmap_mocha_style = 'bdd'
         | 
| 53 | 
            +
                  end
         | 
| 54 | 
            +
                  unless Rails.application.config.respond_to?(:importmap_mocha_scripts)
         | 
| 55 | 
            +
                    Rails.application.config.importmap_mocha_scripts = []
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
            end
         |