Skip to content

Commit

Permalink
test: add support for vue server render testing
Browse files Browse the repository at this point in the history
  • Loading branch information
amoncaldas committed Oct 21, 2021
1 parent a3cf6eb commit 357495c
Show file tree
Hide file tree
Showing 438 changed files with 4,262 additions and 782 deletions.
6 changes: 5 additions & 1 deletion build/webpack.test.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ const webpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({
'process.env': require('../config/test.env')
})
]
],
node: {
fs: "empty",
module: "empty"
}
})

// no need for app entry during tests
Expand Down
2,481 changes: 2,451 additions & 30 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
"@babel/preset-env": "^7.15.8",
"@types/leaflet": "^1.5.17",
"@vue/babel-plugin-transform-vue-jsx": "^1.2.1",
"@vue/cli-service": "^4.5.14",
"@vue/server-test-utils": "^1.2.1",
"@vue/test-utils": "^1.2.2",
"autoprefixer": "^7.1.2",
"babel-core": "^7.0.0-bridge.0",
Expand Down Expand Up @@ -149,6 +151,7 @@
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^4.1.0",
"vue-loader": "^14.2.4",
"vue-server-renderer": "^2.6.14",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.22",
"webpack": "^4.44.1",
Expand Down
1,075 changes: 1,064 additions & 11 deletions tests/unit/coverage/html/index.html

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions tests/unit/coverage/html/src/app-loader.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">49.11% </span>
<span class="strong">41.96% </span>
<span class="quiet">Statements</span>
<span class='fraction'>55/112</span>
<span class='fraction'>47/112</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="strong">25.76% </span>
<span class="quiet">Branches</span>
<span class='fraction'>22/66</span>
<span class='fraction'>17/66</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">45.45% </span>
<span class="quiet">Functions</span>
<span class='fraction'>10/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">49.11% </span>
<span class="strong">41.96% </span>
<span class="quiet">Lines</span>
<span class='fraction'>55/112</span>
<span class='fraction'>47/112</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -457,24 +457,24 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -699,7 +699,7 @@ <h1>
*/
setFittingLocale (storedLocale) {
var deviceLocale = window.navigator.language || <span class="branch-1 cbranch-no" title="branch not covered" >window.navigator.userLanguage</span>
let locale = storedLocale || <span class="branch-1 cbranch-no" title="branch not covered" >deviceLocale</span>
let locale = storedLocale || deviceLocale
<span class="missing-if-branch" title="else path not taken" >E</span>if (locale) {
locale = locale.toLowerCase()
}
Expand Down Expand Up @@ -745,25 +745,25 @@ <h1>
var locale = null

// Restore settings stored in local storage, if available
<span class="missing-if-branch" title="else path not taken" >E</span>if (serializedMapSettings) {
const storedMapSettings = JSON.parse(serializedMapSettings)
for (const key in storedMapSettings) {
if (key === 'locale') {
locale = storedMapSettings.locale
<span class="missing-if-branch" title="if path not taken" >I</span>if (serializedMapSettings) {
const storedMapSettings = <span class="cstat-no" title="statement not covered" >JSON.parse(serializedMapSettings)</span>
<span class="cstat-no" title="statement not covered" > for (const key in storedMapSettings) {</span>
<span class="cstat-no" title="statement not covered" > if (key === 'locale') {</span>
<span class="cstat-no" title="statement not covered" > locale = storedMapSettings.locale</span>
} else {
<span class="missing-if-branch" title="else path not taken" >E</span>if (typeof storedMapSettings[key] === 'object') {
mapSettings[key] = Object.assign({}, storedMapSettings[key])
<span class="cstat-no" title="statement not covered" > if (typeof storedMapSettings[key] === 'object') {</span>
<span class="cstat-no" title="statement not covered" > mapSettings[key] = Object.assign({}, storedMapSettings[key])</span>
} else {
<span class="cstat-no" title="statement not covered" > mapSettings[key] = storedMapSettings[key]</span>
}
}
}
<span class="missing-if-branch" title="if path not taken" >I</span>if ( typeof mapSettings.apiKey !== 'string' || mapSettings.apiKey === '') {
<span class="cstat-no" title="statement not covered" > if ( typeof mapSettings.apiKey !== 'string' || mapSettings.apiKey === '') {</span>
<span class="cstat-no" title="statement not covered" > mapSettings.apiKey = defaultMapSettings.apiKey</span>
}
// If the settings was saved in local storage
// then this option is must start as true
mapSettings.saveToLocalStorage = true
<span class="cstat-no" title="statement not covered" > mapSettings.saveToLocalStorage = true</span>
}
&nbsp;
// Set the default value for profile in ors-filter
Expand Down Expand Up @@ -916,7 +916,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/coverage/html/src/common/global-mixins.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes">15×</span>
<span class="cline-any cline-yes">14×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -283,7 +283,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/common/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/common/main-menu.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/common/menu-mixin.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/common/prepared-vue.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/config/app-config.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2689,7 +2689,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/config/theme.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/coverage/html/src/directives/bg.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
40 changes: 20 additions & 20 deletions tests/unit/coverage/html/src/directives/click-outside.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">31.58% </span>
<span class="strong">5.26% </span>
<span class="quiet">Statements</span>
<span class='fraction'>6/19</span>
<span class='fraction'>1/19</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">9.09% </span>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1/11</span>
<span class='fraction'>0/11</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/3</span>
<span class='fraction'>0/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="strong">5.56% </span>
<span class="quiet">Lines</span>
<span class='fraction'>6/18</span>
<span class='fraction'>1/18</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -79,15 +79,15 @@ <h1>
34</td><td class="line-coverage quiet"><span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -97,10 +97,10 @@ <h1>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -110,17 +110,17 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">const clickOutside = {
bind: function (el, binding, vNode) {
bind: function (el, binding, vNode) <span class="fstat-no" title="function not covered" >{</span>
// Provided expression must evaluate to a function.
<span class="missing-if-branch" title="if path not taken" >I</span>if (typeof binding.value !== 'function') {
<span class="cstat-no" title="statement not covered" > if (typeof binding.value !== 'function') {</span>
const compName = <span class="cstat-no" title="statement not covered" >vNode.context.name</span>
let warn = <span class="cstat-no" title="statement not covered" >`[Vue-click-outside:] provided expression '${binding.expression}' is not a function, but has to be`</span>
<span class="cstat-no" title="statement not covered" > if (compName) { <span class="cstat-no" title="statement not covered" >warn += `Found in component '${compName}'` </span>}</span>
<span class="cstat-no" title="statement not covered" > console.warn(warn)</span>
}
// Define Handler and cache it on the element
const bubble = binding.modifiers.bubble
const handler = (e) =&gt; <span class="fstat-no" title="function not covered" >{</span>
const bubble = <span class="cstat-no" title="statement not covered" >binding.modifiers.bubble</span>
const handler = <span class="cstat-no" title="statement not covered" >(e) =&gt; <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" > if (el.id) {</span>
<span class="cstat-no" title="statement not covered" > el = document.getElementById(el.id)</span>
}
Expand All @@ -130,10 +130,10 @@ <h1>
<span class="cstat-no" title="statement not covered" > binding.value(e)</span>
}
}
el.__vueClickOutside__ = handler
<span class="cstat-no" title="statement not covered" > el.__vueClickOutside__ = handler</span>
&nbsp;
// add Event Listeners
document.addEventListener('click', handler)
<span class="cstat-no" title="statement not covered" > document.addEventListener('click', handler)</span>
},
unbind: function (el) <span class="fstat-no" title="function not covered" >{</span>
// Remove Event Listeners
Expand All @@ -148,7 +148,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 12:16:47 GMT+0200 (Central European Summer Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 21 2021 13:33:08 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down

0 comments on commit 357495c

Please sign in to comment.