Skip to content

Commit

Permalink
Fix issues identified by ESLint #1014 (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaifroid authored Jun 14, 2023
1 parent bd7393e commit 9ecb502
Show file tree
Hide file tree
Showing 18 changed files with 1,666 additions and 1,616 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = {
'no-unused-vars': 1,
'n/no-callback-literal': 0,
'object-shorthand': 0,
'multiline-ternary': 0
'multiline-ternary': 0,
'no-extend-native': 0,
'no-global-assign': 0
}
}
194 changes: 99 additions & 95 deletions nightwatch.js
Original file line number Diff line number Diff line change
@@ -1,119 +1,123 @@
/**
* nightwatch.js : Configuration of nightwatch.
* Global settings of NightWatch.
*
*
* Copyright 2017 Mossroy and contributors
* License GPL v3:
*
*
* This file is part of Kiwix.
*
*
* Kiwix is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* Kiwix 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 General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with Kiwix (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
*/

'use strict';

/* eslint-disable no-template-curly-in-string */

const build = `${process.env.GITHUB_REPOSITORY} run #${process.env.GITHUB_RUN_ID}`;

module.exports = {
"src_folders" : ["browser-tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
src_folders: ['browser-tests'],
output_folder: 'reports',
custom_commands_path: '',
custom_assertions_path: '',
page_objects_path: '',
globals_path: '',

"test_settings" : {
"default" : {
"launch_url": "http://ondemand.saucelabs.com:80",
"selenium_port": 80,
"selenium_host": "ondemand.saucelabs.com",
"silent": true,
"username": "${SAUCE_USERNAME}",
"access_key": "${SAUCE_ACCESS_KEY}",
"screenshots" : {
"enabled" : false
},
"globals": {
"waitForConditionTimeout": 600
}
},
"firefox52" : {
"desiredCapabilities": {
"browserName": "firefox",
"version": "52.0",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
},
"firefox" : {
"desiredCapabilities": {
"browserName": "firefox",
"version": "latest",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
},
"chrome58" : {
"desiredCapabilities": {
"browserName": "chrome",
"version": "58.0",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
},
"edge" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
},
"edge40" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge",
"version": "15.15063",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
},
"edge44" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge",
"version": "18.17763",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
},
"ie11" : {
"desiredCapabilities": {
"browserName": "internet explorer",
"javascriptEnabled": true,
"acceptSslCerts": true,
"build": build
}
test_settings: {
default: {
launch_url: 'http://ondemand.saucelabs.com:80',
selenium_port: 80,
selenium_host: 'ondemand.saucelabs.com',
silent: true,
username: '${SAUCE_USERNAME}',
access_key: '${SAUCE_ACCESS_KEY}',
screenshots: {
enabled: false
},
globals: {
waitForConditionTimeout: 600
}
},
firefox52: {
desiredCapabilities: {
browserName: 'firefox',
version: '52.0',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
version: 'latest',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
},
chrome58: {
desiredCapabilities: {
browserName: 'chrome',
version: '58.0',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
},
edge: {
desiredCapabilities: {
browserName: 'MicrosoftEdge',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
},
edge40: {
desiredCapabilities: {
browserName: 'MicrosoftEdge',
version: '15.15063',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
},
edge44: {
desiredCapabilities: {
browserName: 'MicrosoftEdge',
version: '18.17763',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
},
ie11: {
desiredCapabilities: {
browserName: 'internet explorer',
javascriptEnabled: true,
acceptSslCerts: true,
build: build
}
}
}
}
};
19 changes: 11 additions & 8 deletions tests/init.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
/**
* init.js : Configuration for the library require.js
* This file handles the dependencies between javascript libraries, for the unit tests
*
*
* Copyright 2013-2014 Mossroy and contributors
* License GPL v3:
*
*
* This file is part of Kiwix.
*
*
* Kiwix is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* Kiwix 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 General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with Kiwix (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
*/

'use strict';

/* global requirejs */

// Define global params needed for tests to run on existing app code
var params = {};
var webpMachine = true;

require.config({
baseUrl: (window.__karma__ ? 'base/' : '') + 'www/js/lib/',
paths: {
'jquery': 'jquery-3.7.0.slim.min',
'webpHeroBundle': 'webpHeroBundle_0.0.2'
jquery: 'jquery-3.7.0.slim.min',
webpHeroBundle: 'webpHeroBundle_0.0.2'
},
shim: {
'webpHeroBundle': ''
webpHeroBundle: ''
}
});

Expand Down
68 changes: 34 additions & 34 deletions tests/karma.conf.local.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
module.exports = function (config) {
config.set({
basePath: '../',
// https://karma-runner.github.io/5.2/config/browsers.html
browsers: [
'FirefoxHeadless',
// During local development, consider Chrome and Chromium to be similar enough
// and pick whichever the developer is most likely to have.
// In general, Linux distros provide and update Chromium only,
// whereas Windows and macOS users tend to have auto-updating Google Chrome.
//
// See package.json for commands to run tests in a single browser only.
//
// The CHROME_BIN check is to temporarily accomodate GitHub Actions
// which oddly uses Ubuntu but replaces the standard Chromium distribution
// with a custom install of Google Chrome. Being fixed in the next release:
// https://github.com/actions/virtual-environments/issues/2388
process.platform === 'linux' && !process.env.CHROME_BIN ? 'ChromiumHeadless' : 'ChromeHeadless'
],
frameworks: ['qunit'],
client: {
qunit: {
autostart: false
}
},
// logLevel: 'DEBUG',
files: [
'www/js/lib/require.js',
'tests/init.js',
{ pattern: 'www/**/*', included: false },
{ pattern: 'tests/**/*', included: false }
],
singleRun: true,
autoWatch: false
});
config.set({
basePath: '../',
// https://karma-runner.github.io/5.2/config/browsers.html
browsers: [
'FirefoxHeadless',
// During local development, consider Chrome and Chromium to be similar enough
// and pick whichever the developer is most likely to have.
// In general, Linux distros provide and update Chromium only,
// whereas Windows and macOS users tend to have auto-updating Google Chrome.
//
// See package.json for commands to run tests in a single browser only.
//
// The CHROME_BIN check is to temporarily accomodate GitHub Actions
// which oddly uses Ubuntu but replaces the standard Chromium distribution
// with a custom install of Google Chrome. Being fixed in the next release:
// https://github.com/actions/virtual-environments/issues/2388
process.platform === 'linux' && !process.env.CHROME_BIN ? 'ChromiumHeadless' : 'ChromeHeadless'
],
frameworks: ['qunit'],
client: {
qunit: {
autostart: false
}
},
// logLevel: 'DEBUG',
files: [
'www/js/lib/require.js',
'tests/init.js',
{ pattern: 'www/**/*', included: false },
{ pattern: 'tests/**/*', included: false }
],
singleRun: true,
autoWatch: false
});
};
Loading

0 comments on commit 9ecb502

Please sign in to comment.