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
|
|
@ -174,6 +174,7 @@ javascript-lint-and-test:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: webapp/coverage/cobertura-coverage.xml
|
path: webapp/coverage/cobertura-coverage.xml
|
||||||
|
|
||||||
|
|
||||||
# Build JS app
|
# Build JS app
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,18 @@ export default defineConfig(({ command, mode }) => {
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
vue({
|
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: {
|
template: {
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
|
// Only apply this AST transformation during production builds
|
||||||
nodeTransforms: isProduction
|
nodeTransforms: isProduction
|
||||||
? [
|
? [
|
||||||
(node) => {
|
(node) => {
|
||||||
|
// Check if the current AST node is an HTML element
|
||||||
if (node.type === 1 /* NodeTypes.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");
|
node.props = node.props.filter((prop) => prop.name !== "data-test-id");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export default defineConfig({
|
||||||
clean: true,
|
clean: true,
|
||||||
cleanOnStart: true,
|
cleanOnStart: true,
|
||||||
// text gives output on STOUT and html creates an artifact
|
// text gives output on STOUT and html creates an artifact
|
||||||
reporter: ["text", "html"],
|
reporter: ["text", "html", "cobertura"],
|
||||||
all: true,
|
all: true,
|
||||||
// Files to include or exclude in coverage
|
// Files to include or exclude in coverage
|
||||||
include: ["src/**/*.vue", "src/**/*.js"],
|
include: ["src/**/*.vue", "src/**/*.js"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue