Skip to content
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

test: replace Karma with Webdriver.IO #17126

Merged
merged 22 commits into from Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -75,6 +75,12 @@ jobs:
- name: Install Packages
run: npm install
- name: Test
run: node Makefile karma
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
snitin315 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -3,6 +3,8 @@
test.js
coverage/
build/
logs
wdio-logs
npm-debug.log
yarn-error.log
.pnpm-debug.log
Expand Down
8 changes: 3 additions & 5 deletions Makefile.js
Expand Up @@ -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);
Expand All @@ -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();
};
Expand Down
125 changes: 0 additions & 125 deletions karma.conf.js

This file was deleted.

3 changes: 2 additions & 1 deletion lib/config/rule-validator.js
Expand Up @@ -9,7 +9,8 @@
// Requirements
//-----------------------------------------------------------------------------

const ajv = require("../shared/ajv")();
const ajvImport = require("../shared/ajv");
const ajv = ajvImport();
const {
parseRuleId,
getRuleFromConfig,
Expand Down
17 changes: 10 additions & 7 deletions package.json
Expand Up @@ -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"
christian-bromann marked this conversation as resolved.
Show resolved Hide resolved
},
"gitHooks": {
"pre-commit": "lint-staged"
Expand Down Expand Up @@ -101,6 +102,11 @@
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@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",
Expand All @@ -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",
Expand All @@ -148,12 +149,14 @@
"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",
"semver": "^7.5.3",
"shelljs": "^0.8.2",
"sinon": "^11.0.0",
"vite-plugin-commonjs": "^0.8.2",
"webdriverio": "^8.14.6",
"webpack": "^5.23.0",
"webpack-cli": "^4.5.0",
"yorkie": "^2.0.0"
Expand Down
14 changes: 7 additions & 7 deletions tests/lib/linter/linter.js
christian-bromann marked this conversation as resolved.
Show resolved Hide resolved
Expand Up @@ -9,7 +9,7 @@
// Requirements
//------------------------------------------------------------------------------

const assert = require("chai").assert,
const { assert } = require("chai"),
sinon = require("sinon"),
espree = require("espree"),
esprima = require("esprima"),
Expand Down Expand Up @@ -7263,12 +7263,12 @@ var a = "test2";

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() };

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", () => {
Expand Down Expand Up @@ -8068,16 +8068,16 @@ describe("Linter with FlatConfigArray", () => {

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", () => {
Expand Down