diff --git a/package-lock.json b/package-lock.json index 63c6a552..3dec6456 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,8 +26,6 @@ }, "devDependencies": { "@eslint/js": "^9.33.0", - "@types/chai": "^4.3.20", - "@types/chai-fs": "^2.0.5", "@types/ejs": "^3.1.5", "@types/fs-extra": "^11.0.4", "@types/js-yaml": "^4.0.9", @@ -38,8 +36,6 @@ "@types/which": "^3.0.4", "@types/yauzl": "^2.10.3", "@vscode/test-electron": "^2.5.2", - "chai": "^4.5.0", - "chai-fs": "^2.0.0", "eslint": "^9.33.0", "eslint-webpack-plugin": "^5.0.2", "fast-xml-parser": "^5.2.5", @@ -1289,21 +1285,6 @@ "@textlint/ast-node-types": "14.8.4" } }, - "node_modules/@types/chai": { - "version": "4.3.20", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.20.tgz", - "integrity": "sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==", - "dev": true - }, - "node_modules/@types/chai-fs": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@types/chai-fs/-/chai-fs-2.0.5.tgz", - "integrity": "sha512-Fusfcwil87QBYVN9vqDf46/+mb19bbDyQ7+dRNBZuLetgI5aipjHI0kI9sl2o02w9jTw70y7R58Ns6e40cfa1w==", - "dev": true, - "dependencies": { - "@types/chai": "*" - } - }, "node_modules/@types/ejs": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/@types/ejs/-/ejs-3.1.5.tgz", @@ -2451,19 +2432,6 @@ "node": ">=0.10.0" } }, - "node_modules/array-events": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/array-events/-/array-events-0.2.0.tgz", - "integrity": "sha1-/0KsU+ZvSF1viDI0wyJSvCKGEw4=", - "dev": true, - "dependencies": { - "async-arrays": "*", - "extended-emitter": "*" - }, - "engines": { - "node": "*" - } - }, "node_modules/array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", @@ -2474,15 +2442,6 @@ "node": ">=0.10.0" } }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -2497,18 +2456,6 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" }, - "node_modules/async-arrays": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-arrays/-/async-arrays-1.0.1.tgz", - "integrity": "sha1-NHrytw8qeldnotVnnMQrvxwiD9k=", - "dev": true, - "dependencies": { - "sift": "*" - }, - "engines": { - "node": "*" - } - }, "node_modules/async-done": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/async-done/-/async-done-2.0.0.tgz", @@ -2631,18 +2578,6 @@ "url": "https://bevry.me/fund" } }, - "node_modules/bit-mask": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bit-mask/-/bit-mask-1.0.2.tgz", - "integrity": "sha512-UGtq08LSiazxL4zVmBzrhdCWnT4RWx3JhhD/3crhfv8xxjnVHxf/WoVjEstjSUaZeZRP7kZrWNqup1VvUClCaQ==", - "dev": true, - "dependencies": { - "array-events": "^0.2.0" - }, - "engines": { - "node": "*" - } - }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -3056,12 +2991,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/call-me-maybe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", - "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=", - "dev": true - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -3104,40 +3033,6 @@ } ] }, - "node_modules/chai": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", - "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", - "dev": true, - "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/chai-fs": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chai-fs/-/chai-fs-2.0.0.tgz", - "integrity": "sha1-Na4Dn7uwcQ9RIqrhf6uh6PQRB8Y=", - "dev": true, - "dependencies": { - "bit-mask": "^1.0.1", - "readdir-enhanced": "^1.4.0" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "chai": ">= 1.6.1 < 5" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3164,18 +3059,6 @@ "node": ">=8" } }, - "node_modules/check-error": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.2" - }, - "engines": { - "node": "*" - } - }, "node_modules/cheerio": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.1.0.tgz", @@ -3609,18 +3492,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/deep-eql": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", - "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", - "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -4008,12 +3879,6 @@ "node": ">= 0.4" } }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -4512,19 +4377,6 @@ "dev": true, "license": "MIT" }, - "node_modules/extended-emitter": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/extended-emitter/-/extended-emitter-1.0.3.tgz", - "integrity": "sha512-gdaWWszJmr2oq6rKSxPmuclQtEwfzt4JwmGrEqTnE89GQHqZyvPZ/NWj6fBgK3IKufvRyJDnLZviUFPrrJf36Q==", - "dev": true, - "dependencies": { - "sift": "*", - "wolfy87-eventemitter": "*" - }, - "engines": { - "node": "*" - } - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -4942,15 +4794,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-func-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", - "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -5080,12 +4923,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob-to-regexp": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz", - "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=", - "dev": true - }, "node_modules/glob-watcher": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-6.0.0.tgz", @@ -6492,15 +6329,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/loupe": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.1" - } - }, "node_modules/lowercase-keys": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", @@ -7745,15 +7573,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -8054,17 +7873,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "node_modules/readdir-enhanced": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/readdir-enhanced/-/readdir-enhanced-1.5.2.tgz", - "integrity": "sha1-YUYwSGkKxqRVt1ti+nioj43IXlM=", - "dev": true, - "dependencies": { - "call-me-maybe": "^1.0.1", - "es6-promise": "^4.1.0", - "glob-to-regexp": "^0.3.0" - } - }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -8595,12 +8403,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/sift": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/sift/-/sift-9.0.0.tgz", - "integrity": "sha512-jAd/cPlBHqfTORB0VV+Dilu+Vhw5Cmvp1C5lXPMce3V3jX5GW/9DpaV3HnGia2PUV+AQ5NRT0VDIQmsb72sE/g==", - "dev": true - }, "node_modules/signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -9483,15 +9285,6 @@ "node": ">= 0.8.0" } }, - "node_modules/type-detect": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", - "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/type-fest": { "version": "4.41.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", @@ -10318,12 +10111,6 @@ "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", "dev": true }, - "node_modules/wolfy87-eventemitter": { - "version": "5.2.8", - "resolved": "https://registry.npmjs.org/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.8.tgz", - "integrity": "sha512-Z+wAU9SyuOZgFj22zBl8sg0auJOkrKBZl8TTlEM5dRDDs2zPtlm72vPJUIlf6tUJ4w2JLgrF7VznRnQHP+Rn/Q==", - "dev": true - }, "node_modules/workerpool": { "version": "9.3.2", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.2.tgz", diff --git a/package.json b/package.json index 20e0bd2b..2bf5ec18 100644 --- a/package.json +++ b/package.json @@ -494,8 +494,6 @@ }, "devDependencies": { "@eslint/js": "^9.33.0", - "@types/chai": "^4.3.20", - "@types/chai-fs": "^2.0.5", "@types/ejs": "^3.1.5", "@types/fs-extra": "^11.0.4", "@types/js-yaml": "^4.0.9", @@ -506,8 +504,6 @@ "@types/which": "^3.0.4", "@types/yauzl": "^2.10.3", "@vscode/test-electron": "^2.5.2", - "chai": "^4.5.0", - "chai-fs": "^2.0.0", "eslint": "^9.33.0", "eslint-webpack-plugin": "^5.0.2", "fast-xml-parser": "^5.2.5", diff --git a/src/test/vscodeTest/suite/extension.test.ts b/src/test/vscodeTest/suite/extension.test.ts index 4532719a..dfc6bc4d 100644 --- a/src/test/vscodeTest/suite/extension.test.ts +++ b/src/test/vscodeTest/suite/extension.test.ts @@ -1,10 +1,10 @@ -import { expect } from 'chai'; import { describe, it } from 'mocha'; import * as vscode from 'vscode'; +import * as assert from 'assert/strict'; describe('VS Code extension tests', () => { it('should be present', () => { - expect(vscode.extensions.getExtension('redhat.vscode-quarkus')).to.be.ok; + assert.ok(vscode.extensions.getExtension('redhat.vscode-quarkus')); }); }); diff --git a/src/test/vscodeUiTest/suite/projectGenerationTest.ts b/src/test/vscodeUiTest/suite/projectGenerationTest.ts index b5d4ccdc..29d13fb2 100644 --- a/src/test/vscodeUiTest/suite/projectGenerationTest.ts +++ b/src/test/vscodeUiTest/suite/projectGenerationTest.ts @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { expect, use } from 'chai'; import * as fs from 'fs-extra'; import * as g2js from 'gradle-to-js/lib/parser'; import * as _ from 'lodash'; @@ -22,8 +21,7 @@ import { XMLParser } from "fast-xml-parser"; import { env } from 'process'; import { By, InputBox, Key, VSBrowser, WebDriver, WebElement, Workbench } from 'vscode-extension-tester'; import { ProjectGenerationWizard, QuickPickItemInfo } from '../ProjectGenerationWizard'; - -use(require('chai-fs')); // eslint-disable-line +import * as assert from 'assert/strict'; /** * This file contains tests for the project generation wizard @@ -66,7 +64,7 @@ describe('Project generation tests', function () { it('should open project generation wizard', async function () { this.timeout(60000); const wizard: ProjectGenerationWizard = await ProjectGenerationWizard.openWizard(driver); - expect(await wizardExists(), 'wizard did not open').to.be.true; + assert.ok(await wizardExists(), 'wizard did not open'); await wizard.cancel(); }); @@ -78,33 +76,33 @@ describe('Project generation tests', function () { this.timeout(60000); const wizard: ProjectGenerationWizard = await ProjectGenerationWizard.openWizard(driver); - expect(await wizard.getNthQuickPickItemLabel(0), 'default should be Maven').equals('Maven'); + assert.equal(await wizard.getNthQuickPickItemLabel(0), 'Maven', 'default should be Maven'); await wizard.next(); await wizard.sendKeys(Key.DOWN, Key.UP); const quickPickPlatform: QuickPickItemInfo = await wizard.getNthQuickPickItemInfo(0); - expect(quickPickPlatform.label).to.have.string('(recommended)'); + assert.match(quickPickPlatform.label, /\(recommended\)/); await wizard.next(); const javaVersion = await wizard.getNthQuickPickItemInfo(0); //expects the java version label to be a number maybe followed by `(recommended)` - expect(javaVersion.label).to.match(/^\d+(\.\d+)*(\.\d+)?( \(recommended\))?$/); + assert.match(javaVersion.label, /^\d+(\.\d+)*(\.\d+)?( \(recommended\))?$/); await wizard.next(); const groupId = await wizard.getText(); - expect(groupId).equals('org.acme'); + assert.equal(groupId, 'org.acme'); await wizard.next(); const artifactId = await wizard.getText(); - expect(artifactId).equals('quarkus-getting-started'); + assert.equal(artifactId, 'quarkus-getting-started'); await wizard.next(); const projectVersion = await wizard.getText(); - expect(projectVersion).equals('1.0.0-SNAPSHOT'); + assert.equal(projectVersion, '1.0.0-SNAPSHOT'); await wizard.next(); const packageName = await wizard.getText(); - expect(packageName).equals('org.acme'); + assert.equal(packageName, 'org.acme'); await wizard.next(); await wizard.getNthQuickPickItemInfo(0); @@ -113,23 +111,23 @@ describe('Project generation tests', function () { await wizard.next(); const resourceName = await wizard.getText(); - expect(resourceName).equals('GreetingResource'); + assert.equal(resourceName, 'GreetingResource'); await wizard.next(); await wizard.focusQuickPick(0); - expect(await wizard.getNthQuickPickItemLabel(0)).to.have.string('0 extensions selected'); + assert.match(await wizard.getNthQuickPickItemLabel(0), /0 extensions selected/); await wizard.focusQuickPick(2); await wizard.confirm(); - expect(await wizard.getNthQuickPickItemLabel(0)).to.have.string('1 extension selected'); + assert.match(await wizard.getNthQuickPickItemLabel(0), /1 extension selected/); await wizard.focusQuickPick(3); await wizard.confirm(); - expect(await wizard.getNthQuickPickItemLabel(0)).to.have.string('2 extensions selected'); + assert.match(await wizard.getNthQuickPickItemLabel(0), /2 extensions selected/); await wizard.focusQuickPick(1); await wizard.confirm(); - expect(await wizard.getNthQuickPickItemLabel(0)).to.have.string('1 extension selected'); + assert.match(await wizard.getNthQuickPickItemLabel(0), /1 extension selected/); await wizard.focusQuickPick(1); await wizard.confirm(); - expect(await wizard.getNthQuickPickItemLabel(0)).to.have.string('0 extensions selected'); + assert.match(await wizard.getNthQuickPickItemLabel(0), /0 extensions selected/); await wizard.cancel(); }); @@ -140,71 +138,71 @@ describe('Project generation tests', function () { it('should have correct step values', async function () { this.timeout(60000); const wizard: ProjectGenerationWizard = await ProjectGenerationWizard.openWizard(driver); - expect(await wizard.getInputBoxTitle()).to.have.string('1/10'); - expect(await wizard.getBackButton()).to.not.be.ok; + assert.match(await wizard.getInputBoxTitle(), /1\/10/); + assert.equal(await wizard.getBackButton(), undefined); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('2/10'); + assert.match(await wizard.getInputBoxTitle(), /2\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('3/10'); + assert.match(await wizard.getInputBoxTitle(), /3\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('4/10'); + assert.match(await wizard.getInputBoxTitle(), /4\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('5/10'); + assert.match(await wizard.getInputBoxTitle(), /5\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('6/10'); + assert.match(await wizard.getInputBoxTitle(), /6\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('7/10'); + assert.match(await wizard.getInputBoxTitle(), /7\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('8/10'); + assert.match(await wizard.getInputBoxTitle(), /8\/10/); await wizard.focusQuickPick(0);//starter code await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('9/10'); + assert.match(await wizard.getInputBoxTitle(), /9\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('10/10'); + assert.match(await wizard.getInputBoxTitle(), /10\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('9/10'); + assert.match(await wizard.getInputBoxTitle(), /9\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('8/10'); + assert.match(await wizard.getInputBoxTitle(), /8\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('7/10'); + assert.match(await wizard.getInputBoxTitle(), /7\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('6/10'); + assert.match(await wizard.getInputBoxTitle(), /6\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('5/10'); + assert.match(await wizard.getInputBoxTitle(), /5\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('4/10'); + assert.match(await wizard.getInputBoxTitle(), /4\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('3/10'); + assert.match(await wizard.getInputBoxTitle(), /3\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('2/10'); + assert.match(await wizard.getInputBoxTitle(), /2\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('1/10'); - expect(await wizard.getBackButton()).to.not.be.ok; + assert.match(await wizard.getInputBoxTitle(), /1\/10/); + assert.equal(await wizard.getBackButton(), undefined); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('2/10'); + assert.match(await wizard.getInputBoxTitle(), /2\/10/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('1/10'); - expect(await wizard.getBackButton()).to.not.be.ok; + assert.match(await wizard.getInputBoxTitle(), /1\/10/); + assert.equal(await wizard.getBackButton(), undefined); await wizard.cancel(); }); @@ -217,43 +215,43 @@ describe('Project generation tests', function () { it('should have correct step value when starter code skipped', async function () { this.timeout(60000); const wizard: ProjectGenerationWizard = await ProjectGenerationWizard.openWizard(driver); - expect(await wizard.getInputBoxTitle()).to.have.string('1/10'); - expect(await wizard.getBackButton()).to.not.be.ok; + assert.match(await wizard.getInputBoxTitle(), /1\/10/); + assert.equal(await wizard.getBackButton(), undefined); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('2/10'); + assert.match(await wizard.getInputBoxTitle(), /2\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('3/10'); + assert.match(await wizard.getInputBoxTitle(), /3\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('4/10'); + assert.match(await wizard.getInputBoxTitle(), /4\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('5/10'); + assert.match(await wizard.getInputBoxTitle(), /5\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('6/10'); + assert.match(await wizard.getInputBoxTitle(), /6\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('7/10'); + assert.match(await wizard.getInputBoxTitle(), /7\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('8/10'); + assert.match(await wizard.getInputBoxTitle(), /8\/10/); await wizard.focusQuickPick(1); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('9/9'); + assert.match(await wizard.getInputBoxTitle(), /9\/9/); await wizard.prev(); - expect(await wizard.getInputBoxTitle()).to.have.string('8/10'); + assert.match(await wizard.getInputBoxTitle(), /8\/10/); await wizard.focusQuickPick(0); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('9/10'); + assert.match(await wizard.getInputBoxTitle(), /9\/10/); await wizard.next(); - expect(await wizard.getInputBoxTitle()).to.have.string('10/10'); + assert.match(await wizard.getInputBoxTitle(), /10\/10/); await wizard.cancel(); }); @@ -270,27 +268,29 @@ describe('Project generation tests', function () { fs.mkdirSync(projectDestDir); - expect(await ProjectGenerationWizard.generateProject(driver, { + assert.ok(await ProjectGenerationWizard.generateProject(driver, { buildTool: 'Maven', artifactId: projectFolderName, extensions: ['Camel Core', 'Eclipse Vert.x'], dest: projectDestDir - })).to.be.true; + })); - expect(path.join(projectDestDir, projectFolderName)).to.be.a.directory().and.include.contents(['pom.xml']); + const finalFolderName = path.join(projectDestDir, projectFolderName) + assert.ok((await fs.stat(finalFolderName)).isDirectory()); + assert.ok((await fs.stat(path.join(finalFolderName, 'pom.xml'))).isFile()); const pathToPom: string = path.join(projectDestDir, projectFolderName, 'pom.xml'); const pomDependencies: any[] = (await pomToJson(pathToPom)).project.dependencies.dependency; - expect( + assert.ok( _.some(pomDependencies, { groupId: 'org.apache.camel.quarkus', artifactId: 'camel-quarkus-core' }), 'The Camel Core extension does not exist in the downloaded Maven-based Quarkus project' - ).to.be.true; + ); - expect( + assert.ok( _.some(pomDependencies, { groupId: 'io.quarkus', artifactId: 'quarkus-vertx' }), 'The Eclipse Vert.x extension does not exist in the downloaded Maven-based Quarkus project' - ).to.be.true; + ); await (new Workbench).executeCommand('Close Workspace'); return new Promise(res => setTimeout(res, 5000)); @@ -315,20 +315,22 @@ describe('Project generation tests', function () { dest: projectDestDir }); - expect(path.join(projectDestDir, projectFolderName)).to.be.a.directory().and.include.contents(['build.gradle']); + const finalFolderName = path.join(projectDestDir, projectFolderName) + assert.ok((await fs.stat(finalFolderName)).isDirectory()); + assert.ok((await fs.stat(path.join(finalFolderName, 'build.gradle'))).isFile()); const pathToBuildGradle: string = path.join(projectDestDir, projectFolderName, 'build.gradle'); const dependencies: any[] = (await buildGradleToJson(pathToBuildGradle)).dependencies; - expect( + assert.ok( _.some(dependencies, { name: '\'org.apache.camel.quarkus:camel-quarkus-core\'' }), 'The Camel Core extension does not exist in the downloaded Gradle-based Quarkus project' - ).to.be.true; + ); - expect( + assert.ok( _.some(dependencies, { name: '\'io.quarkus:quarkus-vertx\'' }), 'The Eclipse Vert.x extension does not exist in the downloaded Gradle-based Quarkus project' - ).to.be.true; + ); await (new Workbench()).executeCommand('Close Workspace'); return new Promise(res => setTimeout(res, 6000)); @@ -384,45 +386,45 @@ describe('Project generation tests', function () { const wizard: ProjectGenerationWizard = await ProjectGenerationWizard.openWizard(driver); - expect(await wizard.getNthQuickPickItemLabel(0)).equals(buildTool); + assert.equal(await wizard.getNthQuickPickItemLabel(0), buildTool); await wizard.next(); - expect(await wizard.getNthQuickPickItemLabel(0)).contains("(recommended)"); + assert.match(await wizard.getNthQuickPickItemLabel(0), /\(recommended\)/); await wizard.next(); //Skip past Java version selection await wizard.next(); const actualGroupId = await wizard.getText(); - expect(actualGroupId).equals(groupId); + assert.equal(actualGroupId, groupId); await wizard.next(); const actualArtifactId = await wizard.getText(); - expect(actualArtifactId).equals(artifactId); + assert.equal(actualArtifactId, artifactId); await wizard.next(); const actualProjectVersion = await wizard.getText(); - expect(actualProjectVersion).equals(projectVersion); + assert.equal(actualProjectVersion, projectVersion); await wizard.next(); const actualPackageName = await wizard.getText(); - expect(actualPackageName).equals(packageName); + assert.equal(actualPackageName, packageName); await wizard.next(); const actualShouldGenerateCode = await wizard.getNthQuickPickItemLabel(0); - expect(actualShouldGenerateCode).equals(shouldGenerateCode); + assert.equal(actualShouldGenerateCode, shouldGenerateCode); await wizard.focusQuickPick(0); await wizard.next(); const actualResourceName = await wizard.getText(); - expect(actualResourceName).equals(resourceName); + assert.equal(actualResourceName, resourceName); await wizard.next(); await wizard.sendKeys(Key.DOWN, Key.DOWN, Key.UP); const quickPickItemText: QuickPickItemInfo = await wizard.getNthQuickPickItemInfo(0); - expect(quickPickItemText.label).to.have.string('Last used'); - expect(quickPickItemText.detail).to.have.string('Camel Core'); - expect(quickPickItemText.detail).to.have.string('Eclipse Vert.x'); + assert.match(quickPickItemText.label, /Last used/); + assert.match(quickPickItemText.detail, /Camel Core/); + assert.match(quickPickItemText.detail, /Eclipse Vert\.x/); await wizard.cancel(); return new Promise(res => setTimeout(res, 6000)); @@ -549,7 +551,7 @@ describe('Project generation tests', function () { const allQuickPickInfo: QuickPickItemInfo[] = await wizard.getAllQuickPickInfo(); const allLabels: string[] = allQuickPickInfo.map((info) => info.label); const uniqueLabels = new Set(allLabels); - expect(allLabels.length).to.equal(uniqueLabels.size); + assert.equal(allLabels.length, uniqueLabels.size); await wizard.cancel(); }); }); @@ -592,10 +594,10 @@ async function assertValidation(type: string, input: InputBox, expectedResults: const expectedResult: ExpectedValidation = expectedResults[i]; await input.setText(expectedResult.text); if (expectedResult.errorMessage) { - expect(await input.hasError(), `Validation for ${type} at index ${i}, with text ${expectedResult.text} should be true`).to.be.true; - expect(await input.getMessage(), `Validation for ${type} at index ${i}, with error message: "${expectedResult.errorMessage}" is incorrect`).to.equal(expectedResult.errorMessage); + assert.ok(await input.hasError(), `Validation for ${type} at index ${i}, with text ${expectedResult.text} should be true`); + assert.equal(await input.getMessage(), expectedResult.errorMessage, `Validation for ${type} at index ${i}, expectedResult.errorMessage, with error message: "${expectedResult.errorMessage}" is incorrect`); } else { - expect(await input.hasError(), `Validation for ${type} at index ${i}, with text ${expectedResult.text} should be false`).to.be.false; + assert.equal(await input.hasError(), false, `Validation for ${type} at index ${i}, with text ${expectedResult.text} should be false`); } } }