From 3d5d79ba0b9179ee261fa34a9fda521d56c75421 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Wed, 15 Apr 2026 15:38:00 +0200 Subject: [PATCH] Replace expect.js with node:assert/strict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit expect.js is unmaintained and unnecessary — Node's built-in assert module covers all our assertion patterns. This also removes expect.js from package.json dependencies. Made-with: Cursor --- test/package-lock.json | 6 ------ test/package.json | 1 - test/test.js | 14 +++++++------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/test/package-lock.json b/test/package-lock.json index 955e8d1..4f3f104 100644 --- a/test/package-lock.json +++ b/test/package-lock.json @@ -11,7 +11,6 @@ "dependencies": { "@eslint/js": "^9.37.0", "chromedriver": "^141.0.3", - "expect.js": "^0.3.1", "mocha": "^11.7.4", "selenium-webdriver": "^4.36.0", "superagent": "^10.2.3" @@ -719,11 +718,6 @@ "node": ">=0.10.0" } }, - "node_modules/expect.js": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz", - "integrity": "sha512-okDF/FAPEul1ZFLae4hrgpIqAeapoo5TRdcg/lD0iN9S3GWrBFIJwNezGH1DMtIz+RxU4RrFmMq7WUUvDg3J6A==" - }, "node_modules/extract-zip": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", diff --git a/test/package.json b/test/package.json index 959b3e5..8b3297f 100644 --- a/test/package.json +++ b/test/package.json @@ -11,7 +11,6 @@ "dependencies": { "@eslint/js": "^9.37.0", "chromedriver": "^141.0.3", - "expect.js": "^0.3.1", "mocha": "^11.7.4", "selenium-webdriver": "^4.36.0", "superagent": "^10.2.3" diff --git a/test/test.js b/test/test.js index 137ad93..bfcc632 100644 --- a/test/test.js +++ b/test/test.js @@ -8,7 +8,7 @@ require('chromedriver'); const execSync = require('child_process').execSync, - expect = require('expect.js'), + assert = require('node:assert/strict'), fs = require('fs'), path = require('path'), superagent = require('superagent'), @@ -51,7 +51,7 @@ describe('Application life cycle test', function () { const currentUrl = await browser.getCurrentUrl(); if (!currentUrl.includes(app.domain)) return; - expect(this.currentTest.title).to.be.a('string'); + assert.strictEqual(typeof this.currentTest.title, 'string'); const screenshotData = await browser.takeScreenshot(); fs.writeFileSync(`./screenshots/${new Date().getTime()}-${this.currentTest.title.replaceAll(' ', '_')}.png`, screenshotData, 'base64'); @@ -65,7 +65,7 @@ describe('Application life cycle test', function () { function getAppInfo() { var inspect = JSON.parse(execSync('cloudron inspect')); app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0]; - expect(app).to.be.an('object'); + assert.ok(app && typeof app === 'object'); } async function confirmLicense() { @@ -128,14 +128,14 @@ describe('Application life cycle test', function () { async function checkRedirect() { const response = await superagent.get(`https://${app.secondaryDomains[0].fqdn}`).set('User-Agent', 'Mozilla/5.0').redirects(0).ok(() => true); - expect(response.status).to.be(307); - expect(response.headers.location).to.be(`https://${app.fqdn}`); + assert.strictEqual(response.status, 307); + assert.strictEqual(response.headers.location, `https://${app.fqdn}`); } async function checkApi() { const response = await superagent.get(`https://${app.secondaryDomains[0].fqdn}`).ok(() => true); - expect(response.status).to.be(403); - expect(response.body.toString('utf8')).to.contain('AccessDenied'); + assert.strictEqual(response.status, 403); + assert.ok(response.body.toString('utf8').includes('AccessDenied')); } async function changeAdminCredentials() {