dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.48k stars 642 forks source link

Error: Cannot read property 'only' of undefined #495

Open ghost opened 7 years ago

ghost commented 7 years ago

This happens unit testing in node.js with fake-indexeddb

WriteableCollection.Collection (node_modules/dexie/tools/tmp/src/Dexie.js:1920:24)
new WriteableCollection (node_modules/dexie/tools/tmp/src/Dexie.js:2356:20)
WhereClause.equals (node_modules/dexie/tools/tmp/src/Dexie.js:1658:24)
WriteableTable.update (node_modules/dexie/tools/tmp/src/Dexie.js:1310:42)
Test.<anonymous> (test.js:23:18)
step (test.js:3:191)
dfahlander commented 7 years ago

I don't know much about fake-indexedDB and whether it supports the full indexedDB spec or not.

ghost commented 7 years ago

Well, It seems to work with the following workaround:

const Dexie = require('dexie')

Dexie.dependencies.indexedDB = require('fake-indexeddb')
Dexie.dependencies.IDBKeyRange = require('fake-indexeddb/lib/FDBKeyRange')

Thanks anyway (:

iFlameing commented 5 years ago

@ghost can you share your link of the unit test that you written .