From 58835947adecf382674e9413b1a7b8bfdfce512a Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Wed, 4 Dec 2019 11:56:52 +0100 Subject: [PATCH 1/2] Remove data-test attriubutes in non-dev env --- webapp/nuxt.config.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index 0d61302ff..e96d681d6 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -272,6 +272,26 @@ export default { }, }, }) + const tagAttributesForTesting = ['data-test', ':data-test', 'v-bind:data-test'] + ctx.loaders.vue.compilerOptions = { + modules: [ + { + preTransformNode(astEl) { + if (!ctx.isDev) { + const { attrsMap, attrsList } = astEl + tagAttributesForTesting.forEach(attribute => { + if (attrsMap[attribute]) { + delete attrsMap[attribute] + const index = attrsList.findIndex(attr => attr.name === attribute) + attrsList.splice(index, 1) + } + }) + } + return astEl + }, + }, + ], + } }, }, } From bcf602fe7751130ce968848556b30541928b926a Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Tue, 10 Dec 2019 14:08:13 +0100 Subject: [PATCH 2/2] Use more verbose naming - Co-authored-by: Alina Beck --- webapp/nuxt.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index 3425715d8..83a0a65f1 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -281,9 +281,9 @@ export default { ctx.loaders.vue.compilerOptions = { modules: [ { - preTransformNode(astEl) { + preTransformNode(abstractSyntaxTreeElement) { if (!ctx.isDev) { - const { attrsMap, attrsList } = astEl + const { attrsMap, attrsList } = abstractSyntaxTreeElement tagAttributesForTesting.forEach(attribute => { if (attrsMap[attribute]) { delete attrsMap[attribute] @@ -292,7 +292,7 @@ export default { } }) } - return astEl + return abstractSyntaxTreeElement }, }, ],