Apply suggestions from code review of branch webapp_unit_testing Co-authored-by: @beth_probert
This commit is contained in:
parent
656afd30d2
commit
bf6dcebc16
3 changed files with 8 additions and 2 deletions
|
|
@ -30,13 +30,18 @@ export default defineConfig(({ command, mode }) => {
|
|||
return {
|
||||
plugins: [
|
||||
vue({
|
||||
// Block for removing data-test-id tags on npm run build
|
||||
// Strip "data-test-id" attributes (used by Vitest) from the production build.
|
||||
// This enforces separation of concerns and prevents developers from relying on
|
||||
// test IDs for styling or core application logic.
|
||||
template: {
|
||||
compilerOptions: {
|
||||
// Only apply this AST transformation during production builds
|
||||
nodeTransforms: isProduction
|
||||
? [
|
||||
(node) => {
|
||||
// Check if the current AST node is an HTML element
|
||||
if (node.type === 1 /* NodeTypes.ELEMENT */) {
|
||||
// Filter out any property named "data-test-id"
|
||||
node.props = node.props.filter((prop) => prop.name !== "data-test-id");
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue