# test.web/core/reporters/failure.reporter.test.ts

> 12 lines of code and 0 definitions.

Tree: Codebase Testing
Language: typescript
Canonical: https://banes-lab.com/anatomy/testing#file-testing-test-web-core-reporters-failure-reporter-test-ts
Source text: https://banes-lab.com/source/testing/test.web/core/reporters/failure.reporter.test.ts.txt

Listed in [test.web/core/reporters](https://banes-lab.com/api/source/testing/test.web/core/reporters.md).

## Contained in

- [test.web/core/reporters](https://banes-lab.com/anatomy/testing/folder-testing-test-web-core-reporters.md)

## Source

```typescript
import { describe, expect, it, vi } from "vitest";
import { PAYLOAD_UNAVAILABLE } from "@banes-lab/web/configuration/strings/report.strings.ts";
import { reportFailure } from "@banes-lab/web/core/reporters/failure.reporter.ts";

describe("reportFailure", () => {
    it("writes the message and the failure itself to the console's error stream", () => {
        const logged = vi.spyOn(console, "error").mockReturnValue();
        const failure = new Error("offline");
        reportFailure(PAYLOAD_UNAVAILABLE, failure);
        expect(logged).toHaveBeenCalledWith(PAYLOAD_UNAVAILABLE, failure);
        logged.mockRestore();
    });
});
```
