An Ember.js addon that removes data-test-* attributes from production builds for cleaner test selectors.
ember-test-selectors is an Ember.js addon that automatically removes `data-test-*` attributes from HTML and JavaScript in production builds. It enables developers to use these attributes as stable selectors for testing without cluttering production code. This solves the problem of maintaining clean production environments while providing reliable element targeting for tests.
Ember.js developers and teams who write integration or acceptance tests and need stable, non-invasive selectors for DOM elements. It is particularly useful for developers building Ember applications or addons where test maintainability and production performance are priorities.
Developers choose ember-test-selectors because it seamlessly strips test attributes only in production, ensuring no runtime overhead or selector leakage. Unlike manual cleanup or alternative tools, it integrates directly with Ember's build process and works with both classic and modern Embroider+Vite setups.
Enabling better element selectors in Ember.js tests
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Strips all data-test-* attributes from HTML and JavaScript during production builds, eliminating runtime overhead and keeping code clean, as highlighted in the features section.
Supports both classic Ember apps and modern Embroider+Vite setups, with clear compatibility guidelines for different Ember and CLI versions, ensuring broad applicability.
When listed as a dependency in Ember addons, it ensures test selectors are stripped even if the host app doesn't use it, preventing attribute pollution in distributed code.
Allows straightforward use of data-test-* attributes in templates and component invocations, automatically applying them to appropriate elements without extra boilerplate.
For Embroider+Vite apps, the README recommends installing and configuring a separate Babel plugin, which adds manual steps and potential configuration errors compared to the classic addon approach.
Exclusively designed for Ember.js, making it useless for projects using other frameworks or those considering a migration away from Ember, limiting its versatility.
Relies on correct build environment setup; if misconfigured, test attributes might not be stripped in production, leading to bloated code and potential performance issues.