code: def test_should_pass_template_dir(tmp_dir, dvc, mocker, capsys):
      cli_args = parse_args(
          [
              "plots",
              "diff",
              "HEAD~1",
              "--json",
              "--targets",
              "plot.csv",
          ]
      )
      cmd = cli_args.func(cli_args)
  
      data = mocker.MagicMock()
      mocker.patch("dvc.repo.plots.diff.diff", return_value=data)
  
      renderers = mocker.MagicMock()
      match_renderers = mocker.patch(
          "dvc.render.match.match_defs_renderers",
          return_value=renderers,
      )
  
      assert cmd.run() == 0
  
      match_renderers.assert_called_once_with(
          data=data,
          out="dvc_plots",
          templates_dir=str(tmp_dir / ".dvc/plots"),
      )
  
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 9 for calling a global function with example usage: test_should_pass_template_dir(tmp_dir, dvc, mocker, capsys) without return types