Gavin Henry (7) [Avatar] Offline

On page 49 you say to open the websocket page in chrome, but you should say:



Edd Yerburgh (42) [Avatar] Offline

You're correct, it should say that you should open chrome://inspect. I'll correct page 49.

131190 (5) [Avatar] Offline
It would be good to fix this sooner than later. I lost a lot of time on this today.
574651 (4) [Avatar] Offline
Yes. Please fix this!

Furthermore I run into following error when in debugger:

Error: Cannot find modul '@/components/Test' from 'Test.spec.js'

My Test.vue component:
import { shallowMount } from '@vue/test-utils'
import Test from '@/components/Test'

describe('Test.vue', () => {
  test('renders test', () => {
    const wrapper = shallowMount(Test)

The import works for the test, but not in debug mode...
574651 (4) [Avatar] Offline
Okay... so all my problems would have been solved by looking into the code for Chapter 5

So if you use the vue-cli to scaffold a project including jest tests setup you need to specify the jest config file aswell to debug your jest tests.

For the standard webpack vue project (via vue init) a debug command looks like the following:

"debug": "node --inspect ./node_modules/jest/bin/jest --config test/unit/jest.conf.js"

If you are using VSCode, you can also debug your vue jest tests with the following configs added to the launch.json:

      "type": "node",
      "request": "launch",
      "name": "Jest All",
      "program": "${workspaceFolder}/node_modules/jest/bin/jest",
      "args": ["--config=test/unit/jest.conf.js"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "sourceMapPathOverrides": {
        "webpack:///src/*": "${webRoot}/*"
      "type": "node",
      "request": "launch",
      "name": "Jest Current File",
      "program": "${workspaceFolder}/node_modules/jest/bin/jest",
      "args": ["${relativeFile}","--config=test/unit/jest.conf.js"],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"

I hope this helps someone to avoid some wasted hours smilie