我正在使用angular8并为我的组件编写测试用例。我有很多组件,为此我编写了测试用例,但在datepickerspec.ts中 当我使用Jest运行我的测试用例时,它通过了此文件的所有测试用例,但同时出现红色错误。我无法理解测试用例通过后为什么会出现此错误。
我已经在互联网上搜索了,但是没有找到任何东西。
js\dist\proxy.js:129:39)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:390:52)
at Object.onInvoke (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\zone\ng_zone.ts:273:25)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:390:52)
at Zone.Object.<anonymous>.Zone.run (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:150:43)
at NgZone.run (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\zone\ng_zone.ts:171:50)
at Object.next (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\application_ref.ts:520:35)
at SafeSubscriber.schedulerFn [as _next] (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\event_emitter.ts:103:45) at SafeSubscriber.Object.<anonymous>.SafeSubscriber.__tryOrUnsub (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\rxjs\src\internal\Subscriber.ts:265:10)
at SafeSubscriber.Object.<anonymous>.SafeSubscriber.next (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\rxjs\src\internal\Subscriber.ts:207:14)
at Subscriber.Object.<anonymous>.Subscriber._next (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\rxjs\src\internal\Subscriber.ts:139:22)
at Subscriber.Object.<anonymous>.Subscriber.next (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\rxjs\src\internal\Subscriber.ts:99:12)
at EventEmitter.Object.<anonymous>.Subject.next (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\rxjs\src\internal\Subject.ts:70:17)
at EventEmitter.emit (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\event_emitter.ts:85:31)
at checkStable (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\zone\ng_zone.ts:240:29)
at onLeave (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\zone\ng_zone.ts:312:3)
at Object.onInvokeTask (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\packages\core\src\zone\ng_zone.ts:264:9)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invokeTask (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:422:60)
at Zone.Object.<anonymous>.Zone.runTask (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:195:47)
at ZoneTask.Object.<anonymous>.ZoneTask.invokeTask [as invoke] (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:498:34)
at invokeTask (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:1693:14)
at HTMLButtonElement.globalZoneAwareCallback (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:1719:17)
at innerInvokeEventListeners (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-environment-jsdom-thirteen\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:315:27)
at invokeEventListeners (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-environment-jsdom-thirteen\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:266:3)
at HTMLButtonElementImpl._dispatch (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-environment-jsdom-thirteen\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:212:11)
at HTMLButtonElementImpl.dispatchEvent (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-environment-jsdom-thirteen\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:87:17)
at HTMLButtonElement.dispatchEvent (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-environment-jsdom-thirteen\node_modules\jsdom\lib\jsdom\living\generated\EventTarget.js:144:23)
at C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\client\ng\shared\component\forms\ipx-date-picker\ipx-date-picker.component.spec.ts:60:26
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:391:26)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\proxy.js:129:39)
at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:390:52)
at Zone.Object.<anonymous>.Zone.run (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\zone.js\dist\zone.js:150:43)
at Object.testBody.length (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-preset-angular\zone-patch\index.js:52:27)
at Object.asyncJestTest (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:102:37)
at resolve (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-jasmine2\build\queueRunner.js:43:12)
at new Promise (<anonymous>)
at mapper (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-jasmine2\build\queueRunner.js:26:19)
at promise.then (C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor\node_modules\jest-jasmine2\build\queueRunner.js:73:41)
ngDebugContext:
DebugContext_ {
view:
{ def: [Object],
parent: [Object],
viewContainerParent: null,
parentNodeDef: [Object],
context: [NgIfContext],
component: [BsDatepickerContainerComponent],
nodes: [Array],
state: 13,
root: [Object],
renderer: [DebugRenderer2],
oldValues: [Array],
disposables: [Array],
initIndex: -1 },
nodeIndex: 3,
nodeDef:
{ nodeIndex: 3,
parent: [Object],
renderParent: [Object],
bindingIndex: 2,
outputIndex: 0,
checkIndex: 3,
flags: 1,
childFlags: 17186833,
directChildFlags: 16777217,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 11,
bindings: [Array],
bindingFlags: 24,
outputs: [Array],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
elDef:
{ nodeIndex: 3,
parent: [Object],
renderParent: [Object],
bindingIndex: 2,
outputIndex: 0,
checkIndex: 3,
flags: 1,
childFlags: 17186833,
directChildFlags: 16777217,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 11,
bindings: [Array],
bindingFlags: 24,
outputs: [Array],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
elView:
{ def: [Object],
parent: [Object],
viewContainerParent: null,
parentNodeDef: [Object],
context: [NgIfContext],
component: [BsDatepickerContainerComponent],
nodes: [Array],
state: 13,
root: [Object],
renderer: [DebugRenderer2],
oldValues: [Array],
disposables: [Array],
initIndex: -1 } },
ngErrorLogger: [Function: bound ] }
console.error undefined:196
ERROR CONTEXT DebugContext_ {
view:
{ def:
{ factory: [Function: View_BsDatepickerContainerComponent_1],
nodeFlags: 17187345,
rootNodeFlags: 1,
nodeMatchedQueries: 0,
flags: 0,
nodes: [Array],
updateDirectives: [Function],
updateRenderer: [Function],
handleEvent: [Function: handleEvent],
bindingCount: 9,
outputCount: 1,
lastRenderRootNode: [Object] },
parent:
{ def: [Object],
parent: [Object],
viewContainerParent: null,
parentNodeDef: [Object],
context: [BsDatepickerContainerComponent],
component: [BsDatepickerContainerComponent],
nodes: [Array],
state: 268,
root: [Object],
renderer: [DebugRenderer2],
oldValues: [Array],
disposables: null,
initIndex: -1 },
viewContainerParent: null,
parentNodeDef:
{ nodeIndex: 0,
parent: null,
renderParent: null,
bindingIndex: 0,
outputIndex: 0,
flags: 16777217,
checkIndex: -1,
childFlags: 147472,
directChildFlags: 147472,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 2,
bindings: [],
bindingFlags: 0,
outputs: [],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
context: NgIfContext { '$implicit': 'day', ngIf: 'day' },
component:
BsDatepickerContainerComponent {
_customRangesFish: [],
_config: [Object],
_store: [BsDatepickerStore],
_element: [ElementRef],
_actions: BsDatepickerActions {},
_positionService: [PositioningService],
valueChange: [EventEmitter],
animationState: 'void',
_subs: [Array],
_effects: [BsDatepickerEffects],
placement: 'bottom',
isOtherMonthsActive: undefined,
containerClass: 'dark-blue',
daysCalendar: [AnonymousSubject],
monthsCalendar: [AnonymousSubject],
yearsCalendar: [AnonymousSubject],
viewMode: [AnonymousSubject],
options: [AnonymousSubject],
setViewMode: [Function],
navigateTo: [Function],
dayHoverHandler: [Function],
monthHoverHandler: [Function],
yearHoverHandler: [Function],
monthSelectHandler: [Function],
yearSelectHandler: [Function] },
nodes: [ [Object], [Object], [Object], <14 empty items> ],
state: 13,
root:
{ ngModule: [NgModuleRef_],
injector: [StaticInjector],
projectableNodes: [],
selectorOrNode: undefined,
sanitizer: [DomSanitizerImpl],
rendererFactory: [DebugRendererFactory2],
renderer: [DebugRenderer2],
errorHandler: [ErrorHandler] },
renderer:
DebugRenderer2 {
delegate: [DefaultDomRenderer2],
debugContextFactory: [Function: getCurrentDebugContext],
data: [Object: null prototype] {} },
oldValues: [ <9 empty items> ],
disposables: [ <1 empty item> ],
initIndex: -1 },
nodeIndex: 3,
nodeDef:
{ nodeIndex: 3,
parent:
{ nodeIndex: 0,
parent: null,
renderParent: null,
bindingIndex: 0,
outputIndex: 0,
checkIndex: 0,
flags: 1,
childFlags: 17187345,
directChildFlags: 17056257,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 16,
bindings: [],
bindingFlags: 0,
outputs: [],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
renderParent:
{ nodeIndex: 0,
parent: null,
renderParent: null,
bindingIndex: 0,
outputIndex: 0,
checkIndex: 0,
flags: 1,
childFlags: 17187345,
directChildFlags: 17056257,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 16,
bindings: [],
bindingFlags: 0,
outputs: [],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
bindingIndex: 2,
outputIndex: 0,
checkIndex: 3,
flags: 1,
childFlags: 17186833,
directChildFlags: 16777217,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 11,
bindings: [ [Object] ],
bindingFlags: 24,
outputs: [ [Object] ],
element:
{ ns: '',
name: 'div',
attrs: [Array],
template: null,
componentProvider: null,
componentView: null,
componentRendererType: null,
publicProviders: [Object],
allProviders: [Object],
handleEvent: [Function] },
provider: null,
text: null,
query: null,
ngContent: null },
elDef:
{ nodeIndex: 3,
parent:
{ nodeIndex: 0,
parent: null,
renderParent: null,
bindingIndex: 0,
outputIndex: 0,
checkIndex: 0,
flags: 1,
childFlags: 17187345,
directChildFlags: 17056257,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 16,
bindings: [],
bindingFlags: 0,
outputs: [],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
renderParent:
{ nodeIndex: 0,
parent: null,
renderParent: null,
bindingIndex: 0,
outputIndex: 0,
checkIndex: 0,
flags: 1,
childFlags: 17187345,
directChildFlags: 17056257,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 16,
bindings: [],
bindingFlags: 0,
outputs: [],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
bindingIndex: 2,
outputIndex: 0,
checkIndex: 3,
flags: 1,
childFlags: 17186833,
directChildFlags: 16777217,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 11,
bindings: [ [Object] ],
bindingFlags: 24,
outputs: [ [Object] ],
element:
{ ns: '',
name: 'div',
attrs: [Array],
template: null,
componentProvider: null,
componentView: null,
componentRendererType: null,
publicProviders: [Object],
allProviders: [Object],
handleEvent: [Function] },
provider: null,
text: null,
query: null,
ngContent: null },
elView:
{ def:
{ factory: [Function: View_BsDatepickerContainerComponent_1],
nodeFlags: 17187345,
rootNodeFlags: 1,
nodeMatchedQueries: 0,
flags: 0,
nodes: [Array],
updateDirectives: [Function],
updateRenderer: [Function],
handleEvent: [Function: handleEvent],
bindingCount: 9,
outputCount: 1,
lastRenderRootNode: [Object] },
parent:
{ def: [Object],
parent: [Object],
viewContainerParent: null,
parentNodeDef: [Object],
context: [BsDatepickerContainerComponent],
component: [BsDatepickerContainerComponent],
nodes: [Array],
state: 268,
root: [Object],
renderer: [DebugRenderer2],
oldValues: [Array],
disposables: null,
initIndex: -1 },
viewContainerParent: null,
parentNodeDef:
{ nodeIndex: 0,
parent: null,
renderParent: null,
bindingIndex: 0,
outputIndex: 0,
flags: 16777217,
checkIndex: -1,
childFlags: 147472,
directChildFlags: 147472,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: null,
childCount: 2,
bindings: [],
bindingFlags: 0,
outputs: [],
element: [Object],
provider: null,
text: null,
query: null,
ngContent: null },
context: NgIfContext { '$implicit': 'day', ngIf: 'day' },
component:
BsDatepickerContainerComponent {
_customRangesFish: [],
_config: [Object],
_store: [BsDatepickerStore],
_element: [ElementRef],
_actions: BsDatepickerActions {},
_positionService: [PositioningService],
valueChange: [EventEmitter],
animationState: 'void',
_subs: [Array],
_effects: [BsDatepickerEffects],
placement: 'bottom',
isOtherMonthsActive: undefined,
containerClass: 'dark-blue',
daysCalendar: [AnonymousSubject],
monthsCalendar: [AnonymousSubject],
yearsCalendar: [AnonymousSubject],
viewMode: [AnonymousSubject],
options: [AnonymousSubject],
setViewMode: [Function],
navigateTo: [Function],
dayHoverHandler: [Function],
monthHoverHandler: [Function],
yearHoverHandler: [Function],
monthSelectHandler: [Function],
yearSelectHandler: [Function] },
nodes: [ [Object], [Object], [Object], <14 empty items> ],
state: 13,
root:
{ ngModule: [NgModuleRef_],
injector: [StaticInjector],
projectableNodes: [],
selectorOrNode: undefined,
sanitizer: [DomSanitizerImpl],
rendererFactory: [DebugRendererFactory2],
renderer: [DebugRenderer2],
errorHandler: [ErrorHandler] },
Test Suites: 1 passed, 1 total
Tests: 13 passed, 13 total
Snapshots: 0 total
Time: 9.796s, estimated 16s
Ran all test suites matching /ipx-date-picker.component.spec/i.
Waiting for the debugger to disconnect...
PS C:\Ritesh WorkPlace\TFS Work\InprotechKaizen\condor> & 'C:\Program Files\nodejs\node.exe' '--inspect-brk=7166' 'node_modules\jest\bin\jest.js' 'ipx-data-type.directive.spec'
Debugger listening on ws://127.0.0.1:7166/a7514513-23f7-423c-93a5-f6ed0b9736f3
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
PASS client/ng/shared/component/forms/ipx-data-type/ipx-data-type.directive.spec.ts (5.967s)
测试套件:1个通过,总共1个 测试:7通过,共7 快照:共0个 时间:7.666秒,估计41秒 运行与/ipx-data-type.directive.spec/i匹配的所有测试套件。 等待调试器断开连接...
对于其他规格文件,我没有任何错误。
任何帮助对我都是有益的。
谢谢。