Skip to content

Instantly share code, notes, and snippets.

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 nothingismagick/1ad3b1ed70139acdf7a083f3f0e8b33b to your computer and use it in GitHub Desktop.
Save nothingismagick/1ad3b1ed70139acdf7a083f3f0e8b33b to your computer and use it in GitHub Desktop.
quasar test notes
# This is my log of what is currently working with my extension of
# the quasar-cli to include unit testing.
# It is
###########
quasar init test
# creates normally without errors (except these warnings - this is actually done before I link)
warning " > eslint-config-standard@10.2.1" has incorrect peer dependency "eslint-plugin-promise@>=3.5.0".
warning " > eslint-loader@1.7.1" has incorrect peer dependency "eslint@>=1.6.0 <4.0.0".
# quasar mode -r|-a pwa|cordova|electron|test
quasar mode --add test # if not in right folder
app:paths Error. This command must be executed inside a Quasar Project folder. +0ms
ok
quasar mode --add test # (creates /test folder and clones contents from /templates/)
app:mode-test Creating Unit Test source folder... +18s
app:mode-test Unit Test support was added +4ms
# if run a second time:
app:mode-test Test support detected. Aborting. +0ms
quasar mode --remove test # (irrevocably removes $quasarApp/test folder and all contents
# TODO: ask for confirmation)
app:mode-test Unit Test support was removed +9s
# if run a second time:
app:mode-test No Test support detected. Aborting. +0ms
# quasar new [t|test] <test_name>
# this clones another test-template into the Quasar App /test folder
quasar new test "testy"
app:new Generated test: test/testy.js +0ms
app:new Make sure to reference it in test/test.js +3ms
quasar dev --mode test
# Builds - not showing tests yet.
quasar test testy.js
"test": "cross-env NODE_ENV=test nyc mocha-webpack --webpack-config templates/unit_test/webpack.config.js --require templates/unit_test/setup.js templates/unit_test/**/*.spec.js"
"test": "mocha --reporter spec templates/app/test.js"
---- needed
"@vue/test-utils": "^1.0.0-beta.12",
"babel-plugin-coverage": "^1.0.0",
"cross-env": "^5.1.4",
"expect": "^22.4.0",
"jsdom": "^11.6.2",
"jsdom-global": "^3.0.2",
"nyc": "^11.4.1",
"vue-server-renderer": "^2.5.15",
"vue-template-compiler": "2.5.14",
"webpack-merge": "4.1.2",
"webpack-node-externals": "^1.6.0"
{
test: 'test/*.js', // /test\.js$/,
use: 'mocha-loader',
exclude: /node_modules/,
},
if (process.env.NODE_ENV === 'test') {
// exclude NPM deps from test bundle
module.exports.externals = [require('webpack-node-externals')()]
// use inline source map so that it works with mocha-webpack
module.exports.devtool = 'inline-cheap-module-source-map'
}
quasar dev --mode test
-- actually installs test mode!!! how cool is that!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment