code: def test_plots_diff_vega(dvc, mocker, capsys, plots_data):
      cli_args = parse_args(
          [
              "plots",
              "diff",
              "HEAD~10",
              "HEAD~1",
              "--show-vega",
              "--targets",
              "plot.csv",
          ]
      )
      cmd = cli_args.func(cli_args)
      mocker.patch("dvc.repo.plots.diff.diff", return_value=plots_data)
      mocker.patch(
          "dvc_render.VegaRenderer.get_filled_template",
          return_value={"this": "is vega json"},
      )
      render_mock = mocker.patch("dvc_render.render_html")
      assert cmd.run() == 0
  
      out, _ = capsys.readouterr()
  
      assert json.dumps({"this": "is vega json"}) in out
      render_mock.assert_not_called()
  
imports: import json
  import os
  import posixpath
  from pathlib import Path
  import pytest
  from funcy import set_in
  from dvc.cli import parse_args
  from dvc.commands.plots import CmdPlotsDiff, CmdPlotsShow, CmdPlotsTemplates
  from dvc.render.match import RendererWithErrors
  from dvc.utils.serialize import YAMLFileCorruptedError
label_desc: Use image node_id 4 for calling a global function with example usage: test_plots_diff_vega(dvc, mocker, capsys, plots_data) without return types