版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

22 строки
768 B

  1. import { resolve, dirname } from "node:path";
  2. import { waitFor } from "cli-testing-library";
  3. import { renderPlop } from "./render.js";
  4. import { fileURLToPath } from "node:url";
  5. const __dirname = dirname(fileURLToPath(import.meta.url));
  6. test("should exit with code 1 when failed actions", async () => {
  7. const { findByText, userEvent } = await renderPlop([], {
  8. cwd: resolve(__dirname, "./examples/action-failure"),
  9. });
  10. expect(await findByText("What is your name?")).toBeInTheConsole();
  11. userEvent.keyboard("Joe");
  12. expect(await findByText("Joe")).toBeInTheConsole();
  13. userEvent.keyboard("[Enter]");
  14. const actionOutput = await findByText("Action failed");
  15. await waitFor(() =>
  16. expect(actionOutput.hasExit()).toStrictEqual({ exitCode: 1 })
  17. );
  18. });