我正在尝试让Amplify DataSource在我的jest测试文件中执行,并且出现以下错误:
Node is not supported
47 | serviceTest = TestBed.get(APIService);
48 |
> 49 | const data = await DataStore.query(Activity, Predicates.ALL);
^
at Object.getDefaultAdapter [as default] (node_modules/@aws-
amplify/datastore/lib/storage/adapter/getDefaultAdapter/index.js:8:15)
at new StorageClass (node_modules/@aws-amplify/datastore/lib/storage/storage.js:83:51)
at new ExclusiveStorage (node_modules/@aws-amplify/datastore/lib/storage/storage.js:303:24)
at node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:673:31
at step (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:44:23)
at Object.next (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:25:53)
at node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:19:71
at new ZoneAwarePromise (node_modules/zone.js/dist/zone.js:913:33)
at __awaiter (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:15:12)
at start (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:656:12)
at node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:476:42
at step (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:44:23)
at Object.next (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:25:53)
at node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:19:71
at new ZoneAwarePromise (node_modules/zone.js/dist/zone.js:913:33)
at __awaiter (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:15:12)
at DataStore.query (node_modules/@aws-amplify/datastore/lib/datastore/datastore.js:472:76)
at src/app/home/home.component.spec.ts:49:34
at node_modules/tslib/tslib.js:115:75
at new ZoneAwarePromise (node_modules/zone.js/dist/zone.js:913:33)
at Object.__awaiter (node_modules/tslib/tslib.js:111:16)
at src/app/home/home.component.spec.ts:44:33
at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:386:30)
at ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:117:43)
at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:385:36)
at Zone.run (node_modules/zone.js/dist/zone.js:143:47)
如果我在实际的角度控制器中运行DataStore,并且我目前在我的玩笑测试中成功使用了graphql api,则DataStore可以正常工作,所以我真的不知道下一步该怎么做才能使它工作。任何意见,将不胜感激。谢谢。