Skip to content

refactor(integration-tests): migrate to chai expect over string expect#5631

Draft
lennonnikolas wants to merge 2 commits intomochajs:mainfrom
lennonnikolas:nlennon/feat/5454_migrate_to_chai
Draft

refactor(integration-tests): migrate to chai expect over string expect#5631
lennonnikolas wants to merge 2 commits intomochajs:mainfrom
lennonnikolas:nlennon/feat/5454_migrate_to_chai

Conversation

@lennonnikolas
Copy link
Copy Markdown
Contributor

PR Checklist

Overview

Start out migrating from string expect to chai expect.

@lennonnikolas
Copy link
Copy Markdown
Contributor Author

Unsure why the CI is failing... it ran perfectly fine locally. It is complaining about typescript 4.9.5 missing but we have a higher version indicated in the package.json file...

@lennonnikolas lennonnikolas marked this pull request as draft January 7, 2026 05:34
@hainenber
Copy link
Copy Markdown
Contributor

@lennonnikolas you might want to discard current changes in package-lock.json and package.json and rerun npm i -D @types/chai again.

My local change after run npm i -D @types/chai

diff --git a/package-lock.json b/package-lock.json
index 4ef9eb0d..b102f950 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -47,6 +47,7 @@
         "@rollup/plugin-multi-entry": "^7.1.0",
         "@rollup/plugin-node-resolve": "^16.0.3",
         "@test/esm-only-loader": "./test/compiler-fixtures/esm-only-loader",
+        "@types/chai": "^5.2.3",
         "@types/node": "^22.15.3",
         "@types/yargs": "^17.0.33",
         "chai": "^4.3.4",
@@ -2851,6 +2852,27 @@
         "@types/responselike": "^1.0.0"
       }
     },
+    "node_modules/@types/chai": {
+      "version": "5.2.3",
+      "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+      "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "@types/deep-eql": "*",
+        "assertion-error": "^2.0.1"
+      }
+    },
+    "node_modules/@types/chai/node_modules/assertion-error": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+      "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">=12"
+      }
+    },
     "node_modules/@types/cookie": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
@@ -2875,6 +2897,13 @@
         "@types/ms": "*"
       }
     },
+    "node_modules/@types/deep-eql": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+      "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+      "dev": true,
+      "license": "MIT"
+    },
     "node_modules/@types/eslint": {
       "version": "9.6.1",
       "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",
@@ -24078,6 +24107,24 @@
         "@types/responselike": "^1.0.0"
       }
     },
+    "@types/chai": {
+      "version": "5.2.3",
+      "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+      "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+      "dev": true,
+      "requires": {
+        "@types/deep-eql": "*",
+        "assertion-error": "^2.0.1"
+      },
+      "dependencies": {
+        "assertion-error": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+          "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+          "dev": true
+        }
+      }
+    },
     "@types/cookie": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
@@ -24102,6 +24149,12 @@
         "@types/ms": "*"
       }
     },
