Merge pull request #30581 from nextcloud/bugfix/noid/npm-ci-for-karma/stable22

[stable22] Use npm ci when running JS tests
This commit is contained in:
Vincent Petry 2022-01-11 08:53:55 +01:00 committed by GitHub
commit 0770cb82b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 6245 additions and 1015 deletions

View file

@ -293,7 +293,7 @@ var f=function(){function t(e,n){var r=n.el,a=n.open,o=n.close;!function(t,e){if
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/a.default.prototype.t=t,window.OCA.Files||(window.OCA.Files={}),Object.assign(window.OCA.Files,{Settings:new i}),Object.assign(window.OCA.Files.Settings,{Setting:f}),window.addEventListener("DOMContentLoaded",(function(){new a.default({el:"#files-app-settings",render:function(t){return t(c)}});var t=document.getElementById("app-settings-header");t&&t.addEventListener("click",(function(t){var e=t.currentTarget.children[0].classList.contains("opened");OCA.Files.Settings.settings.forEach((function(t){return e?t.close():t.open()}))}))}));var A=r(184),d=r(324),h=r(65),m=r(33),g=r(40),v=function(){var t,e,n,r,a=(null===(t=OCA)||void 0===t||null===(e=t.Files)||void 0===e||null===(n=e.App)||void 0===n||null===(r=n.currentFileList)||void 0===r?void 0:r.dirInfo)||{path:"/",name:""};return"".concat(a.path,"/").concat(a.name).replace(/\/\//gi,"/")},y=r(46),b=r.n(y),x=r(515),C=r(162),w=r(167),T=r.n(w),E=r(516),_=r.n(E);function S(t,e,n,r,a,o,i){try{var s=t[o](i),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,a)}function k(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(t){S(o,r,a,i,s,"next",t)}function s(t){S(o,r,a,i,s,"throw",t)}i(void 0)}))}}
*/a.default.prototype.t=t,window.OCA.Files||(window.OCA.Files={}),Object.assign(window.OCA.Files,{Settings:new i}),Object.assign(window.OCA.Files.Settings,{Setting:f}),window.addEventListener("DOMContentLoaded",(function(){if(!window.TESTING){new a.default({el:"#files-app-settings",render:function(t){return t(c)}});var t=document.getElementById("app-settings-header");t&&t.addEventListener("click",(function(t){var e=t.currentTarget.children[0].classList.contains("opened");OCA.Files.Settings.settings.forEach((function(t){return e?t.close():t.open()}))}))}}));var A=r(184),d=r(324),h=r(65),m=r(33),g=r(40),v=function(){var t,e,n,r,a=(null===(t=OCA)||void 0===t||null===(e=t.Files)||void 0===e||null===(n=e.App)||void 0===n||null===(r=n.currentFileList)||void 0===r?void 0:r.dirInfo)||{path:"/",name:""};return"".concat(a.path,"/").concat(a.name).replace(/\/\//gi,"/")},y=r(46),b=r.n(y),x=r(515),C=r(162),w=r(167),T=r.n(w),E=r(516),_=r.n(E);function S(t,e,n,r,a,o,i){try{var s=t[o](i),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,a)}function k(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(t){S(o,r,a,i,s,"next",t)}function s(t){S(o,r,a,i,s,"throw",t)}i(void 0)}))}}
/**
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
*

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -37,6 +37,9 @@ Object.assign(window.OCA.Files, { Settings: new Settings() })
Object.assign(window.OCA.Files.Settings, { Setting })
window.addEventListener('DOMContentLoaded', function() {
if (window.TESTING) {
return
}
// Init Vue app
// eslint-disable-next-line
new Vue({

View file

@ -58,5 +58,7 @@ __webpack_public_path__ = generateFilePath('files', '', 'js/')
Vue.prototype.t = t
const View = Vue.extend(PersonalSettings)
new View().$mount('#files-personal-settings')
if (!window.TESTING) {
const View = Vue.extend(PersonalSettings)
new View().$mount('#files-personal-settings')
}

View file

@ -179,6 +179,8 @@
})();
window.addEventListener('DOMContentLoaded', function() {
OCA.SystemTags.Admin.init();
if (!window.TESTING) {
OCA.SystemTags.Admin.init();
}
});

View file

@ -20,7 +20,7 @@ then
fi
# update/install test packages
mkdir -p "$PREFIX" && $NPM install --link --prefix "$PREFIX" || exit 3
mkdir -p "$PREFIX" && $NPM ci --link --prefix "$PREFIX" || exit 3
# create scss test
mkdir -p tests/css

7208
build/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
"version": "0.0.2",
"author": {
"name": "Vincent Petry",
"email": "pvince81@owncloud.com"
"email": "vincent@nextcloud.com"
},
"private": true,
"homepage": "https://github.com/nextcloud/",
@ -25,5 +25,11 @@
"puppeteer": "^10.0.0",
"sinon": "<= 5.0.7"
},
"engine": "node >= 6.9"
"overrides": {
"colors": "1.4.0"
},
"engine": "node >= 6.9",
"optionalDependencies": {
"fsevents": "^2.3.2"
}
}

View file

@ -73,7 +73,7 @@ describe('Contacts menu', function() {
opening.then(function() {
expect($menuEl.html()).toContain('Could not load your contacts');
expect(console.error).toHaveBeenCalledTimes(1);
expect(console.error).toHaveBeenCalled();
done();
}, function(e) {
done.fail(e);

View file

@ -123,7 +123,8 @@ describe('jquery.contactsMenu tests', function() {
);
$selector1.on('load', function() {
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded" style="display: block;"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="mailto:bar%40baz.wtf"><img src="foo.svg"><span>bar@baz.wtf</span></a></li></ul></div>');
// FIXME: don't compare HTML one to one but check specific text in the output
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="mailto:bar%40baz.wtf"><img src="foo.svg"><span>bar@baz.wtf</span></a></li></ul></div>');
done();
});
@ -154,7 +155,8 @@ describe('jquery.contactsMenu tests', function() {
expect(fakeServer.requests[0].url).toEqual('http://localhost/index.php/contactsmenu/findOne');
$selector1.on('load', function() {
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded" style="display: block;"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="mailto:bar%40baz.wtf"><img src="foo.svg"><span>bar@baz.wtf</span></a></li><li><a href="http://localhost/index.php/apps/contacts"><img src="details.svg"><span>Details</span></a></li></ul></div>');
// FIXME: don't compare HTML one to one but check specific text in the output
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="mailto:bar%40baz.wtf"><img src="foo.svg"><span>bar@baz.wtf</span></a></li><li><a href="http://localhost/index.php/apps/contacts"><img src="details.svg"><span>Details</span></a></li></ul></div>');
done();
});
@ -178,7 +180,8 @@ describe('jquery.contactsMenu tests', function() {
expect(fakeServer.requests[0].url).toEqual('http://localhost/index.php/contactsmenu/findOne');
$selector1.on('load', function() {
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded" style="display: block;"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="#"><span>No action available</span></a></li></ul></div>');
// FIXME: don't compare HTML one to one but check specific text in the output
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="#"><span>No action available</span></a></li></ul></div>');
done();
});
@ -197,7 +200,8 @@ describe('jquery.contactsMenu tests', function() {
expect(fakeServer.requests[0].url).toEqual('http://localhost/index.php/contactsmenu/findOne');
$selector1.on('loaderror', function() {
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded" style="display: block;"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="#"><span>Error fetching contact actions</span></a></li></ul></div>');
// FIXME: don't compare HTML one to one but check specific text in the output
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="#"><span>Error fetching contact actions</span></a></li></ul></div>');
done();
});
@ -216,7 +220,8 @@ describe('jquery.contactsMenu tests', function() {
expect(fakeServer.requests[0].url).toEqual('http://localhost/index.php/contactsmenu/findOne');
$selector1.on('loaderror', function() {
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded" style="display: block;"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="#"><span>No action available</span></a></li></ul></div>');
// FIXME: don't compare HTML one to one but check specific text in the output
expect($appendTo.html().replace(/[\r\n\t]?(\ \ +)?/g, '')).toEqual('<div class="menu popovermenu menu-left contactsmenu-popover loaded"><ul><li class="hidden"><a><span class="icon-loading-small"></span></a></li><li><a href="#"><span>No action available</span></a></li></ul></div>');
done();
});