/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/specs/node/node_test_expect_failure/test.js
32 строки
873 B
em
fix(ext/node): add test.expectFailure to node:test (#34130)
16 май 2026, 22:12
Не верифицирован
16 май 2026, 22:12
08b03b3
Код
Авторство
О чём код?
// deno-lint-ignore-file import assert from "node:assert"; import test from "node:test"; test("test.expectFailure is a function", () => { assert.strictEqual(typeof test.expectFailure, "function"); }); test.expectFailure("sync expected failure", () => { assert.fail("expected sync failure"); }); test("async expected failure option", { expectFailure: true }, async () => { throw new Error("expected async failure"); }); test("matched expected failure", { expectFailure: /expected match/ }, () => { throw new Error("expected match"); }); test.expectFailure("callback expected failure", (t, done) => { done(new Error("expected callback failure")); }); test.expectFailure("unexpected pass fails the test", () => {}); test("mismatched expected failure fails the test", { expectFailure: /expected message/, }, () => { throw new Error("actual message"); });