+    "@types/deep-eql": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+      "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+      "dev": true
+    },
     "@types/eslint": {
       "version": "9.6.1",
       "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",

chore: update package-lock.json
@lennonnikolas lennonnikolas force-pushed the nlennon/feat/5454_migrate_to_chai branch from 88dadda to d6eafad Compare January 8, 2026 04:16
@lennonnikolas
Copy link
Copy Markdown
Contributor Author

@lennonnikolas you might want to discard current changes in package-lock.json and package.json and rerun npm i -D @types/chai again.

Hi! Yeah I thought that would fix it with my original second commit. I tried it again and squashed but still the github action is complaining about a missing typescript version. npm ci still works fine on my machine.

@lennonnikolas
Copy link
Copy Markdown
Contributor Author

@mark-wiemer I have been pulling my hair out for days with this npm ci failure. The only conclusion I can come to is that me installing @types/chai for typesafety and intellisense caused a fresh dependency resolution that is exposing some issues with the current version of typescript.

When I ran npm explain typescript I got this output:

$ npm explain typescript
typescript@5.9.3 dev peer
node_modules/typescript
  dev typescript@"^5.8.3" from the root project
  peer typescript@">=5.0.4 <7" from knip@5.80.0
  node_modules/knip
    dev knip@"^5.61.3" from the root project
  peer typescript@">=4.0.0" from ts-declaration-location@1.0.7
  node_modules/ts-declaration-location
    ts-declaration-location@"^1.0.6" from eslint-plugin-n@17.23.1
    node_modules/eslint-plugin-n
      dev eslint-plugin-n@"^17.23.1" from the root project

Then I ran npm ls typescript

$ npm ls typescript
mocha@12.0.0-beta-4 C:\Users\nikolas.lennon\source\repos\mocha
├─┬ eslint-plugin-n@17.23.1
│ └─┬ ts-declaration-location@1.0.7
│   └── typescript@5.9.3 deduped
├─┬ karma-sauce-launcher@4.3.6
│ └─┬ webdriverio@7.40.0
│   ├─┬ @wdio/config@7.40.0
│   │ └─┬ @wdio/types@7.40.0
│   │   └── typescript@5.9.3 deduped invalid: "^4.6.2" from node_modules/webdriverio/node_modules/@wdio/types, "^4.6.2" from node_modules/@wdio/config/node_modules/@wdio/types     
│   ├─┬ @wdio/types@7.40.0
│   │ └── typescript@5.9.3 deduped invalid: "^4.6.2" from node_modules/webdriverio/node_modules/@wdio/types
│   ├─┬ @wdio/utils@7.40.0
│   │ └─┬ @wdio/types@7.40.0
│   │   └── typescript@5.9.3 deduped invalid: "^4.6.2" from node_modules/webdriverio/node_modules/@wdio/types, "^4.6.2" from node_modules/@wdio/config/node_modules/@wdio/types, "^4.6.2" from node_modules/@wdio/utils/node_modules/@wdio/types
│   ├─┬ devtools@7.40.0
│   │ └─┬ @wdio/types@7.40.0
│   │   └── typescript@5.9.3 deduped invalid: "^4.6.2" from node_modules/webdriverio/node_modules/@wdio/types, "^4.6.2" from node_modules/@wdio/config/node_modules/@wdio/types, "^4.6.2" from node_modules/@wdio/utils/node_modules/@wdio/types, "^4.6.2" from node_modules/devtools/node_modules/@wdio/types
│   └─┬ webdriver@7.40.0
│     └─┬ @wdio/types@7.40.0
│       └── typescript@5.9.3 deduped invalid: "^4.6.2" from node_modules/webdriverio/node_modules/@wdio/types, "^4.6.2" from node_modules/@wdio/config/node_modules/@wdio/types, "^4.6.2" from node_modules/@wdio/utils/node_modules/@wdio/types, "^4.6.2" from node_modules/devtools/node_modules/@wdio/types, "^4.6.2" from node_modules/webdriver/node_modules/@wdio/types
├─┬ knip@5.80.0
│ └── typescript@5.9.3 deduped
└── typescript@5.9.3

npm error code ELSPROBLEMS
npm error invalid: typescript@5.9.3 C:\Users\nikolas.lennon\source\repos\mocha\node_modules\typescript
npm error A complete log of this run can be found in: C:\Users\nikolas.lennon\AppData\Local\npm-cache\_logs\2026-01-10T03_59_06_736Z-debug-0.log

From what I am seeing that WebdriverIO is expecting 4.6.2 through peer dependency. When npm resolves a peer dependency range like: "typescript": "^4.6.2" it picks the highest matching version available on the registry which I guess is 4.9.5.

Is there any way you can assist with this as far as feedback?

@mark-wiemer
Copy link
Copy Markdown
Member

@lennonnikolas I certainly don't want anyone tearing their hair out! Thanks for taking a look and sharing your findings, I'll keep this one on my shortlist to come back to when I have some time. Feel free to take a break on this one, no pressure here!

@mark-wiemer mark-wiemer added the status: needs review a maintainer should (re-)review this pull request label Jan 10, 2026
@hainenber
Copy link
Copy Markdown
Contributor

@lennonnikolas your issue with WebdriverIO's Typescript when pulling chai type def dep would be resolved once Sauce Lab got removed in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs review a maintainer should (re-)review this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🛠️ Repo: Change assertion syntax from string to chain

4 participants