-
-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
On Chrome, running auto
, throws the error "Cannot set property indexedDB of # which has only a getter". Changing the auto
script like so fixed the issue for me:
diff --git a/node_modules/fake-indexeddb/auto/index.js b/node_modules/fake-indexeddb/auto/index.js
index 1c65d4b..05e0a41 100644
--- a/node_modules/fake-indexeddb/auto/index.js
+++ b/node_modules/fake-indexeddb/auto/index.js
@@ -21,15 +21,39 @@ var globalVar =
? global
: Function("return this;")();
-globalVar.indexedDB = fakeIndexedDB;
-globalVar.IDBCursor = FDBCursor;
-globalVar.IDBCursorWithValue = FDBCursorWithValue;
-globalVar.IDBDatabase = FDBDatabase;
-globalVar.IDBFactory = FDBFactory;
-globalVar.IDBIndex = FDBIndex;
-globalVar.IDBKeyRange = FDBKeyRange;
-globalVar.IDBObjectStore = FDBObjectStore;
-globalVar.IDBOpenDBRequest = FDBOpenDBRequest;
-globalVar.IDBRequest = FDBRequest;
-globalVar.IDBTransaction = FDBTransaction;
-globalVar.IDBVersionChangeEvent = FDBVersionChangeEvent;
+Object.defineProperty(globalVar, 'indexedDB', {
+ value: fakeIndexedDB
+});
+Object.defineProperty(globalVar, 'IDBCursor', {
+ value: FDBCursor
+});
+Object.defineProperty(globalVar, 'IDBCursorWithValue', {
+ value: FDBCursorWithValue
+});
+Object.defineProperty(globalVar, 'IDBDatabase', {
+ value: FDBDatabase
+});
+Object.defineProperty(globalVar, 'IDBFactory', {
+ value: FDBFactory
+});
+Object.defineProperty(globalVar, 'IDBIndex', {
+ value: FDBIndex
+});
+Object.defineProperty(globalVar, 'IDBKeyRange', {
+ value: FDBKeyRange
+});
+Object.defineProperty(globalVar, 'IDBObjectStore', {
+ value: FDBObjectStore
+});
+Object.defineProperty(globalVar, 'IDBOpenDBRequest', {
+ value: FDBOpenDBRequest
+});
+Object.defineProperty(globalVar, 'IDBRequest', {
+ value: FDBRequest
+});
+Object.defineProperty(globalVar, 'IDBTransaction', {
+ value: FDBTransaction
+});
+Object.defineProperty(globalVar, 'IDBVersionChangeEvent', {
+ value: FDBVersionChangeEvent
+});
diff --git a/node_modules/fake-indexeddb/auto/index.mjs b/node_modules/fake-indexeddb/auto/index.mjs
index 70355f9..134299f 100644
--- a/node_modules/fake-indexeddb/auto/index.mjs
+++ b/node_modules/fake-indexeddb/auto/index.mjs
@@ -21,15 +21,40 @@ var globalVar =
? global
: Function("return this;")();
-globalVar.indexedDB = fakeIndexedDB;
-globalVar.IDBCursor = FDBCursor;
-globalVar.IDBCursorWithValue = FDBCursorWithValue;
-globalVar.IDBDatabase = FDBDatabase;
-globalVar.IDBFactory = FDBFactory;
-globalVar.IDBIndex = FDBIndex;
-globalVar.IDBKeyRange = FDBKeyRange;
-globalVar.IDBObjectStore = FDBObjectStore;
-globalVar.IDBOpenDBRequest = FDBOpenDBRequest;
-globalVar.IDBRequest = FDBRequest;
-globalVar.IDBTransaction = FDBTransaction;
-globalVar.IDBVersionChangeEvent = FDBVersionChangeEvent;
+Object.defineProperty(globalVar, 'indexedDB', {
+ value: fakeIndexedDB
+});
+Object.defineProperty(globalVar, 'IDBCursor', {
+ value: FDBCursor
+});
+Object.defineProperty(globalVar, 'IDBCursorWithValue', {
+ value: FDBCursorWithValue
+});
+Object.defineProperty(globalVar, 'IDBDatabase', {
+ value: FDBDatabase
+});
+Object.defineProperty(globalVar, 'IDBFactory', {
+ value: FDBFactory
+});
+Object.defineProperty(globalVar, 'IDBIndex', {
+ value: FDBIndex
+});
+Object.defineProperty(globalVar, 'IDBKeyRange', {
+ value: FDBKeyRange
+});
+Object.defineProperty(globalVar, 'IDBObjectStore', {
+ value: FDBObjectStore
+});
+Object.defineProperty(globalVar, 'IDBOpenDBRequest', {
+ value: FDBOpenDBRequest
+});
+Object.defineProperty(globalVar, 'IDBRequest', {
+ value: FDBRequest
+});
+Object.defineProperty(globalVar, 'IDBTransaction', {
+ value: FDBTransaction
+});
+Object.defineProperty(globalVar, 'IDBVersionChangeEvent', {
+ value: FDBVersionChangeEvent
+});
+
\ No newline at end of file
Would you be open to a PR?
julianCast, anthonyminyungi and e-e
Metadata
Metadata
Assignees
Labels
No labels