Skip to content

Instantly share code, notes, and snippets.

@wirepair
Created December 31, 2019 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wirepair/baf3c87cfff3b3ebd30fe30f09aee00c to your computer and use it in GitHub Desktop.
Save wirepair/baf3c87cfff3b3ebd30fe30f09aee00c to your computer and use it in GitHub Desktop.
Debug Mocha, vue-cli 3 es module tests, in vscode (requires debugger statements)
import { expect } from 'chai'
import { shallowMount } from '@vue/test-utils'
import HelloWorld from '@/components/HelloWorld.vue'
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message'
debugger
const wrapper = shallowMount(HelloWorld, {
propsData: { msg }
})
expect(wrapper.text()).to.include(msg)
})
})
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Current File",
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/**/*.js"
],
"program": "${workspaceFolder}/node_modules/.bin/vue-cli-service",
"args": [
"test:unit",
"--inspect-brk",
"--watch",
"--timeout",
"900000",
"${file}"
],
"port": 9229,
"internalConsoleOptions": "neverOpen"
}
]
}
{
"name": "NAME",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
"dependencies": {
"vue": "^2.6.10"
},
"devDependencies": {
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-unit-mocha": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/test-utils": "1.0.0-beta.29",
"babel-eslint": "^10.0.3",
"babel-preset-env": "^1.7.0",
"chai": "^4.1.2",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.6.10"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment