Commit 5a3be25
test: install framework registry once via mocha require, drop per-test setup
Same idea as codeceptjs's own \`config.require\` option: list a setup
script in mocha's config and let it run once before any test. The
unit-test world is the only place that needs to fake \`globalThis.codeceptjs\`
(unit tests bypass the runner that normally installs it), so park the
five lines there and stop sprinkling them into individual test files.
- test/support/setup.mjs — was just chai.should(); now also installs
the framework registry (Config, container, event, output, recorder,
Helper) on globalThis.codeceptjs the same way lib/codecept.js does
for the live runner.
- .mocharc.mjs → .mocharc.cjs — mocha's config auto-discovery is
inconsistent with .mocharc.mjs across CLI shapes (recursive runs picked
it up, single-file runs didn't). The CJS form auto-loads reliably
whether you point mocha at a directory or a single file. The exposed
config is unchanged: \`require\` + \`extension\`.
- test/unit/plugin/browser_test.js — drop the per-test inline
\`globalThis.codeceptjs = ...\`; setup.mjs now covers it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f4268c0 commit 5a3be25
4 files changed
Lines changed: 23 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 2 | | |
| 3 | + | |
14 | 4 | | |
15 | 5 | | |
16 | 6 | | |
| |||
0 commit comments