Skip to content

TypeError: Cannot read property 'lang' of null #16

Closed
@chlab

Description

@chlab

I 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions