Merge pull request #30718 from nextcloud/tests/use_npm7_for_autotest-js

Support npm 7 when running autotest-js.sh
pull/30745/head
Louis 2022-01-18 16:42:08 +07:00 committed by GitHub
commit 3d8d797137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 6478 additions and 11114 deletions

3
.gitattributes vendored

@ -1,3 +1,2 @@
/dist/* binary
/package-lock.json binary
/build/package-lock.json binary
/package-lock.json binary

@ -28,7 +28,7 @@ jobs:
test:
runs-on: ubuntu-latest
needs: versions
steps:
- name: Checkout
uses: actions/checkout@v2
@ -60,10 +60,11 @@ jobs:
with:
node-version: ${{ needs.versions.outputs.nodeVersion }}
# This test requires npm6 for some reason
# TODO: fix this and/or move away from jsunit
- name: Set up npm 6
run: npm i -g npm@^6
- name: Set up npm ${{ needs.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ needs.versions.outputs.npmVersion }}"
- name: Install dependencies
run: npm ci
- name: Test
run: ./autotest-js.sh
@ -71,7 +72,7 @@ jobs:
handlebars:
runs-on: ubuntu-latest
needs: versions
steps:
- name: Checkout
uses: actions/checkout@v2

@ -8,30 +8,15 @@
# @copyright 2014 Vincent Petry <pvince81@owncloud.com>
#
# set -e
NPM="$(which npm 2>/dev/null)"
PREFIX="build"
if test -z "$NPM"
then
echo 'Node JS >= 0.8 is required to run the JavaScript tests' >&2
exit 1
fi
# update/install test packages
mkdir -p "$PREFIX" && $NPM ci --link --prefix "$PREFIX" || exit 3
set -euo pipefail
# create scss test
# We use the deprecated node-sass module for that as the compilation fails with modern modules. See "DEPRECATION WARNING" during execution of this script.
mkdir -p tests/css
for SCSSFILE in core/css/*.scss
do
FILE=$(basename $SCSSFILE)
FILENAME="${FILE%.*}"
printf "\$webroot:''; @import 'functions.scss'; @import 'variables.scss'; @import '${FILE}';" | ./build/bin/node-sass --include-path core/css/ > tests/css/${FILE}.css
printf "\$webroot:''; @import 'functions.scss'; @import 'variables.scss'; @import '${FILE}';" | ./node_modules/.bin/node-sass --include-path core/css/ > tests/css/${FILE}.css
done
KARMA="$PREFIX/node_modules/karma/bin/karma"
NODE_PATH='build/node_modules' KARMA_TESTSUITE="$1" $KARMA start tests/karma.config.js --single-run
npm run test:jsunit

9481
build/package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,32 +0,0 @@
{
"name": "nextcloud-js-tests",
"description": "Nextcloud tests",
"version": "0.0.2",
"author": {
"name": "Vincent Petry",
"email": "vincent@nextcloud.com"
},
"private": true,
"homepage": "https://github.com/nextcloud/",
"contributors": [],
"devDependencies": {
"handlebars": "^4.7.7",
"jasmine-core": "~2.5.2",
"jasmine-sinon": "^0.4.0",
"jsdoc": "^3.6.7",
"karma": "^6.3.4",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "2.0.1",
"karma-jasmine": "^1.1.2",
"karma-jasmine-sinon": "^1.0.4",
"karma-spec-reporter": "^0.0.32",
"karma-viewport": "^1.0.8",
"node-sass": "~7.0.1",
"puppeteer": "^13.0.1",
"sinon": "<= 5.0.7"
},
"overrides": {
"colors": "1.4.0"
},
"engine": "node >= 6.9"
}

@ -124,7 +124,7 @@ describe('jquery.contactsMenu tests', function() {
$selector1.on('load', function() {
// 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>');
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>');
done();
});
@ -156,7 +156,7 @@ describe('jquery.contactsMenu tests', function() {
$selector1.on('load', function() {
// 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>');
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>');
done();
});
@ -181,7 +181,7 @@ describe('jquery.contactsMenu tests', function() {
$selector1.on('load', function() {
// 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>');
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>');
done();
});
@ -201,7 +201,7 @@ describe('jquery.contactsMenu tests', function() {
$selector1.on('loaderror', function() {
// 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>');
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>');
done();
});
@ -221,7 +221,7 @@ describe('jquery.contactsMenu tests', function() {
$selector1.on('loaderror', function() {
// 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>');
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>');
done();
});

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

@ -390,8 +390,6 @@
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
/**
*
*

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

4
dist/core-main.js vendored

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

File diff suppressed because one or more lines are too long

7974
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -14,7 +14,8 @@
"lint": "eslint '**/src/**/*.{vue,js}'",
"lint:fix": "eslint '**/src/**/*.{vue,js}' --fix",
"test": "jest",
"test:watch": "jest --watch"
"test:watch": "jest --watch",
"test:jsunit": "karma start tests/karma.config.js --single-run"
},
"repository": {
"type": "git",
@ -124,7 +125,21 @@
"vue-template-compiler": "^2.6.14",
"webpack": "^5.66.0",
"webpack-cli": "^4.9.1",
"webpack-merge": "^5.8.0"
"webpack-merge": "^5.8.0",
"handlebars": "^4.7.7",
"jasmine-core": "~2.5.2",
"jasmine-sinon": "^0.4.0",
"jsdoc": "^3.6.7",
"karma": "^6.3.11",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "2.1.0",
"karma-jasmine": "^1.1.2",
"karma-jasmine-sinon": "^1.0.4",
"karma-spec-reporter": "^0.0.33",
"karma-viewport": "^1.0.8",
"node-sass": "~6.0.1",
"puppeteer": "^13.1.0",
"sinon": "<= 5.0.7"
},
"browserslist": [
"extends @nextcloud/browserslist-config"
@ -133,6 +148,9 @@
"node": "^14.0.0",
"npm": "^7.0.0"
},
"overrides": {
"colors": "1.4.0"
},
"jest": {
"moduleFileExtensions": [
"js",
@ -146,4 +164,4 @@
"^.+\\.vue$": "vue-jest"
}
}
}
}