Skip to content

Commit f0440fc

Browse files
DavertMikclaude
andcommitted
fix(ci): npm link codeceptjs in CI; drop dead joi types reference
* `@codeceptjs/configure` and `@codeceptjs/expect-helper` both do `require('codeceptjs')` from inside their own packages. End users installing codeceptjs into a project's node_modules resolve fine — but in this repo (where the project IS codeceptjs) Node has nothing at node_modules/codeceptjs to resolve to, so those imports throw and helper/plugin loading fails on every CI run. Add `npm link && npm link codeceptjs` after install in playwright/puppeteer/webdriver/ plugin/dtslint/test workflows. Documented in CLAUDE.md. * `lib/plugin/browser.js`: route through `setBrowserConfig` from `@codeceptjs/configure` instead of duplicating the helper-mutation logic inline. The configure dep is the right primitive — removing the duplicate, single source of truth. * `typings/index.d.ts`: drop `/// <reference types="joi" />`. joi is not used in any public type, the directive was leftover from a prior incarnation, and it broke `dtslint` (which looks for `@types/joi`, doesn't exist) and the def-runner test (failed-resolution alignment produced an undefined `resolutionDiagnostics` access in newer TS). * Docs: `docs/configuration.md` setCommonPlugins table aligned with 4.x plugin set (no eachElement, pauseOn instead of pauseOnFail); `docs/plugins.md` regen with aiTrace section. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent bb1312d commit f0440fc

11 files changed

Lines changed: 141 additions & 256 deletions

File tree

.github/workflows/dtslint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@ jobs:
2828
env:
2929
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3030
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
31+
# @codeceptjs/configure & @codeceptjs/expect-helper do `require('codeceptjs')`;
32+
# in this repo (where the project IS codeceptjs) Node has nothing at
33+
# node_modules/codeceptjs to resolve to. `npm link` fills the gap.
34+
# End users don't need this.
35+
- run: npm link && npm link codeceptjs
3136
- run: npm run def
3237
- run: npm run dtslint

.github/workflows/playwright.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
npm i --force
4141
env:
4242
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
43+
# @codeceptjs/configure & @codeceptjs/expect-helper do `require('codeceptjs')`;
44+
# in this repo (where the project IS codeceptjs) Node has nothing at
45+
# node_modules/codeceptjs to resolve to. `npm link` fills the gap.
46+
# End users don't need this.
47+
- run: npm link && npm link codeceptjs
4348
- name: Allow Release info Change
4449
run: |
4550
sudo apt-get update --allow-releaseinfo-change

.github/workflows/plugin.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
npm i --force
4141
env:
4242
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
43+
# @codeceptjs/configure & @codeceptjs/expect-helper do `require('codeceptjs')`;
44+
# in this repo (where the project IS codeceptjs) Node has nothing at
45+
# node_modules/codeceptjs to resolve to. `npm link` fills the gap.
46+
# End users don't need this.
47+
- run: npm link && npm link codeceptjs
4348
- name: Allow Release info Change
4449
run: |
4550
sudo apt-get update --allow-releaseinfo-change

.github/workflows/puppeteer.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
npm i --force && npm i puppeteer --force
4141
env:
4242
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
43+
# @codeceptjs/configure & @codeceptjs/expect-helper do `require('codeceptjs')`;
44+
# in this repo (where the project IS codeceptjs) Node has nothing at
45+
# node_modules/codeceptjs to resolve to. `npm link` fills the gap.
46+
# End users don't need this.
47+
- run: npm link && npm link codeceptjs
4348
- name: Start mock server
4449
run: nohup npm run mock-server:start &
4550
- name: Wait for mock server

.github/workflows/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ jobs:
3232
env:
3333
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
3434
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
35+
# @codeceptjs/configure does `import 'codeceptjs'`; in this repo (where
36+
# the project IS codeceptjs) Node has nothing at node_modules/codeceptjs
37+
# to resolve to. `npm link` fills in that gap so configure shares our
38+
# Config singleton. End users don't need this — they install codeceptjs
39+
# into their project's node_modules normally.
40+
- run: npm link && npm link codeceptjs
3541
- name: Start mock server
3642
run: nohup npm run mock-server:start &
3743
- name: Wait for mock server
@@ -72,6 +78,12 @@ jobs:
7278
env:
7379
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
7480
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
81+
# @codeceptjs/configure does `import 'codeceptjs'`; in this repo (where
82+
# the project IS codeceptjs) Node has nothing at node_modules/codeceptjs
83+
# to resolve to. `npm link` fills in that gap so configure shares our
84+
# Config singleton. End users don't need this — they install codeceptjs
85+
# into their project's node_modules normally.
86+
- run: npm link && npm link codeceptjs
7587
- name: Start mock server
7688
run: nohup npm run mock-server:start &
7789
- name: Wait for mock server

.github/workflows/webdriver.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ jobs:
4141
env:
4242
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
4343
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
44+
# @codeceptjs/configure & @codeceptjs/expect-helper do `require('codeceptjs')`;
45+
# in this repo (where the project IS codeceptjs) Node has nothing at
46+
# node_modules/codeceptjs to resolve to. `npm link` fills the gap.
47+
# End users don't need this.
48+
- run: npm link && npm link codeceptjs
4449
- name: Start mock server
4550
run: nohup npm run mock-server:start &
4651
- name: Wait for mock server

CLAUDE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ This project is migrating from 3.x to ESM replacing all require() calls with imp
77
Each time unsure what to do refer to the same file implementation in **3.x branch**
88
3.x branch contains stable version of all core classes that work
99

10+
## Local Development Setup
11+
12+
After `npm install`, run once:
13+
14+
```
15+
npm link && npm link codeceptjs
16+
```
17+
18+
This makes `node_modules/codeceptjs` resolve back to the project root. Required because `@codeceptjs/configure` (a runtime dep) does `import 'codeceptjs'` — and in this repo the project itself IS codeceptjs, so without the link Node has nothing at `node_modules/codeceptjs` to resolve to. CI runs the same two commands automatically (see `.github/workflows/test.yml`). End users don't need this — they install codeceptjs into their own project's node_modules normally.
19+
1020
## Running Tests
1121

1222
Focus on acceptance tests:

docs/configuration.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,13 @@ setCommonPlugins()
197197
| Plugin | Default | Notes |
198198
| :----------------- | :------------- | :----------------------------------------------------------------------------- |
199199
| `retryFailedStep` | enabled | Retry steps that fail with transient errors |
200-
| `eachElement` | enabled | Provides `eachElement` effect |
201200
| `screenshotOnFail` | enabled | Capture a screenshot when a test fails |
202-
| `pauseOnFail` | registered | Activate via `-p pauseOnFail` |
201+
| `pauseOn` | registered | Pause on failure / step / file / URL — `-p pauseOn:fail`, `-p pauseOn:step`, `-p pauseOn:file:tests/login_test.js`, `-p pauseOn:url:/checkout/*` |
203202
| `browser` | registered | CLI overrides for browser helpers — `-p browser:show`, `-p browser:browser=firefox`, see [commands](/commands#browser-control) |
204203
| `aiTrace` | registered | Capture AI traces — `-p aiTrace` |
205204

205+
> `eachElement`, `tryTo`, and `retryTo` are no longer plugins in 4.x — import them from `codeceptjs/effects`.
206+
206207
## Profile
207208

208209
Using `process.env.profile` you can change the config dynamically.

0 commit comments

Comments
 (0)