From a883d237ee6992d719072f2e889a6d5fc47a9053 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Wed, 26 Apr 2023 12:12:56 -0700 Subject: [PATCH 01/22] test: replace Karma with Webdriver.IO The current test framework for browser testing (Karma) is not maintained anymore and WebdriverIO provides a more modern stack that allows to test in different browser. This patch replaces these test frameworks. fixes: #17009 --- .github/workflows/ci.yml | 2 +- .gitignore | 1 + Makefile.js | 8 +- karma.conf.js | 125 ------------ lib/config/rule-validator.js | 3 +- lib/linter/rules.js | 2 +- package.json | 17 +- tests/lib/linter/linter.js | 12 +- wdio.conf.js | 380 +++++++++++++++++++++++++++++++++++ 9 files changed, 408 insertions(+), 142 deletions(-) delete mode 100644 karma.conf.js create mode 100644 wdio.conf.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27dae4c1262..b545845f318 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,6 @@ jobs: - name: Install Packages run: npm install - name: Test - run: node Makefile karma + run: node Makefile wdio - name: Fuzz Test run: node Makefile fuzz diff --git a/.gitignore b/.gitignore index 075a4d740c7..12d141ab546 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ test.js coverage/ build/ +logs npm-debug.log yarn-error.log .pnpm-debug.log diff --git a/Makefile.js b/Makefile.js index 717cc785946..a293d2f498b 100644 --- a/Makefile.js +++ b/Makefile.js @@ -628,12 +628,10 @@ target.mocha = () => { } }; -target.karma = () => { +target.wdio = () => { echo("Running unit tests on browsers"); - target.webpack("production"); - - const lastReturn = exec(`${getBinFile("karma")} start karma.conf.js`); + const lastReturn = exec(`${getBinFile("wdio")} run wdio.conf.js`); if (lastReturn.code !== 0) { exit(1); @@ -643,7 +641,7 @@ target.karma = () => { target.test = function() { target.checkRuleFiles(); target.mocha(); - target.karma(); + target.wdio(); target.fuzz({ amount: 150, fuzzBrokenAutofixes: false }); target.checkLicenses(); }; diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index 606d13f88f6..00000000000 --- a/karma.conf.js +++ /dev/null @@ -1,125 +0,0 @@ -"use strict"; -const os = require("os"); -const NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); - -if (os.platform === "linux" && os.arch() === "arm64") { - - // For arm64 architecture, install chromium-browser using "apt-get install chromium-browser" - process.env.CHROME_BIN = "/usr/bin/chromium-browser"; -} else { - process.env.CHROME_BIN = require("puppeteer").executablePath(); -} - -module.exports = function(config) { - config.set({ - - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: "", - - // next three sections allow console.log to work - client: { - captureConsole: true - }, - - browserConsoleLogOptions: { - terminal: true, - level: "log" - }, - - /* - * frameworks to use - * available frameworks: https://npmjs.org/browse/keyword/karma-adapter - */ - frameworks: ["mocha", "webpack"], - - - // list of files / patterns to load in the browser - files: [ - "tests/lib/linter/linter.js" - ], - - - // list of files to exclude - exclude: [ - ], - - - /* - * preprocess matching files before serving them to the browser - * available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - */ - preprocessors: { - "tests/lib/linter/linter.js": ["webpack"] - }, - webpack: { - mode: "none", - plugins: [ - new NodePolyfillPlugin() - ], - resolve: { - alias: { - "../../../lib/linter$": "../../../build/eslint.js" - } - }, - stats: "errors-only" - }, - webpackMiddleware: { - logLevel: "error" - }, - - - /* - * test results reporter to use - * possible values: "dots", "progress" - * available reporters: https://npmjs.org/browse/keyword/karma-reporter - */ - reporters: ["mocha"], - - mochaReporter: { - output: "minimal" - }, - - // web server port - port: 9876, - - - // enable / disable colors in the output (reporters and logs) - colors: true, - - - /* - * level of logging - * possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - */ - logLevel: config.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, - - - /* - * start these browsers - * available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - */ - browsers: ["HeadlessChrome"], - customLaunchers: { - HeadlessChrome: { - base: "ChromeHeadless", - flags: ["--no-sandbox"] - } - }, - - /* - * Continuous Integration mode - * if true, Karma captures browsers, runs the tests and exits - */ - singleRun: true, - - /* - * Concurrency level - * how many browser should be started simultaneous - */ - concurrency: Infinity - }); -}; diff --git a/lib/config/rule-validator.js b/lib/config/rule-validator.js index 0b5858fb30f..eee5b40bd07 100644 --- a/lib/config/rule-validator.js +++ b/lib/config/rule-validator.js @@ -9,7 +9,8 @@ // Requirements //----------------------------------------------------------------------------- -const ajv = require("../shared/ajv")(); +const ajvImport = require("../shared/ajv"); +const ajv = ajvImport(); const { parseRuleId, getRuleFromConfig, diff --git a/lib/linter/rules.js b/lib/linter/rules.js index 647bab68784..a9faeef041f 100644 --- a/lib/linter/rules.js +++ b/lib/linter/rules.js @@ -56,7 +56,7 @@ class Rules { */ get(ruleId) { if (typeof this._rules[ruleId] === "string") { - this.define(ruleId, require(this._rules[ruleId])); + this.define(ruleId, require(`../rules/${this._rules[ruleId]}`)); } if (this._rules[ruleId]) { return this._rules[ruleId]; diff --git a/package.json b/package.json index 661e8fcaf4d..a991f20b380 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "test": "node Makefile.js test", "test:cli": "mocha", "test:fuzz": "node Makefile.js fuzz", - "test:performance": "node Makefile.js perf" + "test:performance": "node Makefile.js perf", + "wdio": "wdio run ./wdio.conf.js" }, "gitHooks": { "pre-commit": "lint-staged" @@ -101,10 +102,15 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", + "@wdio/browser-runner": "^8.8.7", + "@wdio/cli": "^8.8.7", + "@wdio/concise-reporter": "^8.8.7", + "@wdio/mocha-framework": "^8.8.7", "babel-loader": "^8.0.5", "c8": "^7.12.0", "chai": "^4.0.1", "cheerio": "^0.22.0", + "chromedriver": "^112.0.0", "common-tags": "^1.8.0", "core-js": "^3.1.3", "ejs": "^3.0.2", @@ -124,11 +130,6 @@ "glob": "^7.1.6", "got": "^11.8.3", "gray-matter": "^4.0.3", - "karma": "^6.1.1", - "karma-chrome-launcher": "^3.1.0", - "karma-mocha": "^2.0.1", - "karma-mocha-reporter": "^2.2.5", - "karma-webpack": "^5.0.0", "lint-staged": "^11.0.0", "load-perf": "^0.2.0", "markdownlint": "^0.25.1", @@ -151,9 +152,13 @@ "puppeteer": "^13.7.0", "recast": "^0.20.4", "regenerator-runtime": "^0.13.2", + "rollup-plugin-node-polyfills": "^0.2.1", "semver": "^7.5.3", "shelljs": "^0.8.2", "sinon": "^11.0.0", + "vite-plugin-commonjs": "^0.6.2", + "vite-plugin-dynamic-import": "^1.2.7", + "wdio-chromedriver-service": "^8.1.1", "webpack": "^5.23.0", "webpack-cli": "^4.5.0", "yorkie": "^2.0.0" diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index f86e98ba8e0..3943651a432 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -9,7 +9,7 @@ // Requirements //------------------------------------------------------------------------------ -const assert = require("chai").assert, +const { assert } = require("chai"), sinon = require("sinon"), espree = require("espree"), esprima = require("esprima"), @@ -7261,7 +7261,10 @@ var a = "test2"; const errorPrefix = "Parsing error: "; - it("should have file path passed to it", () => { + /** + * fails due to "ES Modules cannot be spied" + */ + it.skip("should have file path passed to it", () => { const code = "/* this is code */"; const parseSpy = sinon.spy(testParsers.stubParser, "parse"); @@ -8066,7 +8069,10 @@ describe("Linter with FlatConfigArray", () => { const errorPrefix = "Parsing error: "; - it("should have file path passed to it", () => { + /** + * fails due to: "ES Modules cannot be spied" + */ + it.skip("should have file path passed to it", () => { const code = "/* this is code */"; const parseSpy = sinon.spy(testParsers.stubParser, "parse"); const config = { diff --git a/wdio.conf.js b/wdio.conf.js new file mode 100644 index 00000000000..d5f217b6d36 --- /dev/null +++ b/wdio.conf.js @@ -0,0 +1,380 @@ +"use strict"; + +const commonjs = require("vite-plugin-commonjs"); +const dynamicImport = require("vite-plugin-dynamic-import"); + +exports.config = { + + /* + * + * ==================== + * Runner Configuration + * ==================== + * WebdriverIO supports running e2e tests as well as unit and component tests. + */ + runner: ["browser", { + viteConfig: { + resolve: { + alias: { + util: "rollup-plugin-node-polyfills/polyfills/util", + path: "rollup-plugin-node-polyfills/polyfills/path", + assert: "rollup-plugin-node-polyfills/polyfills/assert" + } + }, + plugins: [ + commonjs(), + dynamicImport.default() + ] + } + }], + + /* + * + * ================== + * Specify Test Files + * ================== + * Define which test specs should run. The pattern is relative to the directory + * of the configuration file being run. + * + * The specs are defined as an array of spec files (optionally using wildcards + * that will be expanded). The test for each spec file will be run in a separate + * worker process. In order to have a group of spec files run in the same worker + * process simply enclose them in an array within the specs array. + * + * If you are calling `wdio` from an NPM script (see https://docs.npmjs.com/cli/run-script), + * then the current working directory is where your `package.json` resides, so `wdio` + * will be called from there. + * + */ + specs: [ + "tests/lib/linter/linter.js" + ], + + // Patterns to exclude. + exclude: [], + + /* + * + * ============ + * Capabilities + * ============ + * Define your capabilities here. WebdriverIO can run multiple capabilities at the same + * time. Depending on the number of capabilities, WebdriverIO launches several test + * sessions. Within your capabilities you can overwrite the spec and exclude options in + * order to group specific specs to a specific capability. + * + * First, you can define how many instances should be started at the same time. Let's + * say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have + * set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec + * files and you set maxInstances to 10, all spec files will get tested at the same time + * and 30 processes will get spawned. The property handles how many capabilities + * from the same test should run tests. + * + */ + maxInstances: 10, + + /* + * + * If you have trouble getting all important capabilities together, check out the + * Sauce Labs platform configurator - a great tool to configure your capabilities: + * https://saucelabs.com/platform/platform-configurator + * + */ + capabilities: [{ + browserName: "chrome", + "goog:chromeOptions": { + args: process.env.CI ? ["headless", "disable-gpu"] : [] + } + }], + + /* + * + * =================== + * Test Configurations + * =================== + * Define all options that are relevant for the WebdriverIO instance here + * + * Level of logging verbosity: trace | debug | info | warn | error | silent + */ + logLevel: "info", + outputDir: "./logs", + + /* + * + * Set specific log levels per logger + * loggers: + * - webdriver, webdriverio + * - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service + * - @wdio/mocha-framework, @wdio/jasmine-framework + * - @wdio/local-runner + * - @wdio/sumologic-reporter + * - @wdio/cli, @wdio/config, @wdio/utils + * Level of logging verbosity: trace | debug | info | warn | error | silent + * logLevels: { + * webdriver: 'info', + * '@wdio/appium-service': 'info' + * }, + * + * If you only want to run your tests until a specific amount of tests have failed use + * bail (default is 0 - don't bail, run all tests). + */ + bail: 0, + + /* + * + * Set a base URL in order to shorten url command calls. If your `url` parameter starts + * with `/`, the base url gets prepended, not including the path portion of your baseUrl. + * If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url + * gets prepended directly. + */ + baseUrl: "", + + /* + * + * Default timeout for all waitFor* commands. + */ + waitforTimeout: 10000, + + /* + * + * Default timeout in milliseconds for request + * if browser driver or grid doesn't send response + */ + connectionRetryTimeout: 120000, + + /* + * + * Default request retries count + */ + connectionRetryCount: 3, + + /* + * + * Test runner services + * Services take over a specific job you don't want to take care of. They enhance + * your test setup with almost no effort. Unlike plugins, they don't add new + * commands. Instead, they hook themselves up into the test process. + */ + services: ["chromedriver"], + + /* + * Framework you want to run your specs with. + * The following are supported: Mocha, Jasmine, and Cucumber + * see also: https://webdriver.io/docs/frameworks + * + * Make sure you have the wdio adapter package for the specific framework installed + * before running any tests. + */ + framework: "mocha", + + /* + * + * The number of times to retry the entire specfile when it fails as a whole + * specFileRetries: 1, + * + * Delay in seconds between the spec file retry attempts + * specFileRetriesDelay: 0, + * + * Whether or not retried specfiles should be retried immediately or deferred to the end of the queue + * specFileRetriesDeferred: false, + * + * Test reporter for stdout. + * The only one supported by default is 'dot' + * see also: https://webdriver.io/docs/dot-reporter + */ + reporters: ["concise"], + + /* + * + * Options to be passed to Mocha. + * See the full list at http://mochajs.org/ + */ + mochaOpts: { + ui: "bdd", + timeout: 60000 + } + + /* + * + * ===== + * Hooks + * ===== + * WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance + * it and to build services around it. You can either apply a single function or an array of + * methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got + * resolved to continue. + */ + /** + * Gets executed once before all workers get launched. + * @param {Object} config wdio configuration object + * @param {Array} capabilities list of capabilities details + */ + /* + * onPrepare: function (config, capabilities) { + * }, + */ + /** + * Gets executed before a worker process is spawned and can be used to initialise specific service + * for that worker as well as modify runtime environments in an async fashion. + * @param {string} cid capability id (e.g 0-0) + * @param {Object} caps object containing capabilities for session that will be spawn in the worker + * @param {Object} specs specs to be run in the worker process + * @param {Object} args object that will be merged with the main configuration once worker is initialized + * @param {Object} execArgv list of string arguments passed to the worker process + */ + /* + * onWorkerStart: function (cid, caps, specs, args, execArgv) { + * }, + */ + /** + * Gets executed just after a worker process has exited. + * @param {string} cid capability id (e.g 0-0) + * @param {number} exitCode 0 - success, 1 - fail + * @param {Object} specs specs to be run in the worker process + * @param {number} retries number of retries used + */ + /* + * onWorkerEnd: function (cid, exitCode, specs, retries) { + * }, + */ + /** + * Gets executed just before initialising the webdriver session and test framework. It allows you + * to manipulate configurations depending on the capability or spec. + * @param {Object} config wdio configuration object + * @param {Array} capabilities list of capabilities details + * @param {Array} specs List of spec file paths that are to be run + * @param {string} cid worker id (e.g. 0-0) + */ + /* + * beforeSession: function (config, capabilities, specs, cid) { + * }, + */ + /** + * Gets executed before test execution begins. At this point you can access to all global + * variables like `browser`. It is the perfect place to define custom commands. + * @param {Array} capabilities list of capabilities details + * @param {Array} specs List of spec file paths that are to be run + * @param {Object} browser instance of created browser/device session + */ + /* + * before: function (capabilities, specs) { + * }, + */ + /** + * Runs before a WebdriverIO command gets executed. + * @param {string} commandName hook command name + * @param {Array} args arguments that command would receive + */ + /* + * beforeCommand: function (commandName, args) { + * }, + */ + /** + * Hook that gets executed before the suite starts + * @param {Object} suite suite details + */ + /* + * beforeSuite: function (suite) { + * }, + */ + /** + * Function to be executed before a test (in Mocha/Jasmine) starts. + */ + /* + * beforeTest: function (test, context) { + * }, + */ + /** + * Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling + * beforeEach in Mocha) + */ + /* + * beforeHook: function (test, context) { + * }, + */ + /** + * Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling + * afterEach in Mocha) + */ + /* + * afterHook: function (test, context, { error, result, duration, passed, retries }) { + * }, + */ + /** + * Function to be executed after a test (in Mocha/Jasmine only) + * @param {Object} test test object + * @param {Object} context scope object the test was executed with + * @param {Error} result.error error object in case the test fails, otherwise `undefined` + * @param {any} result.result return object of test function + * @param {number} result.duration duration of test + * @param {boolean} result.passed true if test has passed, otherwise false + * @param {Object} result.retries informations to spec related retries, e.g. `{ attempts: 0, limit: 0 }` + */ + /* + * afterTest: function(test, context, { error, result, duration, passed, retries }) { + * }, + */ + + + /** + * Hook that gets executed after the suite has ended + * @param {Object} suite suite details + */ + /* + * afterSuite: function (suite) { + * }, + */ + /** + * Runs after a WebdriverIO command gets executed + * @param {string} commandName hook command name + * @param {Array} args arguments that command would receive + * @param {number} result 0 - command success, 1 - command error + * @param {Object} error error object if any + */ + /* + * afterCommand: function (commandName, args, result, error) { + * }, + */ + /** + * Gets executed after all tests are done. You still have access to all global variables from + * the test. + * @param {number} result 0 - test pass, 1 - test fail + * @param {Array} capabilities list of capabilities details + * @param {Array} specs List of spec file paths that ran + */ + /* + * after: function (result, capabilities, specs) { + * }, + */ + /** + * Gets executed right after terminating the webdriver session. + * @param {Object} config wdio configuration object + * @param {Array} capabilities list of capabilities details + * @param {Array} specs List of spec file paths that ran + */ + /* + * afterSession: function (config, capabilities, specs) { + * }, + */ + /** + * Gets executed after all workers got shut down and the process is about to exit. An error + * thrown in the onComplete hook will result in the test run failing. + * @param {Object} exitCode 0 - success, 1 - fail + * @param {Object} config wdio configuration object + * @param {Array} capabilities list of capabilities details + * @param {Object} results object containing test results + */ + /* + * onComplete: function(exitCode, config, capabilities, results) { + * }, + */ + /** + * Gets executed when a refresh happens. + * @param {string} oldSessionId session ID of the old session + * @param {string} newSessionId session ID of the new session + */ + /* + * onReload: function(oldSessionId, newSessionId) { + * } + */ +}; From 90688abf08744783425949b81c8de7973b27411c Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 19 May 2023 09:16:26 -0700 Subject: [PATCH 02/22] update webdriverio deps --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a991f20b380..feb9defbd4e 100644 --- a/package.json +++ b/package.json @@ -102,10 +102,10 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "@wdio/browser-runner": "^8.8.7", - "@wdio/cli": "^8.8.7", - "@wdio/concise-reporter": "^8.8.7", - "@wdio/mocha-framework": "^8.8.7", + "@wdio/browser-runner": "^8.10.2", + "@wdio/cli": "^8.10.2", + "@wdio/concise-reporter": "^8.10.2", + "@wdio/mocha-framework": "^8.10.2", "babel-loader": "^8.0.5", "c8": "^7.12.0", "chai": "^4.0.1", @@ -149,7 +149,6 @@ "pirates": "^4.0.5", "progress": "^2.0.3", "proxyquire": "^2.0.1", - "puppeteer": "^13.7.0", "recast": "^0.20.4", "regenerator-runtime": "^0.13.2", "rollup-plugin-node-polyfills": "^0.2.1", @@ -159,6 +158,7 @@ "vite-plugin-commonjs": "^0.6.2", "vite-plugin-dynamic-import": "^1.2.7", "wdio-chromedriver-service": "^8.1.1", + "webdriverio": "^8.10.2", "webpack": "^5.23.0", "webpack-cli": "^4.5.0", "yorkie": "^2.0.0" From 30b6db164c9764d2f2c38f6112cc9d917d725783 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 19 May 2023 12:02:31 -0700 Subject: [PATCH 03/22] PR feedback --- lib/linter/rules.js | 2 +- package.json | 11 +++++------ tests/lib/linter/linter.js | 4 +++- wdio.conf.js | 6 +----- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/linter/rules.js b/lib/linter/rules.js index a9faeef041f..647bab68784 100644 --- a/lib/linter/rules.js +++ b/lib/linter/rules.js @@ -56,7 +56,7 @@ class Rules { */ get(ruleId) { if (typeof this._rules[ruleId] === "string") { - this.define(ruleId, require(`../rules/${this._rules[ruleId]}`)); + this.define(ruleId, require(this._rules[ruleId])); } if (this._rules[ruleId]) { return this._rules[ruleId]; diff --git a/package.json b/package.json index feb9defbd4e..a5766310227 100644 --- a/package.json +++ b/package.json @@ -102,10 +102,10 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "@wdio/browser-runner": "^8.10.2", - "@wdio/cli": "^8.10.2", - "@wdio/concise-reporter": "^8.10.2", - "@wdio/mocha-framework": "^8.10.2", + "@wdio/browser-runner": "^8.10.4", + "@wdio/cli": "^8.10.4", + "@wdio/concise-reporter": "^8.10.4", + "@wdio/mocha-framework": "^8.10.4", "babel-loader": "^8.0.5", "c8": "^7.12.0", "chai": "^4.0.1", @@ -156,9 +156,8 @@ "shelljs": "^0.8.2", "sinon": "^11.0.0", "vite-plugin-commonjs": "^0.6.2", - "vite-plugin-dynamic-import": "^1.2.7", "wdio-chromedriver-service": "^8.1.1", - "webdriverio": "^8.10.2", + "webdriverio": "^8.10.4", "webpack": "^5.23.0", "webpack-cli": "^4.5.0", "yorkie": "^2.0.0" diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index 3943651a432..a5a62c7e487 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -15,8 +15,8 @@ const { assert } = require("chai"), esprima = require("esprima"), testParsers = require("../../fixtures/parsers/linter-test-parsers"); -const { Linter } = require("../../../lib/linter"); const { FlatConfigArray } = require("../../../lib/config/flat-config-array"); +const { Linter } = require("../../../build/eslint.js"); //------------------------------------------------------------------------------ // Constants @@ -48,6 +48,8 @@ function getVariable(scope, name) { */ const ESLINT_ENV = "eslint-env"; +process.cwd = () => "/"; + //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ diff --git a/wdio.conf.js b/wdio.conf.js index d5f217b6d36..3e7f83faa9f 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -1,7 +1,6 @@ "use strict"; const commonjs = require("vite-plugin-commonjs"); -const dynamicImport = require("vite-plugin-dynamic-import"); exports.config = { @@ -21,10 +20,7 @@ exports.config = { assert: "rollup-plugin-node-polyfills/polyfills/assert" } }, - plugins: [ - commonjs(), - dynamicImport.default() - ] + plugins: [commonjs()] } }], From 1ae3602c651ad51113cc5f702725ef08851841ab Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 19 May 2023 13:36:28 -0700 Subject: [PATCH 04/22] adjust tests --- tests/lib/linter/linter.js | 45 +++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index a5a62c7e487..859cc9dc08d 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -9,6 +9,9 @@ // Requirements //------------------------------------------------------------------------------ +import { mock, fn } from "@wdio/browser-runner" +import { expect } from "@wdio/globals" + const { assert } = require("chai"), sinon = require("sinon"), espree = require("espree"), @@ -17,6 +20,22 @@ const { assert } = require("chai"), const { FlatConfigArray } = require("../../../lib/config/flat-config-array"); const { Linter } = require("../../../build/eslint.js"); +const StubParser = require("../../fixtures/parsers/stub-parser.js") + +//------------------------------------------------------------------------------ +// Mocks +//------------------------------------------------------------------------------ +mock('../../fixtures/parsers/stub-parser.js', () => ({ + parse: fn().mockReturnValue({ + type: "Program", + loc: {}, + range: [], + body: [], + comments: [], + errors: [], + tokens: [] + }) +})) //------------------------------------------------------------------------------ // Constants @@ -7266,14 +7285,15 @@ var a = "test2"; /** * fails due to "ES Modules cannot be spied" */ - it.skip("should have file path passed to it", () => { + it("should have file path passed to it", () => { const code = "/* this is code */"; - const parseSpy = sinon.spy(testParsers.stubParser, "parse"); - linter.defineParser("stub-parser", testParsers.stubParser); linter.verify(code, { parser: "stub-parser" }, filename, true); - sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); + expect(StubParser.parse).toBeCalledTimes(1); + const [arg0, arg1] = StubParser.parse.mock.calls[0]; + expect(arg0).toBe(code); + expect(arg1.filePath).toBe(filename); }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { @@ -7516,6 +7536,10 @@ var a = "test2"; assert.strictEqual(messages.length, 0); assert.strictEqual(suppressedMessages.length, 0); }); + + beforeEach(() => { + StubParser.parse.mockClear() + }); }); describe("merging 'parserOptions'", () => { @@ -8074,9 +8098,8 @@ describe("Linter with FlatConfigArray", () => { /** * fails due to: "ES Modules cannot be spied" */ - it.skip("should have file path passed to it", () => { + it("should have file path passed to it", () => { const code = "/* this is code */"; - const parseSpy = sinon.spy(testParsers.stubParser, "parse"); const config = { languageOptions: { parser: testParsers.stubParser @@ -8084,8 +8107,10 @@ describe("Linter with FlatConfigArray", () => { }; linter.verify(code, config, filename, true); - - sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); + expect(StubParser.parse).toBeCalledTimes(1); + const [arg0, arg1] = StubParser.parse.mock.calls[0]; + expect(arg0).toBe(code); + expect(arg1.filePath).toBe(filename); }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { @@ -8389,6 +8414,10 @@ describe("Linter with FlatConfigArray", () => { sourceType: "module" })); }); + + afterEach(() => { + StubParser.parse.mockClear() + }) }); From e7f60297d068cf2374719ae5447474a53049784e Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Thu, 6 Jul 2023 19:45:29 -0700 Subject: [PATCH 05/22] build eslint before running tests --- Makefile.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.js b/Makefile.js index a293d2f498b..528fd5aa1e7 100644 --- a/Makefile.js +++ b/Makefile.js @@ -630,7 +630,7 @@ target.mocha = () => { target.wdio = () => { echo("Running unit tests on browsers"); - + target.webpack("production"); const lastReturn = exec(`${getBinFile("wdio")} run wdio.conf.js`); if (lastReturn.code !== 0) { diff --git a/package.json b/package.json index a5766310227..242201947a4 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "c8": "^7.12.0", "chai": "^4.0.1", "cheerio": "^0.22.0", - "chromedriver": "^112.0.0", + "chromedriver": "^114.0.0", "common-tags": "^1.8.0", "core-js": "^3.1.3", "ejs": "^3.0.2", From 8626b70b85eaad76783404f574e4feefc6f9e955 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 7 Jul 2023 14:09:27 -0700 Subject: [PATCH 06/22] make test file an esm file --- package.json | 1 + tests/lib/linter/{linter.js => linter.mjs} | 37 ++++++++++++---------- wdio.conf.js | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) rename tests/lib/linter/{linter.js => linter.mjs} (99%) diff --git a/package.json b/package.json index 242201947a4..99735d6ffa5 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "@wdio/browser-runner": "^8.10.4", "@wdio/cli": "^8.10.4", "@wdio/concise-reporter": "^8.10.4", + "@wdio/globals": "^8.11.3", "@wdio/mocha-framework": "^8.10.4", "babel-loader": "^8.0.5", "c8": "^7.12.0", diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.mjs similarity index 99% rename from tests/lib/linter/linter.js rename to tests/lib/linter/linter.mjs index 859cc9dc08d..ec9c997f2e6 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.mjs @@ -3,29 +3,29 @@ * @author Nicholas C. Zakas */ -"use strict"; - //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ -import { mock, fn } from "@wdio/browser-runner" -import { expect } from "@wdio/globals" +import { mock, fn } from "@wdio/browser-runner"; +import { expect } from "@wdio/globals"; + +import { assert } from "chai"; +import sinon from "sinon"; +import * as espree from "espree"; +import * as esprima from "esprima"; +import testParsers from "../../fixtures/parsers/linter-test-parsers.js"; -const { assert } = require("chai"), - sinon = require("sinon"), - espree = require("espree"), - esprima = require("esprima"), - testParsers = require("../../fixtures/parsers/linter-test-parsers"); +import { FlatConfigArray } from "../../../lib/config/flat-config-array.js"; +import eslint from "../../../build/eslint.js"; +import StubParser from "../../fixtures/parsers/stub-parser.js"; -const { FlatConfigArray } = require("../../../lib/config/flat-config-array"); -const { Linter } = require("../../../build/eslint.js"); -const StubParser = require("../../fixtures/parsers/stub-parser.js") +const Linter = eslint.Linter; //------------------------------------------------------------------------------ // Mocks //------------------------------------------------------------------------------ -mock('../../fixtures/parsers/stub-parser.js', () => ({ +mock("../../fixtures/parsers/stub-parser.js", () => ({ parse: fn().mockReturnValue({ type: "Program", loc: {}, @@ -35,7 +35,7 @@ mock('../../fixtures/parsers/stub-parser.js', () => ({ errors: [], tokens: [] }) -})) +})); //------------------------------------------------------------------------------ // Constants @@ -7287,11 +7287,13 @@ var a = "test2"; */ it("should have file path passed to it", () => { const code = "/* this is code */"; + linter.defineParser("stub-parser", testParsers.stubParser); linter.verify(code, { parser: "stub-parser" }, filename, true); expect(StubParser.parse).toBeCalledTimes(1); const [arg0, arg1] = StubParser.parse.mock.calls[0]; + expect(arg0).toBe(code); expect(arg1.filePath).toBe(filename); }); @@ -7538,7 +7540,7 @@ var a = "test2"; }); beforeEach(() => { - StubParser.parse.mockClear() + StubParser.parse.mockClear(); }); }); @@ -8109,6 +8111,7 @@ describe("Linter with FlatConfigArray", () => { linter.verify(code, config, filename, true); expect(StubParser.parse).toBeCalledTimes(1); const [arg0, arg1] = StubParser.parse.mock.calls[0]; + expect(arg0).toBe(code); expect(arg1.filePath).toBe(filename); }); @@ -8416,8 +8419,8 @@ describe("Linter with FlatConfigArray", () => { }); afterEach(() => { - StubParser.parse.mockClear() - }) + StubParser.parse.mockClear(); + }); }); diff --git a/wdio.conf.js b/wdio.conf.js index 3e7f83faa9f..fb429f44f67 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -43,7 +43,7 @@ exports.config = { * */ specs: [ - "tests/lib/linter/linter.js" + "tests/lib/linter/linter.mjs" ], // Patterns to exclude. From e25e413a3aa26cf33c6f1a6f4558c13f70575cd6 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Thu, 13 Jul 2023 19:00:44 -0700 Subject: [PATCH 07/22] revert more esm changes --- tests/lib/linter/{linter.mjs => linter.js} | 88 +++++++++------------- wdio.conf.js | 2 +- 2 files changed, 35 insertions(+), 55 deletions(-) rename tests/lib/linter/{linter.mjs => linter.js} (99%) diff --git a/tests/lib/linter/linter.mjs b/tests/lib/linter/linter.js similarity index 99% rename from tests/lib/linter/linter.mjs rename to tests/lib/linter/linter.js index ec9c997f2e6..c0845f5b632 100644 --- a/tests/lib/linter/linter.mjs +++ b/tests/lib/linter/linter.js @@ -3,44 +3,26 @@ * @author Nicholas C. Zakas */ +"use strict"; + //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ -import { mock, fn } from "@wdio/browser-runner"; -import { expect } from "@wdio/globals"; - -import { assert } from "chai"; -import sinon from "sinon"; -import * as espree from "espree"; -import * as esprima from "esprima"; -import testParsers from "../../fixtures/parsers/linter-test-parsers.js"; - -import { FlatConfigArray } from "../../../lib/config/flat-config-array.js"; -import eslint from "../../../build/eslint.js"; -import StubParser from "../../fixtures/parsers/stub-parser.js"; +const { assert } = require("chai"), + sinon = require("sinon"), + espree = require("espree"), + esprima = require("esprima"), + testParsers = require("../../fixtures/parsers/linter-test-parsers"); -const Linter = eslint.Linter; - -//------------------------------------------------------------------------------ -// Mocks -//------------------------------------------------------------------------------ -mock("../../fixtures/parsers/stub-parser.js", () => ({ - parse: fn().mockReturnValue({ - type: "Program", - loc: {}, - range: [], - body: [], - comments: [], - errors: [], - tokens: [] - }) -})); +const { Linter } = require("../../../build/eslint"); +const { FlatConfigArray } = require("../../../lib/config/flat-config-array"); //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ +const IS_BROWSER = Boolean(globalThis.window); const TEST_CODE = "var answer = 6 * 7;", BROKEN_TEST_CODE = "var;"; @@ -67,7 +49,12 @@ function getVariable(scope, name) { */ const ESLINT_ENV = "eslint-env"; -process.cwd = () => "/"; +/** + * we want to mock this when running within the browser to match the test result in Node.js + */ +if (IS_BROWSER) { + process.cwd = () => "/"; +} //------------------------------------------------------------------------------ // Tests @@ -7282,20 +7269,20 @@ var a = "test2"; const errorPrefix = "Parsing error: "; - /** - * fails due to "ES Modules cannot be spied" - */ - it("should have file path passed to it", () => { + it("should have file path passed to it", function() { + if (IS_BROWSER) { + // eslint-disable-next-line no-invalid-this -- ignore me + return this.skip(); + } + const code = "/* this is code */"; + const parseSpy = sinon.spy(testParsers.stubParser, "parse"); linter.defineParser("stub-parser", testParsers.stubParser); linter.verify(code, { parser: "stub-parser" }, filename, true); - expect(StubParser.parse).toBeCalledTimes(1); - const [arg0, arg1] = StubParser.parse.mock.calls[0]; - - expect(arg0).toBe(code); - expect(arg1.filePath).toBe(filename); + sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); + return null; }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { @@ -7538,10 +7525,6 @@ var a = "test2"; assert.strictEqual(messages.length, 0); assert.strictEqual(suppressedMessages.length, 0); }); - - beforeEach(() => { - StubParser.parse.mockClear(); - }); }); describe("merging 'parserOptions'", () => { @@ -8097,11 +8080,14 @@ describe("Linter with FlatConfigArray", () => { const errorPrefix = "Parsing error: "; - /** - * fails due to: "ES Modules cannot be spied" - */ - it("should have file path passed to it", () => { + it("should have file path passed to it", function() { + if (IS_BROWSER) { + // eslint-disable-next-line no-invalid-this -- ignore me + return this.skip(); + } + const code = "/* this is code */"; + const parseSpy = sinon.spy(testParsers.stubParser, "parse"); const config = { languageOptions: { parser: testParsers.stubParser @@ -8109,11 +8095,9 @@ describe("Linter with FlatConfigArray", () => { }; linter.verify(code, config, filename, true); - expect(StubParser.parse).toBeCalledTimes(1); - const [arg0, arg1] = StubParser.parse.mock.calls[0]; - expect(arg0).toBe(code); - expect(arg1.filePath).toBe(filename); + sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); + return null; }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { @@ -8417,10 +8401,6 @@ describe("Linter with FlatConfigArray", () => { sourceType: "module" })); }); - - afterEach(() => { - StubParser.parse.mockClear(); - }); }); diff --git a/wdio.conf.js b/wdio.conf.js index fb429f44f67..3e7f83faa9f 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -43,7 +43,7 @@ exports.config = { * */ specs: [ - "tests/lib/linter/linter.mjs" + "tests/lib/linter/linter.js" ], // Patterns to exclude. From 3d75485103ae8412ea28ae710ea58b541a07cb90 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Thu, 13 Jul 2023 19:18:37 -0700 Subject: [PATCH 08/22] make it work --- tests/lib/linter/linter.js | 24 +++--------------------- wdio.conf.js | 25 ++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index c0845f5b632..54ad80f0ea9 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -15,14 +15,13 @@ const { assert } = require("chai"), esprima = require("esprima"), testParsers = require("../../fixtures/parsers/linter-test-parsers"); -const { Linter } = require("../../../build/eslint"); +const { Linter } = require("../../../lib/linter"); const { FlatConfigArray } = require("../../../lib/config/flat-config-array"); //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ -const IS_BROWSER = Boolean(globalThis.window); const TEST_CODE = "var answer = 6 * 7;", BROKEN_TEST_CODE = "var;"; @@ -49,13 +48,6 @@ function getVariable(scope, name) { */ const ESLINT_ENV = "eslint-env"; -/** - * we want to mock this when running within the browser to match the test result in Node.js - */ -if (IS_BROWSER) { - process.cwd = () => "/"; -} - //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ @@ -7269,12 +7261,7 @@ var a = "test2"; const errorPrefix = "Parsing error: "; - it("should have file path passed to it", function() { - if (IS_BROWSER) { - // eslint-disable-next-line no-invalid-this -- ignore me - return this.skip(); - } - + it("should have file path passed to it @skipWeb", () => { const code = "/* this is code */"; const parseSpy = sinon.spy(testParsers.stubParser, "parse"); @@ -8080,12 +8067,7 @@ describe("Linter with FlatConfigArray", () => { const errorPrefix = "Parsing error: "; - it("should have file path passed to it", function() { - if (IS_BROWSER) { - // eslint-disable-next-line no-invalid-this -- ignore me - return this.skip(); - } - + it("should have file path passed to it @skipWeb", () => { const code = "/* this is code */"; const parseSpy = sinon.spy(testParsers.stubParser, "parse"); const config = { diff --git a/wdio.conf.js b/wdio.conf.js index 3e7f83faa9f..6604b1802e6 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -20,7 +20,24 @@ exports.config = { assert: "rollup-plugin-node-polyfills/polyfills/assert" } }, - plugins: [commonjs()] + plugins: [ + commonjs(), + { + name: "wdio:import-fix", + enforce: "pre", + transform(source, id) { + if (!id.endsWith("/tests/lib/linter/linter.js")) { + return source; + } + + return source.replace( + 'const { Linter } = require("../../../lib/linter");', + 'const { Linter } = require("../../../build/eslint");\n' + + 'process.cwd = () => "/";' + ); + } + } + ] } }], @@ -59,7 +76,7 @@ exports.config = { * sessions. Within your capabilities you can overwrite the spec and exclude options in * order to group specific specs to a specific capability. * - * First, you can define how many instances should be started at the same time. Let's + * First, you can define how many instances should be started at the same time. Let"s * say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have * set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec * files and you set maxInstances to 10, all spec files will get tested at the same time @@ -187,7 +204,9 @@ exports.config = { */ mochaOpts: { ui: "bdd", - timeout: 60000 + timeout: 60000, + grep: "@skipWeb", + invert: true } /* From be9851b8d4b67f0586d3e3b194bf2a6b63fa33ac Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Thu, 13 Jul 2023 19:19:19 -0700 Subject: [PATCH 09/22] remove return value --- tests/lib/linter/linter.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index 54ad80f0ea9..e6f2dfafb44 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -7269,7 +7269,6 @@ var a = "test2"; linter.verify(code, { parser: "stub-parser" }, filename, true); sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); - return null; }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { @@ -8079,7 +8078,6 @@ describe("Linter with FlatConfigArray", () => { linter.verify(code, config, filename, true); sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); - return null; }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { From d89595dd2a5d520cae00ea7774a956183b0f458e Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 14 Jul 2023 00:05:57 -0700 Subject: [PATCH 10/22] custom log dir for wdio tests --- .gitignore | 1 + wdio.conf.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 12d141ab546..148181e0776 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ test.js coverage/ build/ logs +wdio-logs npm-debug.log yarn-error.log .pnpm-debug.log diff --git a/wdio.conf.js b/wdio.conf.js index 6604b1802e6..208387c1520 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -110,7 +110,7 @@ exports.config = { * Level of logging verbosity: trace | debug | info | warn | error | silent */ logLevel: "info", - outputDir: "./logs", + outputDir: "./wdio-logs", /* * From fc7a8d8ae81c0319ded4d2dacaa5baaa8492c78b Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Sun, 16 Jul 2023 21:16:42 -0700 Subject: [PATCH 11/22] auto detect chromedriver --- .github/workflows/ci.yml | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b545845f318..719ccf14e20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,6 +74,8 @@ jobs: node-version: '16' - name: Install Packages run: npm install + env: + DETECT_CHROMEDRIVER_VERSION: true - name: Test run: node Makefile wdio - name: Fuzz Test diff --git a/package.json b/package.json index 99735d6ffa5..760dd266a88 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "c8": "^7.12.0", "chai": "^4.0.1", "cheerio": "^0.22.0", - "chromedriver": "^114.0.0", + "chromedriver": "^106.0.0", "common-tags": "^1.8.0", "core-js": "^3.1.3", "ejs": "^3.0.2", From 93f472c775c39177810d495f4752a5306c994620 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Sun, 16 Jul 2023 21:25:53 -0700 Subject: [PATCH 12/22] bump timeout, store logs --- .github/workflows/ci.yml | 6 ++++++ wdio.conf.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 719ccf14e20..fe56ec13645 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,3 +80,9 @@ jobs: run: node Makefile wdio - name: Fuzz Test run: node Makefile fuzz + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: logs + path: | + wdio-logs/*.log diff --git a/wdio.conf.js b/wdio.conf.js index 208387c1520..00dbd07ad91 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -204,7 +204,7 @@ exports.config = { */ mochaOpts: { ui: "bdd", - timeout: 60000, + timeout: 2 * 60 * 1000, // 2min grep: "@skipWeb", invert: true } From 297092b0c00a86d18bbdc1c7d28f80738929531f Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Sun, 16 Jul 2023 21:34:35 -0700 Subject: [PATCH 13/22] bump timeout again --- wdio.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wdio.conf.js b/wdio.conf.js index 00dbd07ad91..58cb1780798 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -204,7 +204,7 @@ exports.config = { */ mochaOpts: { ui: "bdd", - timeout: 2 * 60 * 1000, // 2min + timeout: 5 * 60 * 1000, // 5min grep: "@skipWeb", invert: true } From 0b49c4fa41e7678ab7d9a5fbdec3544d19032060 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Sun, 16 Jul 2023 22:48:02 -0700 Subject: [PATCH 14/22] update wdio deps --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 760dd266a88..a75fb90baff 100644 --- a/package.json +++ b/package.json @@ -102,11 +102,11 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "@wdio/browser-runner": "^8.10.4", - "@wdio/cli": "^8.10.4", - "@wdio/concise-reporter": "^8.10.4", - "@wdio/globals": "^8.11.3", - "@wdio/mocha-framework": "^8.10.4", + "@wdio/browser-runner": "^8.13.2", + "@wdio/cli": "^8.13.1", + "@wdio/concise-reporter": "^8.13.2", + "@wdio/globals": "^8.13.1", + "@wdio/mocha-framework": "^8.12.1", "babel-loader": "^8.0.5", "c8": "^7.12.0", "chai": "^4.0.1", @@ -158,7 +158,7 @@ "sinon": "^11.0.0", "vite-plugin-commonjs": "^0.6.2", "wdio-chromedriver-service": "^8.1.1", - "webdriverio": "^8.10.4", + "webdriverio": "^8.13.1", "webpack": "^5.23.0", "webpack-cli": "^4.5.0", "yorkie": "^2.0.0" From b30755796f06d935a0194cc42d4f2bdd5c458c96 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Mon, 17 Jul 2023 22:23:20 -0700 Subject: [PATCH 15/22] update wdio deps --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a75fb90baff..c1d9781d665 100644 --- a/package.json +++ b/package.json @@ -102,10 +102,10 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "@wdio/browser-runner": "^8.13.2", - "@wdio/cli": "^8.13.1", + "@wdio/browser-runner": "^8.13.4", + "@wdio/cli": "^8.13.4", "@wdio/concise-reporter": "^8.13.2", - "@wdio/globals": "^8.13.1", + "@wdio/globals": "^8.13.4", "@wdio/mocha-framework": "^8.12.1", "babel-loader": "^8.0.5", "c8": "^7.12.0", @@ -158,7 +158,7 @@ "sinon": "^11.0.0", "vite-plugin-commonjs": "^0.6.2", "wdio-chromedriver-service": "^8.1.1", - "webdriverio": "^8.13.1", + "webdriverio": "^8.13.4", "webpack": "^5.23.0", "webpack-cli": "^4.5.0", "yorkie": "^2.0.0" From d128e933888e5898ad26a78218c224df781e7289 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Tue, 18 Jul 2023 09:17:39 -0700 Subject: [PATCH 16/22] set log level to trace --- wdio.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wdio.conf.js b/wdio.conf.js index 58cb1780798..a8a40dea5e5 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -109,7 +109,7 @@ exports.config = { * * Level of logging verbosity: trace | debug | info | warn | error | silent */ - logLevel: "info", + logLevel: "trace", outputDir: "./wdio-logs", /* From c3537d87ac2907b6749a4b43b2808e8cc69857be Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Tue, 18 Jul 2023 11:02:01 -0700 Subject: [PATCH 17/22] update wdio deps and unskip tests --- package.json | 6 +++--- tests/lib/linter/linter.js | 16 ++++++++-------- wdio.conf.js | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index c1d9781d665..15407ba0c90 100644 --- a/package.json +++ b/package.json @@ -102,8 +102,8 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "@wdio/browser-runner": "^8.13.4", - "@wdio/cli": "^8.13.4", + "@wdio/browser-runner": "^8.13.6", + "@wdio/cli": "^8.13.5", "@wdio/concise-reporter": "^8.13.2", "@wdio/globals": "^8.13.4", "@wdio/mocha-framework": "^8.12.1", @@ -156,7 +156,7 @@ "semver": "^7.5.3", "shelljs": "^0.8.2", "sinon": "^11.0.0", - "vite-plugin-commonjs": "^0.6.2", + "vite-plugin-commonjs": "^0.8.2", "wdio-chromedriver-service": "^8.1.1", "webdriverio": "^8.13.4", "webpack": "^5.23.0", diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index e6f2dfafb44..36ff3c96f84 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -7261,14 +7261,14 @@ var a = "test2"; const errorPrefix = "Parsing error: "; - it("should have file path passed to it @skipWeb", () => { + it("should have file path passed to it", async () => { const code = "/* this is code */"; - const parseSpy = sinon.spy(testParsers.stubParser, "parse"); + const parseSpy = { parse: sinon.spy() }; - linter.defineParser("stub-parser", testParsers.stubParser); + linter.defineParser("stub-parser", parseSpy); linter.verify(code, { parser: "stub-parser" }, filename, true); - sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); + sinon.assert.calledWithMatch(parseSpy.parse, "", { filePath: filename }); }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { @@ -8066,18 +8066,18 @@ describe("Linter with FlatConfigArray", () => { const errorPrefix = "Parsing error: "; - it("should have file path passed to it @skipWeb", () => { + it("should have file path passed to it", () => { const code = "/* this is code */"; - const parseSpy = sinon.spy(testParsers.stubParser, "parse"); + const parseSpy = { parse: sinon.spy() }; const config = { languageOptions: { - parser: testParsers.stubParser + parser: parseSpy } }; linter.verify(code, config, filename, true); - sinon.assert.calledWithMatch(parseSpy, "", { filePath: filename }); + sinon.assert.calledWithMatch(parseSpy.parse, "", { filePath: filename }); }); it("should not report an error when JSX code contains a spread operator and JSX is enabled", () => { diff --git a/wdio.conf.js b/wdio.conf.js index a8a40dea5e5..ea44fe2c97b 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -1,6 +1,6 @@ "use strict"; -const commonjs = require("vite-plugin-commonjs"); +const commonjs = require("vite-plugin-commonjs").default; exports.config = { From dc1c56fbd14c4c407059be299996688be684ae8d Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Tue, 18 Jul 2023 11:06:13 -0700 Subject: [PATCH 18/22] no need to have this be an async test --- tests/lib/linter/linter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/linter/linter.js b/tests/lib/linter/linter.js index 36ff3c96f84..65957f82a75 100644 --- a/tests/lib/linter/linter.js +++ b/tests/lib/linter/linter.js @@ -7261,7 +7261,7 @@ var a = "test2"; const errorPrefix = "Parsing error: "; - it("should have file path passed to it", async () => { + it("should have file path passed to it", () => { const code = "/* this is code */"; const parseSpy = { parse: sinon.spy() }; From 4071277ae4c8ed517648c8e40d33db652382a196 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Sun, 13 Aug 2023 22:27:25 -0700 Subject: [PATCH 19/22] update deps --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 15407ba0c90..2357b5a62e3 100644 --- a/package.json +++ b/package.json @@ -102,11 +102,11 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "@wdio/browser-runner": "^8.13.6", - "@wdio/cli": "^8.13.5", - "@wdio/concise-reporter": "^8.13.2", - "@wdio/globals": "^8.13.4", - "@wdio/mocha-framework": "^8.12.1", + "@wdio/browser-runner": "^8.14.6", + "@wdio/cli": "^8.14.6", + "@wdio/concise-reporter": "^8.14.0", + "@wdio/globals": "^8.14.6", + "@wdio/mocha-framework": "^8.14.0", "babel-loader": "^8.0.5", "c8": "^7.12.0", "chai": "^4.0.1", @@ -158,7 +158,7 @@ "sinon": "^11.0.0", "vite-plugin-commonjs": "^0.8.2", "wdio-chromedriver-service": "^8.1.1", - "webdriverio": "^8.13.4", + "webdriverio": "^8.14.6", "webpack": "^5.23.0", "webpack-cli": "^4.5.0", "yorkie": "^2.0.0" From 17450a078f5f61c8c812065f5686a5cb2f948151 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Sun, 13 Aug 2023 22:30:22 -0700 Subject: [PATCH 20/22] make path spec file explicit --- wdio.conf.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wdio.conf.js b/wdio.conf.js index ea44fe2c97b..57628f4a910 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -1,5 +1,6 @@ "use strict"; +const path = require("path"); const commonjs = require("vite-plugin-commonjs").default; exports.config = { @@ -60,7 +61,7 @@ exports.config = { * */ specs: [ - "tests/lib/linter/linter.js" + path.join(__dirname, "tests", "lib", "linter", "linter.js") ], // Patterns to exclude. From 72e6a7f51ff378a213d9045f6bd2ef0703219cb8 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Mon, 14 Aug 2023 08:03:49 -0700 Subject: [PATCH 21/22] remove Chromedriver deps --- .github/workflows/ci.yml | 2 -- package.json | 2 -- wdio.conf.js | 9 --------- 3 files changed, 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe56ec13645..92e2a7eed35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,8 +74,6 @@ jobs: node-version: '16' - name: Install Packages run: npm install - env: - DETECT_CHROMEDRIVER_VERSION: true - name: Test run: node Makefile wdio - name: Fuzz Test diff --git a/package.json b/package.json index 2357b5a62e3..1c22eb6e2e7 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,6 @@ "c8": "^7.12.0", "chai": "^4.0.1", "cheerio": "^0.22.0", - "chromedriver": "^106.0.0", "common-tags": "^1.8.0", "core-js": "^3.1.3", "ejs": "^3.0.2", @@ -157,7 +156,6 @@ "shelljs": "^0.8.2", "sinon": "^11.0.0", "vite-plugin-commonjs": "^0.8.2", - "wdio-chromedriver-service": "^8.1.1", "webdriverio": "^8.14.6", "webpack": "^5.23.0", "webpack-cli": "^4.5.0", diff --git a/wdio.conf.js b/wdio.conf.js index 57628f4a910..f32d757133e 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -162,15 +162,6 @@ exports.config = { */ connectionRetryCount: 3, - /* - * - * Test runner services - * Services take over a specific job you don't want to take care of. They enhance - * your test setup with almost no effort. Unlike plugins, they don't add new - * commands. Instead, they hook themselves up into the test process. - */ - services: ["chromedriver"], - /* * Framework you want to run your specs with. * The following are supported: Mocha, Jasmine, and Cucumber From a00fa6ec5a1c6f14811898f75dd3dd8ca7174451 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Tue, 15 Aug 2023 09:52:39 -0700 Subject: [PATCH 22/22] removed wdio command --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c22eb6e2e7..97c9431abd9 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,7 @@ "test": "node Makefile.js test", "test:cli": "mocha", "test:fuzz": "node Makefile.js fuzz", - "test:performance": "node Makefile.js perf", - "wdio": "wdio run ./wdio.conf.js" + "test:performance": "node Makefile.js perf" }, "gitHooks": { "pre-commit": "lint-staged"