Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/core/src/extensions/UniqueID/UniqueID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ const UniqueID = Extension.create({
types: [],
generateID: () => {
// Use mock ID if tests are running.
if ((window as any).__TEST_OPTIONS) {
if ((window as any).__TEST_OPTIONS.mockID === undefined) {
(window as any).__TEST_OPTIONS.mockID = 0;
if (typeof window !== "undefined" && (window as any).__TEST_OPTIONS) {
const testOptions = (window as any).__TEST_OPTIONS;
if (testOptions.mockID === undefined) {
testOptions.mockID = 0;
} else {
(window as any).__TEST_OPTIONS.mockID++;
testOptions.mockID++;
}

return (window as any).__TEST_OPTIONS.mockID.toString() as string;
return testOptions.mockID.toString() as string;
}

return v4();
Expand Down