menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Deepdash

Deepdash - tree traversal extension for Lodash

Channels
Team

Import issue

November 24, 2020 at 8:28pm
I am using deepdash from angular 10 project. I am referencing it this way 'import filterDeep from 'deepdash-es/filterDeep';
But its giving me error while doing unit test.In side browser everything works fine How can I import this way 'import { filterDeep } from 'deepdash-es/filterDeep.Al my other imports in angular has curtly brackets

November 26, 2020 at 6:38pm
Hi, sorry, missed your question. Try this: import { filterDeep } from "deepdash-es/standalone"; example:

November 30, 2020 at 8:45pm
Hi Yuri thanks for the reply. I tried that. But I am getting this error while running unit test using jest..
C:\lamprojects\law-new\law\node_modules\deepdash-es\standalone.js:2 export { default as condense } from './condense'; ^^^^^^
SyntaxError: Unexpected token 'export'
2 | import { Injectable, OnDestroy } from '@angular/core';
3 | import { Store } from '@ngrx/store';
> 4 | import { filterDeep, mapKeysDeep } from 'deepdash-es/standalone';
| ^
5 | import { isArray, isString } from 'lodash';
6 | import { Observable, Subject } from 'rxjs';
7 | import { filter, map, takeUntil } from 'rxjs/operators';
at Runtime.createScriptFromCode (../../node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (src/lib/services/mr-backend-service.ts:4:1)
Well, looks like it's a Node version / Babel issue. Or you probably need to learn what is this "transformIgnorePatterns" config option. I googled "jest Unexpected token 'export'" and found this discussion: https://github.com/facebook/jest/issues/2550

December 1, 2020 at 10:40am
I work at Lam Research and our team has really liked the deepdash library. We have implemented it everywhere but we are stuck now.We can't run any unit test.I followed the link you have given in above message. But its not helping. I understand that this is not deepdash problem. I guess its jest configuration problem. We are trying hard for last 2 days to fix this jest configuration problem. I will keep you posted

December 1, 2020 at 8:01pm
Could you create some example github repo, where your problem is reproducible? I will take a look then.
Edited
I added jest test to that codesandbox
and looks like it's working, so maybe something specific to you techstack is hapening. So again, lmk if you will have reproducible isolated issue in some example repo.
Edited
Thanks Yuri for code Sandbox..I will see how I can create a github repo..Will update you soon