A Babel plugin that strips data-test-* attributes from Ember.js templates and properties from JavaScript objects in production builds. Current stable version is 0.1.0, released as part of the ember-test-selectors monorepo. It is designed for Embroider+Vite apps (Ember 3.28+, Ember CLI 4.12+, Node.js 18+). Unlike the classic ember-test-selectors addon which works with classic Ember builds, this package provides granular Babel plugins for Vite-based setups, giving developers control over when stripping occurs via environment variables.
npm install strip-test-selectorsVerified import paths — ran on the pinned version, not inferred.
Configures Babel to strip data-test-* from templates and JS objects only when STRIP_TEST_SELECTORS environment variable is set, typically for production builds.
Use ember-test-selectors package for classic Ember apps, or migrate to Embroider+Vite.
Use import stripTestSelectors from 'strip-test-selectors' for the template plugin.
Update Node.js to 18+ and Ember to 3.28+.
Set STRIP_TEST_SELECTORS=true in your production build script.
Use data-test-* prefix for all test selectors.
Use stripPropertiesPlugin as a named export: import { stripPropertiesPlugin } from 'strip-test-selectors'Install it: npm install -D babel-plugin-ember-template-compilation
Provide transforms array in plugin options, e.g., transforms: [stripTestSelectors]