Closed iiSergey closed 4 years ago
Same here with an angular 8.x app:
TypeError: function is not iterable (cannot read property Symbol(Symbol.iterator))
at new Set (<anonymous>)
at _ValueOutputAstTransformer.visitStringMap (../packages/compiler/src/output/value_util.ts:29:23)
at visitValue (../packages/compiler/src/util.ts:40:20)
at ../packages/compiler/src/output/value_util.ts:32:38
at Array.forEach (<anonymous>)
at _ValueOutputAstTransformer.visitStringMap (../packages/compiler/src/output/value_util.ts:30:22)
at visitValue (../packages/compiler/src/util.ts:40:20)
at convertValueToOutputAst (../packages/compiler/src/output/value_util.ts:18:10)
at singleProviderDef (../packages/compiler/src/view_compiler/provider_compiler.ts:116:22)
at providerDef (node_modules/@angular/compiler/bundles/compiler.umd.js:22024:13)
at ../packages/compiler/src/ng_module_compiler.ts:38:62
at Array.map (<anonymous>)
at NgModuleCompiler.compile (../packages/compiler/src/ng_module_compiler.ts:38:44)
at JitCompiler._compileModule (../packages/compiler/src/jit/compiler.ts:153:52)
at ../packages/compiler/src/jit/compiler.ts:119:31
at Object.then (../packages/compiler/src/util.ts:89:74)
at JitCompiler._compileModuleAndAllComponents (../packages/compiler/src/jit/compiler.ts:115:22)
at JitCompiler.compileModuleAndAllComponentsSync (../packages/compiler/src/jit/compiler.ts:65:38)
at CompilerImpl.compileModuleAndAllComponentsSync (../packages/platform-browser-dynamic/src/compiler_factory.ts:61:35)
at TestingCompilerImpl.compileModuleAndAllComponentsSync (../../packages/platform-browser-dynamic/testing/src/compiler_factory.ts:52:27)
at TestBedViewEngine._initIfNeeded (../../packages/core/testing/src/test_bed.ts:376:28)
at TestBedViewEngine.createComponent (../../packages/core/testing/src/test_bed.ts:570:10)
at Function.TestBedViewEngine.createComponent (../../packages/core/testing/src/test_bed.ts:232:36)
Hey Think this should be possible to fix, given https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/handler/ownKeys
Can you tell me what it was doing here - at _ValueOutputAstTransformer.visitStringMap (../packages/compiler/src/output/value_util.ts:29:23) ?
I.e for i in
or Object.keys()
?
I think he is here: https://github.com/angular/angular/blob/8.2.x/packages/compiler/src/output/value_util.ts#L29
it is happening, when i mock an angular service implementation. plain objects are working fine
This should be fixed in https://github.com/marchaos/jest-mock-extended/pull/13. Anyone able to try this?
This still errors in 1.0.8:
interface SomeObject {
name: string;
}
const mockObject= mock<SomeObject>();
expect(mockObject).toEqual(mockObject); // Error
TypeError: Cannot read property 'next' of undefined
@jfemia that's the exact error I'm getting. And I really, really, really would like to find a way to mock my interfaces rather than being forced to create a dummy object and then mocking that.
Angular services still not working in 1.0.9
TypeError: function is not iterable (cannot read property Symbol(Symbol.iterator))
at new Set (
Created #43 to track this problem explicitly
I'm getting similar behavior with axios
while passing mocked data
object
Hello I had problem with expect(mock).toEqual(mock), because in a method toEqual be call iterator for the mock and own mock return not correct data for an iterator. You can see more information in https://medium.com/front-end-weekly/thank-u-symbol-iterator-next-aef9f09ff78. I used expect(mock.property).toEqual(mock.property)
Example Error: