TypeError: Cannot read property 'lang' of null
See original GitHub issueI am trying out your webpack template to use jest for unit testing in a new little app and am getting this error when running npm run unit
:
FAIL test/unit/specs/App.spec.js
● Test suite failed to run
TypeError: Cannot read property 'lang' of null
at processScript (node_modules/jest-vue/lib/process.js:13:17)
at Object.module.exports [as process] (node_modules/jest-vue/lib/process.js:27:18)
at Object.<anonymous> (test/unit/specs/App.spec.js:1:114)
I reduced the file to an absolute minimum and I’m still getting the error.
App.spec.js
import App from '@/App'
App.vue
<template>
<div id="app">
</div>
</template>
package.json
...
"jest": "^21.2.0",
"jest-vue": "^0.7.0",
...
This is the offending line in jest-vue/lib/process.js
:
function processScript (scriptPart) {
if (scriptPart.lang === 'typescript' || scriptPart.lang === 'ts') {
Which seems to make sense since I do not define a lang
attribute on my script tags.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:23 (12 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >TypeError: Cannot read properties of null (reading 'user')
I want to get (mohammad) in my console but when I use: console.log(user.user.name), I give TypeError: Cannot read properties of null ...
Read more >How to deal with TypeError: cannot read properties of null
While coding in Javascript, you must have at least once received a Type Error which has the message “cannot read properties of null”....
Read more >Throwing an Error "cannot read property style of null" in ...
When we are trying to access one property i.e. either doesn't contain any value (not even defined properly) in it or it is...
Read more >Resolving "Cannot call method * of null" or "Cannot read ...
If you are seeing these typeErrors in your logs, the root cause of the issue is that the object that you are attempting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It worked 😄
@icaioincau Try again changing your template to
<template functional>...</template>