Vize

ecosystem/vue-test-utils-no-html-snapshot

Avoid snapshotting wrapper.html() in Vue Test Utils tests

Bad · Good

Default severity: warning
Presets: ecosystem
Automatic fix: None; review the suggested change
Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form
Options: No rule-specific options. Severity and preset selection are configurable.

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({
  lint: {
    vize: {
      "preset": "incremental",
      "rules": {
        "ecosystem/vue-test-utils-no-html-snapshot": "warn"
      }
    },
  },
});
vp run lint

Bad

The assertion snapshots the complete wrapper HTML instead of checking the expected behavior.

<script setup lang="ts">
expect(wrapper.html()).toMatchSnapshot();
</script>

Good

The assertion checks that the rendered text contains Saved.

<script setup lang="ts">
expect(wrapper.text()).toContain("Saved");
</script>

Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.

Implementation · All rules