Skip to content

Instantly share code, notes, and snippets.

@keyurshah
Created January 15, 2020 04:22
Show Gist options
  • Save keyurshah/b0ff03cb72d69530a7e40f8a9f54fe21 to your computer and use it in GitHub Desktop.
Save keyurshah/b0ff03cb72d69530a7e40f8a9f54fe21 to your computer and use it in GitHub Desktop.
AlpineJS Errors
FAIL test/lifecycle.spec.js
● callbacks registered within x-created can affect reactive data changes
expect(received).toEqual(expected) // deep equality
Expected: "baz"
Received: undefined
51 | Alpine.start()
52 |
> 53 | expect(document.querySelector('span').innerText).toEqual('baz')
| ^
54 |
55 | document.querySelector('button').click()
56 |
at Object.<anonymous>.test (test/lifecycle.spec.js:53:54)
● callbacks registered within x-mounted can affect reactive data changes
TypeError: Cannot read property 'foo' of undefined
at foo (eval at i (src/utils.js:57:13), <anonymous>:3:69)
at eval (eval at n (src/utils.js:63:13), <anonymous>:3:21)
at saferEvalNoReturn (src/utils.js:63:13)
at new c (src/component.js:58:13)
at Object.initializeComponent (src/index.js:70:18)
at callback (src/index.js:11:18)
at forEach (src/index.js:31:13)
at Proxy.forEach (<anonymous>)
at Object.discoverComponents (src/index.js:30:17)
at Object.start (src/index.js:10:14)
at Object.<anonymous>.test (test/lifecycle.spec.js:51:12)
● callbacks registered within x-mounted can affect reactive data changes
TypeError: Cannot read property 'foo' of undefined
at foo (eval at i (src/utils.js:57:13), <anonymous>:3:69)
at eval (eval at n (src/utils.js:63:13), <anonymous>:3:21)
at saferEvalNoReturn (src/utils.js:63:13)
at new c (src/component.js:72:13)
at Object.initializeComponent (src/index.js:70:18)
at callback (src/index.js:11:18)
at forEach (src/index.js:31:13)
at Proxy.forEach (<anonymous>)
at Object.discoverComponents (src/index.js:30:17)
at Object.start (src/index.js:10:14)
at Object.<anonymous>.test (test/lifecycle.spec.js:69:12)
FAIL test/ref.spec.js
● Console
console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
Error: Uncaught [TypeError: Cannot read property 'bob' of undefined]
at reportException (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\helpers\runtime-script-errors.js:66:24)
at invokeEventListeners (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:209:9)
at HTMLButtonElementImpl._dispatch (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:119:9)
at HTMLButtonElementImpl.dispatchEvent (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:82:17)
at HTMLButtonElementImpl.dispatchEvent (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\nodes\HTMLElement-impl.js:30:27)
at HTMLButtonElementImpl.click (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\nodes\HTMLElement-impl.js:72:10)
at HTMLButtonElement.click (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\generated\HTMLElement.js:31:21)
at Object.<anonymous>.test (D:\myfiles\git\github\alpine\test\ref.spec.js:39:38)
at Object.asyncJestTest (D:\myfiles\git\github\alpine\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:102:37)
at resolve (D:\myfiles\git\github\alpine\node_modules\jest-jasmine2\build\queueRunner.js:43:12) TypeError: Cannot read property 'bob' of undefined
at foo (eval at i (D:\myfiles\git\github\alpine\src\utils.js:57:13), <anonymous>:3:57)
at eval (eval at n (D:\myfiles\git\github\alpine\src\utils.js:63:13), <anonymous>:3:21)
at saferEvalNoReturn (D:\myfiles\git\github\alpine\src\utils.js:63:13)
at c.evaluateCommandExpression (D:\myfiles\git\github\alpine\src\component.js:395:9)
at c.runListenerHandler (D:\myfiles\git\github\alpine\src\component.js:356:14)
at HTMLButtonElement.a (D:\myfiles\git\github\alpine\src\component.js:344:22)
at invokeEventListeners (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:193:27)
at HTMLButtonElementImpl._dispatch (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:119:9)
at HTMLButtonElementImpl.dispatchEvent (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\events\EventTarget-impl.js:82:17)
at HTMLButtonElementImpl.dispatchEvent (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\nodes\HTMLElement-impl.js:30:27)
at HTMLButtonElementImpl.click (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\nodes\HTMLElement-impl.js:72:10)
at HTMLButtonElement.click (D:\myfiles\git\github\alpine\node_modules\jsdom\lib\jsdom\living\generated\HTMLElement.js:31:21)
at Object.<anonymous>.test (D:\myfiles\git\github\alpine\test\ref.spec.js:39:38)
at Object.asyncJestTest (D:\myfiles\git\github\alpine\node_modules\jest-jasmine2\build\jasmineAsyncInstall.js:102:37)
at resolve (D:\myfiles\git\github\alpine\node_modules\jest-jasmine2\build\queueRunner.js:43:12)
at new Promise (<anonymous>)
at mapper (D:\myfiles\git\github\alpine\node_modules\jest-jasmine2\build\queueRunner.js:26:19)
at promise.then (D:\myfiles\git\github\alpine\node_modules\jest-jasmine2\build\queueRunner.js:73:41)
● can reference elements from data object methods
TypeError: Cannot read property 'bob' of undefined
at foo (eval at i (src/utils.js:57:13), <anonymous>:3:57)
at eval (eval at n (src/utils.js:63:13), <anonymous>:3:21)
at saferEvalNoReturn (src/utils.js:63:13)
at c.evaluateCommandExpression (src/component.js:395:9)
at c.runListenerHandler (src/component.js:356:14)
at HTMLButtonElement.a (src/component.js:344:22)
at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
at HTMLButtonElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
at HTMLButtonElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
at HTMLButtonElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
at HTMLButtonElementImpl.click (node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:72:10)
at HTMLButtonElement.click (node_modules/jsdom/lib/jsdom/living/generated/HTMLElement.js:31:21)
at Object.<anonymous>.test (test/ref.spec.js:39:38)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment