Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fernandes/stimulus_testing
Rails example using webpacker and stimulus (using jest / react testing library) for tests
https://github.com/fernandes/stimulus_testing
jest rails stimulus testing-library webpack webpacker
Last synced: 29 days ago
JSON representation
Rails example using webpacker and stimulus (using jest / react testing library) for tests
- Host: GitHub
- URL: https://github.com/fernandes/stimulus_testing
- Owner: fernandes
- Created: 2019-11-25T18:49:30.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-19T16:07:32.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T09:56:18.363Z (about 1 month ago)
- Topics: jest, rails, stimulus, testing-library, webpack, webpacker
- Language: Ruby
- Size: 1.44 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 35
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stimulus Testing
[![Build Status](https://travis-ci.com/fernandes/stimulus_testing.svg?branch=master)](https://travis-ci.com/fernandes/stimulus_testing)
This repo is a PoC that implements:
- A super simple stimulus [controller](https://github.com/fernandes/stimulus_testing/blob/master/app/javascript/controllers/counter_controller.js) that increases/decreases a counter
- A [test](https://github.com/fernandes/stimulus_testing/blob/master/app/javascript/controllers/__tests__/counter_controller_test.js) for the counter controller
- A [setupTests](https://github.com/fernandes/stimulus_testing/blob/master/app/javascript/setupTests.js) file to configure Jest and specially configure the `MutationObserver` shim
- Configure Jest on the [package.json](https://github.com/fernandes/stimulus_testing/blob/93f8c06a03055a70875e50b565aac5e8248a1873/package.json#L22-L33) to use setup file and configure folders correctly
- Also has a different [test file](https://github.com/fernandes/stimulus_testing/blob/93f8c06a03055a70875e50b565aac5e8248a1873/app/javascript/controllers/__tests__/counter_controller_testing_library_test.js) using [testing-library](https://testing-library.com) with [jest-dom](https://testing-library.com/docs/ecosystem-jest-dom) assertions