-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy of the PR #412 by @skjnldsv #413
Conversation
Signed-off-by: John Molakvoæ <[email protected]>
Signed-off-by: John Molakvoæ <[email protected]>
There is an error in the CI where it doesn't find webpack : ' [webpack-cli] Error: Cannot find module 'webpack''
…r vue-loader vue-template-compiler
…elint-config-recommended-vue
…nded-scss stylelint-scss
It means it's not installed properly. Also see inspiration from https://github.com/nextcloud/.github/blob/master/workflow-templates/node.yml |
package.json
Outdated
"vue-loader": "^15.9.8", | ||
"vue-template-compiler": "^2.6.14", | ||
"webpack": "^5.67.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need all those dependencies.
They are automatically installed with their configs peerDependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My PR was done and working (beside the tests), have a look at it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's strange ! Because, without these dependencies, the build doesn't work...
I look at the workflow-templates/node.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your CI on 12 is using npm 6, you should also not use npm i
for CI, but npm ci.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh cool !
I will remove the dependencies I added a few minutes ago...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your CI on 12 is using npm 6, you should also not use
npm i
for CI, butnpm ci.
Okay ! What is the different ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.blog/2021-02-02-npm-7-is-now-generally-available/
Peer dependencies
Automatically installing peer dependencies is an exciting new feature introduced in npm 7. In previous versions of npm (4-6), peer dependencies conflicts presented a warning that versions were not compatible, but would still install dependencies without an error. npm 7 will block installations if an upstream dependency conflict is present that cannot be automatically resolved.
You have the option to retry with --force to bypass the conflict or --legacy-peer-deps command to ignore peer dependencies entirely (this behavior is similar to versions 4-6).
Since many packages in the ecosystem have come to rely on loose peer dependencies resolutions, npm 7 will print a warning and work around most peer conflicts that exist deep within the package tree, since you can’t fix those anyway. To enforce strictly correct peer dependency resolutions at all levels, use the --strict-peer-deps flag.
Yes, I heard of it the last week. I think it's very cool this feature :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.npmjs.com/cli/v8/commands/npm-ci
Important part:
It will never write to package.json or any of the package-locks: installs are essentially frozen.
.github/workflows/node.js.yml
Outdated
- name: Read package.json node and npm engines version | ||
uses: skjnldsv/[email protected] | ||
id: versions | ||
with: | ||
fallbackNode: '^12' | ||
fallbackNpm: '^6' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not what you want, I said "inspire yourself" not copy fully 😉
We use that for our old legacy branches. You want at least node12 and npm 7 I assume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not what you want, I said "imspire yourself" not copy fully 😉
Oooh yes of course ! I wanted test it before the custom ^^
package.json
Outdated
"css-loader": "^6.5.1", | ||
"eslint": "^8.8.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-webpack-plugin": "^3.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"css-loader": "^6.5.1", | |
"eslint": "^8.8.0", | |
"eslint-plugin-import": "^2.25.4", | |
"eslint-plugin-node": "^11.1.0", | |
"eslint-webpack-plugin": "^3.1.1", |
package.json
Outdated
"postcss-html": "^1.3.0", | ||
"prettier": "^2.5.1", | ||
"style-loader": "^3.3.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"style-loader": "^3.3.1", |
package.json
Outdated
"stylelint": "^14.3.0", | ||
"stylelint-config-recommended-scss": "^4.2.0", | ||
"stylelint-config-recommended-scss": "^5.0.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"stylelint-config-recommended-scss": "^5.0.2", |
You can also drop stylelint-config-recommended-vue
package.json
Outdated
"stylelint-scss": "^4.1.0", | ||
"stylelint-webpack-plugin": "^3.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"stylelint-scss": "^4.1.0", | |
"stylelint-webpack-plugin": "^3.1.1", |
package.json
Outdated
"url-loader": "^4.1.1", | ||
"vue-loader": "^15.9.6", | ||
"vue-template-compiler": "^2.6.12", | ||
"webpack": "^4.46.0", | ||
"webpack-cli": "^4.9.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"webpack-cli": "^4.9.2", |
package.json
Outdated
"stylelint-config-recommended-vue": "^1.1.0", | ||
"stylelint-scss": "^3.21.0", | ||
"stylelint-scss": "^4.1.0", | ||
"stylelint-webpack-plugin": "^3.1.1", | ||
"url-loader": "^4.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"url-loader": "^4.1.1", |
package.json
Outdated
"mochapack": "^2.1.2", | ||
"linkifyjs": "^3.0.5", | ||
"mochapack": "^2.1.4", | ||
"node-polyfill-webpack-plugin": "^1.1.4", | ||
"postcss-html": "^1.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you are using this dependency 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I use mochapack for tests
However, I don't think I use linkifyjs ^^
These dependencies are declared as peer-dependencies
I am inspired of this example: https://github.com/nextcloud/.github/blob/master/workflow-templates/node.yml
…-config's version In the package.json file, I add scripts related to css style, upgrade @nextcloud/eslint-config to 7.0.2 and add a BIG comments about the peerDependency problem of eslint package
It's not clean, but I can run my tests with this {
"name": "workspace",
"version": "1.0.0",
"description": "Place this app in **nextcloud/apps/**",
"main": "main.js",
"private": true,
"scripts": {
"build": "NODE_ENV=production webpack --progress --hide-modules --config webpack.config.js",
"dev": "NODE_ENV=development webpack --progress --config webpack.dev.config.js",
"test": "NODE_ENV=testing mochapack --webpack-config webpack.test.config.js --require \"src/tests/OC.js\" \"src/tests/**/*.js\"",
"lint": "eslint --ext .js,.vue src"
},
"repository": {
"type": "git",
"url": "git+https://github.com/arawa/workspace.git"
},
"keywords": [],
"author": "Arawa <https://www.arawa.fr/>",
"contributors": [
{
"name": "Baptiste Fotia",
"email": "[email protected]"
},
{
"name": "Cyrille Bollu",
"email": "[email protected]"
}
],
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/arawa/workspace/issues"
},
"homepage": "https://github.com/arawa/workspace#readme",
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.13.12",
"@nextcloud/babel-config": "^1.0.0",
"@nextcloud/browserslist-config": "^2.0.0",
"@nextcloud/eslint-config": "^4.0.0",
"@nextcloud/eslint-plugin": "^2.0.0",
"@nextcloud/stylelint-config": "^2.1.2",
"@nextcloud/webpack-vue-config": "^3.0.0",
"@vue/test-utils": "^1.2.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"chai": "^4.3.4",
"css-loader": "^4.3.0",
"eslint-webpack-plugin": "^2.5.3",
"jsdom": "^16.6.0",
"jsdom-global": "^3.0.2",
"mocha": "^8.4.0",
"mochapack": "^2.1.2",
"prettier": "^1.19.1",
"stylelint": "^13.12.0",
"stylelint-config-recommended-scss": "^4.2.0",
"stylelint-config-recommended-vue": "^1.3.0",
"stylelint-scss": "^3.19.0",
"url-loader": "^4.1.1",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.12",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12",
"webpack-merge": "^5.7.3",
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@babel/core": "^7.13.14",
"@babel/eslint-parser": "^7.13.14",
"@nextcloud/axios": "^1.6.0",
"@nextcloud/l10n": "^1.4.1",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^3.10.1",
"eslint": "^7.23.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-vue": "^7.8.0",
"ramda": "^0.27.1",
"stylelint-webpack-plugin": "^2.1.1",
"vue": "^2.6.12",
"vue-notification": "^1.3.20",
"vue-router": "^3.5.1",
"vuex": "^3.6.2"
},
"optionalDependencies": {
"fsevents": "^2.3.2"
}
} I know, it's not clean... |
In fact, it doesn't work :/ |
Narrowing down that issue should have make you look at an eslint-7-compatible version of $ npm i --save-dev @nextcloud/eslint-config@^6 \ -130-
@nextcloud/babel-config@latest \
@nextcloud/browserslist-config@latest \
@nextcloud/stylelint-config@latest \
@nextcloud/webpack-vue-config@^4
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
added 850 packages, and audited 851 packages in 23s
123 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details. $ cat package.json
{
"name": "vdsv16d5",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@nextcloud/babel-config": "^1.0.0",
"@nextcloud/browserslist-config": "^2.2.0",
"@nextcloud/eslint-config": "^6.1.2",
"@nextcloud/stylelint-config": "^2.1.2",
"@nextcloud/webpack-vue-config": "^4.3.2"
}
}
|
Thanks, I applied your advice and this here my package.json : {
"name": "workspace",
"version": "1.0.0",
"description": "Place this app in **nextcloud/apps/**",
"main": "main.js",
"private": true,
"scripts": {
"build": "webpack --node-env production --progress",
"dev": "webpack --node-env development --progress",
"watch": "webpack --node-env development --progress --watch",
"serve": "webpack --node-env development serve --progress",
"test": "NODE_ENV=testing mochapack --webpack-config webpack.test.config.js --require \"src/tests/OC.js\" \"src/tests/**/*.js\"",
"lint": "eslint --ext .js,.vue src",
"stylelint": "stylelint css/*.css css/*.scss src/**/*.vue",
"stylelint:fix": "stylelint css/*.css css/*.scss src/**/*.vue --fix"
},
"repository": {
"type": "git",
"url": "git+https://github.com/arawa/workspace.git"
},
"keywords": [],
"author": "Arawa <https://www.arawa.fr/>",
"contributors": [
{
"name": "Baptiste Fotia",
"email": "[email protected]"
},
{
"name": "Cyrille Bollu",
"email": "[email protected]"
}
],
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/arawa/workspace/issues"
},
"homepage": "https://github.com/arawa/workspace#readme",
"engines": {
"npm": "^7.0.0",
"node": "^14.0.0"
},
"browserslist": [
"extends @nextcloud/browserslist-config"
],
"Comments": {
"devDependencies": [
"The @nextcloud/eslint-config's version 7.0.2 triggers a problem when we run `npm install`.",
"We must define the `--force` flag to install these devDependencies.",
"But, when we run `npm test`, we have an error on the conflicts on the eslint package as peerDependency.",
"I created an issue on this : https://github.com/nextcloud/eslint-config/issues/294.",
"One solutions is downgraded theses packages :",
"- @nextcloud/[email protected]",
"- @nextcloud/[email protected]",
"Note: Look at this issue for webpack-vue-config package: https://github.com/nextcloud/nextcloud-vue/issues/2478"
]
},
"devDependencies": {
"@nextcloud/babel-config": "^1.0.0",
"@nextcloud/browserslist-config": "^2.2.0",
"@nextcloud/eslint-config": "^6.1.2",
"@nextcloud/stylelint-config": "^2.1.2",
"@nextcloud/webpack-vue-config": "^4.3.2",
"@vue/test-utils": "^1.3.0",
"chai": "^4.3.6",
"jsdom": "^19.0.0",
"jsdom-global": "^3.0.2",
"mochapack": "^2.1.4",
"prettier": "^2.5.1",
"webpack-node-externals": "^3.0.0"
},
"dependencies": {
"@nextcloud/axios": "^1.9.0",
"@nextcloud/l10n": "^1.4.1",
"@nextcloud/router": "^1.2.0",
"@nextcloud/vue": "^4.3.0",
"ramda": "^0.28.0",
"vue": "^2.6.12",
"vue-notification": "^1.3.20",
"vue-router": "^3.5.3",
"vuex": "^3.6.2"
},
"optionalDependencies": {
"fsevents": "^2.3.2"
}
} But, with your method dependabot will not update these packages, no ? Otherwise, I start to have this problem again. Is that right ? Good news, when I run
I am searching how to resolve it |
Yes, it will :) Using |
Hi @skjnldsv 🙂 I have taken your message nextcloud-libraries/eslint-config#294 (comment) into account. But, if I use npm test
> [email protected] test
> NODE_ENV=testing mochapack --webpack-config webpack.test.config.js --require src/tests/OC.js "src/tests/**/*.js"
Building workspace 1.0.0
[ ] 0% () WEBPACK Compiling...
[=== ] 10% (building)Download the Vue Devtools extension for a better development experience:
https://github.com/vuejs/vue-devtools
You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
[======================= ] 92% (sealing) WEBPACK Failed to compile with 2 error(s)
Error
The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/eslintrc.cjs'
Error
The URL must be of scheme file
[=========================] 100% (completed) |
Had a bit of look around, but this is definitely coming from the mochapack implementation. Nonetheless, if you remove the eslint and stylelint plugin, you get further const path = require('path')
const webpackConfig = require('@nextcloud/webpack-vue-config')
const nodeExternals = require('webpack-node-externals')
const appName = process.env.npm_package_name
require('jsdom-global')('', {
url: 'http://localhost',
})
webpackConfig.mode = 'development'
webpackConfig.devtool = 'inline-cheap-module-source-map'
webpackConfig.externals = [nodeExternals()]
// Overrides the output config provided by Nextcloud as for some reason
// contenthash doesn't get appended to filenames
webpackConfig.output = {
path: path.resolve('./js'),
publicPath: '/js/',
filename: `${appName}-[name].js`,
chunkFilename: `${appName}-[name].js`,
}
// Filter out Eslint and Stylelint plugins
webpackConfig.plugins = webpackConfig.plugins.filter(plugin =>
['ESLintWebpackPlugin', 'StylelintWebpackPlugin'].indexOf(plugin?.constructor?.name) === -1)
module.exports = webpackConfig |
Hmmm... May be the problem is Mochapck... I created this issue : sysgears/mochapack#127 If apply your proposed config and run $ npm run test
> [email protected] test
> NODE_ENV=testing mochapack --webpack-config webpack.test.config.js --require "src/tests/OC.js" "src/tests/**/*.js"
Building workspace 1.0.0
[ ] 0% () WEBPACK Compiling...
[=== ] 10% (building)Download the Vue Devtools extension for a better development experience:
https://github.com/vuejs/vue-devtools
You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
[======================= ] 92% (sealing) WEBPACK Compiled successfully in 4212ms
MOCHA Testing...
RUNTIME EXCEPTION Exception occurred while loading your tests
/home/zak/Documents/arawa/codes/workspace/node_modules/splitpanes/dist/splitpanes.css:1
.splitpanes{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;height:100%}.splitpanes--vertical{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.splitpanes--horizontal{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.splitpanes--dragging *{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.splitpanes__pane{width:100%;height:100%;overflow:hidden}.splitpanes--vertical .splitpanes__pane{-webkit-transition:width .2s ease-out;-o-transition:width .2s ease-out;transition:width .2s ease-out}.splitpanes--horizontal .splitpanes__pane{-webkit-transition:height .2s ease-out;-o-transition:height .2s ease-out;transition:height .2s ease-out}.splitpanes--dragging .splitpanes__pane{-webkit-transition:none;-o-transition:none;transition:none}.splitpanes__splitter{-ms-touch-action:none;touch-action:none}.splitpanes--vertical>.splitpanes__splitter{min-width:1px;cursor:col-resize}.splitpanes--horizontal>.splitpanes__splitter{min-height:1px;cursor:row-resize}.splitpanes.default-theme .splitpanes__pane{background-color:#f2f2f2}.splitpanes.default-theme .splitpanes__splitter{background-color:#fff;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;-ms-flex-negative:0;flex-shrink:0}.splitpanes.default-theme .splitpanes__splitter:before,.splitpanes.default-theme .splitpanes__splitter:after{content:"";position:absolute;top:50%;left:50%;background-color:#00000026;-webkit-transition:background-color .3s;-o-transition:background-color .3s;transition:background-color .3s}.splitpanes.default-theme .splitpanes__splitter:hover:before,.splitpanes.default-theme .splitpanes__splitter:hover:after{background-color:#00000040}.splitpanes.default-theme .splitpanes__splitter:first-child{cursor:auto}.default-theme.splitpanes .splitpanes .splitpanes__splitter{z-index:1}.default-theme.splitpanes--vertical>.splitpanes__splitter,.default-theme .splitpanes--vertical>.splitpanes__splitter{width:7px;border-left:1px solid #eee;margin-left:-1px}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:1px;height:30px}.default-theme.splitpanes--vertical>.splitpanes__splitter:before,.default-theme .splitpanes--vertical>.splitpanes__splitter:before{margin-left:-2px}.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:after{margin-left:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter,.default-theme .splitpanes--horizontal>.splitpanes__splitter{height:7px;border-top:1px solid #eee;margin-top:-1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translate(-50%);width:30px;height:1px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:before,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before{margin-top:-2px}.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:after{margin-top:1px}
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Object.module_1.default._extensions.<computed> [as .js] (/home/zak/Documents/arawa/codes/workspace/node_modules/mochapack/src/util/registerRequireHook.ts:99:53)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at Object.call (/home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/webpack:/NextcloudVue.[name]/external "splitpanes/dist/splitpanes.css":1:18)
at n (/home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/webpack:/NextcloudVue.[name]/webpack/bootstrap:19:22)
at Module.call (/home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/AppContent.js:1:15021)
at __webpack_require__ (/home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/webpack:/NextcloudVue.[name]/webpack/bootstrap:19:22)
at 0 (/home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/webpack:/NextcloudVue.[name]/webpack/bootstrap:83:10)
at factory (/home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/AppContent.js:1:1253)
at /home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/webpack:/NextcloudVue.[name]/webpack/universalModuleDefinition:3:20
at Object.<anonymous> (/home/zak/Documents/arawa/codes/workspace/node_modules/@nextcloud/vue/dist/Components/webpack:/NextcloudVue.[name]/webpack/universalModuleDefinition:1:1)
[=========================] 100% (completed) But, I found an interesting lead ! /**
* @copyright Copyright (c) 2017 Arawa
*
* @author 2021 Baptiste Fotia <[email protected]>
* @author 2021 Cyrille Bollu <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* 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/>.
*
*/
const path = require('path')
const { merge } = require('webpack-merge')
const webpackConfig = require('@nextcloud/webpack-vue-config')
const nodeExternals = require('webpack-node-externals')
// require('jsdom-global')('', {url: 'http://localhost'})
const appName = process.env.npm_package_name
const config = merge(webpackConfig, {
mode: 'development',
devtool: 'inline-cheap-module-source-map',
externals: [nodeExternals()],
// Overrides the output config provided by Nextcloud as for some reason
// contenthash doesn't get appended to filenames
output: {
path: path.resolve('./js'),
publicPath: '/js/',
filename: `${appName}-[name].js`,
chunkFilename: `${appName}-[name].js`,
},
})
module.exports = config And if I run $ npm run test
> workspace@1.0.0 test
> NODE_ENV=testing mochapack --webpack-config webpack.test.config.js --require "src/tests/OC.js" "src/tests/**/*.js"
Building workspace 1.0.0
[ ] 0% () WEBPACK Compiling...
[======================= ] 92% (sealing) WEBPACK Compiled successfully in 10033ms
MOCHA Testing...
RUNTIME EXCEPTION Exception occurred while loading your tests
ReferenceError: document is not defined
at /home/zak/Documents/arawa/codes/workspace/js/workspace-main.js:2:153697
at Object.<anonymous> (/home/zak/Documents/arawa/codes/workspace/js/workspace-main.js:2:153943)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.module_1.default._extensions.<computed> [as .js] (/home/zak/Documents/arawa/codes/workspace/node_modules/mochapack/src/util/registerRequireHook.ts:106:12)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:101:18)
at /home/zak/Documents/arawa/codes/workspace/node_modules/mocha/lib/mocha.js:427:36
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/home/zak/Documents/arawa/codes/workspace/node_modules/mocha/lib/mocha.js:424:14)
at Mocha.run (/home/zak/Documents/arawa/codes/workspace/node_modules/mocha/lib/mocha.js:1025:10)
at /home/zak/Documents/arawa/codes/workspace/node_modules/mochapack/src/runner/TestRunner.ts:128:23
at /home/zak/Documents/arawa/codes/workspace/node_modules/mochapack/src/webpack/compiler/registerReadyCallback.ts:15:7
at Hook.eval [as callAsync] (eval at create (/home/zak/Documents/arawa/codes/workspace/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:26:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/zak/Documents/arawa/codes/workspace/node_modules/tapable/lib/Hook.js:18:14)
[=========================] 100% (completed) Another point ! I created this script in If I run |
I migrated the Mocha lib to Jest lib following the @skjnlds's comment #413 (comment)
Hello @skjnldsv 🙂 I migrated the mocha lib to Jest. The CI works, but I have some mistakes that don't break the CI ^^' What do you think ? 🙂 |
webpack.test.config.js
Outdated
@@ -20,20 +20,23 @@ | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
* | |||
*/ | |||
/* eslint-disable node/no-extraneous-require */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need that webpack config file? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... No, you're right :)
I deleted this file :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one comment :)
You also seems to have a few code styling issues, but nothing dramatic.
You can most likely fix them in a followup (some comments alignments issues and some disappearing @
from the copyright headers 😉
Hmmm... I don't know if I have a few code styling issues only. But, I have the impression that I have issues with functions and should I create mocks ? For example : console.error
[Vue warn]: Unknown custom element: <notifications> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <Home>
<Root>
console.error
The error is : Error: Request failed with status code 405
95 | // add this group in groupfolders
96 | addGroup(space.groupfolderId, resp.data.group.gid)
> 97 | .then(res => {
| ^
98 | if (res.success === false) {
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
100 | .then(resp => {
at src/store/actions.js:97:15
console.error
e.message Request failed with status code 405
96 | addGroup(space.groupfolderId, resp.data.group.gid)
97 | .then(res => {
> 98 | if (res.success === false) {
| ^
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
100 | .then(resp => {
101 | // eslint-disable-next-line no-console
at src/store/actions.js:98:15
console.error
e.name Error
97 | .then(res => {
98 | if (res.success === false) {
> 99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
| ^
100 | .then(resp => {
101 | // eslint-disable-next-line no-console
102 | console.log(`The ${gid} group is deleted`, resp)
at src/store/actions.js:99:15
console.error
e.lineNumber undefined
98 | if (res.success === false) {
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
> 100 | .then(resp => {
| ^
101 | // eslint-disable-next-line no-console
102 | console.log(`The ${gid} group is deleted`, resp)
103 | context.commit('removeGroupFromSpace', { name, gid })
at src/store/actions.js:100:15
console.error
e.columnNumber undefined
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
100 | .then(resp => {
> 101 | // eslint-disable-next-line no-console
| ^
102 | console.log(`The ${gid} group is deleted`, resp)
103 | context.commit('removeGroupFromSpace', { name, gid })
104 | this._vm.$notify({
at src/store/actions.js:101:15
console.error
e.stack Error: Request failed with status code 405
at createError (/home/zak/Documents/arawa/codes/workspace/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/zak/Documents/arawa/codes/workspace/node_modules/axios/lib/core/settle.js:17:12)
at XMLHttpRequest.onloadend (/home/zak/Documents/arawa/codes/workspace/node_modules/axios/lib/adapters/xhr.js:66:7)
at XMLHttpRequest.invokeTheCallbackFunction (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventHandlerNonNull.js:18:28)
at XMLHttpRequest.<anonymous> (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js:35:32)
at innerInvokeEventListeners (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:338:25)
at invokeEventListeners (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
at XMLHttpRequestImpl._dispatch (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
at fireAnEvent (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/events.js:18:36)
at Request.<anonymous> (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:891:5)
at Request.emit (events.js:412:35)
at IncomingMessage.<anonymous> (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:230:42)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
100 | .then(resp => {
101 | // eslint-disable-next-line no-console
> 102 | console.log(`The ${gid} group is deleted`, resp)
| ^
103 | context.commit('removeGroupFromSpace', { name, gid })
104 | this._vm.$notify({
105 | title: t('workspace', 'Error'),
console.error
The error is : Error: Request failed with status code 405
95 | // add this group in groupfolders
96 | addGroup(space.groupfolderId, resp.data.group.gid)
> 97 | .then(res => {
| ^
98 | if (res.success === false) {
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
100 | .then(resp => {
at src/store/actions.js:97:15
console.error
e.message Request failed with status code 405
96 | addGroup(space.groupfolderId, resp.data.group.gid)
97 | .then(res => {
> 98 | if (res.success === false) {
| ^
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
100 | .then(resp => {
101 | // eslint-disable-next-line no-console
at src/store/actions.js:98:15
console.error
e.name Error
97 | .then(res => {
98 | if (res.success === false) {
> 99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
| ^
100 | .then(resp => {
101 | // eslint-disable-next-line no-console
102 | console.log(`The ${gid} group is deleted`, resp)
at src/store/actions.js:99:15
console.error
e.lineNumber undefined
98 | if (res.success === false) {
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
> 100 | .then(resp => {
| ^
101 | // eslint-disable-next-line no-console
102 | console.log(`The ${gid} group is deleted`, resp)
103 | context.commit('removeGroupFromSpace', { name, gid })
at src/store/actions.js:100:15
console.error
e.columnNumber undefined
99 | axios.delete(generateUrl(`/apps/workspace/api/group/${gid}`), { data: { spaceId: space.id } })
100 | .then(resp => {
> 101 | // eslint-disable-next-line no-console
| ^
102 | console.log(`The ${gid} group is deleted`, resp)
103 | context.commit('removeGroupFromSpace', { name, gid })
104 | this._vm.$notify({
at src/store/actions.js:101:15
console.error
e.stack Error: Request failed with status code 405
at createError (/home/zak/Documents/arawa/codes/workspace/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/zak/Documents/arawa/codes/workspace/node_modules/axios/lib/core/settle.js:17:12)
at XMLHttpRequest.onloadend (/home/zak/Documents/arawa/codes/workspace/node_modules/axios/lib/adapters/xhr.js:66:7)
at XMLHttpRequest.invokeTheCallbackFunction (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventHandlerNonNull.js:18:28)
at XMLHttpRequest.<anonymous> (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/create-event-accessor.js:35:32)
at innerInvokeEventListeners (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:338:25)
at invokeEventListeners (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
at XMLHttpRequestImpl._dispatch (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
at fireAnEvent (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/events.js:18:36)
at Request.<anonymous> (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:891:5)
at Request.emit (events.js:412:35)
at IncomingMessage.<anonymous> (/home/zak/Documents/arawa/codes/workspace/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/http-request.js:230:42)
at Object.onceWrapper (events.js:519:28)
at IncomingMessage.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
100 | .then(resp => {
101 | // eslint-disable-next-line no-console
> 102 | console.log(`The ${gid} group is deleted`, resp)
| ^
103 | context.commit('removeGroupFromSpace', { name, gid })
104 | this._vm.$notify({
105 | title: t('workspace', 'Error'), It's very important to fix them ? Or it's very complicated ? |
I don't need this config file, I use jest now #413 (comment)
I have no idea :/ |
Okay, no problem :) I am searching where these issues another 30min. Otherwise, can I accept this PR if it's okay for you ? :) |
Good from me :) |
Yes I know x) Thanks for your response :) |
I copied your PR @skjnldsv because I got this error message :