- Bridges your Importmap Pins to be available in a JS Runtime (Deno or Node)
- Adds the
rails test:jscommand, to load this Runtime and run tests with Importmap Pins loaded - Allows Stimulus unit and integration tests without a jsbundling configuration
Recommended, as Deno has native support for importmap
- Add the
importestgem to your Gemfile:# Gemfile group :test do gem 'importest' end
- Run
bundle install - Run
rails importest:installorrails importest:install:deno - Run
rails test:js
Support for Node is done through a custom importmap loader, and is not recommended
- Add the
importestgem to your Gemfile:gem 'importest' - Run
bundle install - Run
rails importest:install:node - Run
rails test:js
myrailsapp/
test/
javascript/
*/**.test.js
myrailsapp/
test/
javascript/
controllers/ # unit tests for controllers
*.test.js
integrations/ # when using a DOM
*.integration.test.js
- Tests for the HelloController are available upon install
test/javascript/test_helper.jscontains basic DOM setup helpers
Importest for Rails is released under the MIT License.