mirror of
https://github.com/hanzoai/vitest.git
synced 2026-09-24 17:04:25 +00:00
18 lines
686 B
TypeScript
18 lines
686 B
TypeScript
import { expect, test } from "vitest";
|
|
|
|
const expectedValue = import.meta.env.TEST_EXPECTED_VALUE || "0";
|
|
|
|
test(`expectedValue = ${expectedValue}`, () => {
|
|
// increment localStorage to test persistent context between test runs
|
|
const value = localStorage.getItem("test-persistent-context") || "0";
|
|
const nextValue = String(Number(value) + 1);
|
|
console.log(`localStorage: value = ${value}, nextValue = ${nextValue}`);
|
|
localStorage.setItem("test-persistent-context", nextValue);
|
|
|
|
const div = document.createElement("div");
|
|
div.textContent = `localStorage: value = ${value}, nextValue = ${nextValue}`;
|
|
document.body.appendChild(div);
|
|
|
|
expect(value).toBe(expectedValue)
|
|
});
|