Skip to content

Commit 200c864

Browse files
author
DavertMik
committed
lazy load
1 parent 4ee821d commit 200c864

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@ import { use, expect, assert } from 'chai';
22
import chaiExclude from 'chai-exclude';
33
import chaiMatchPattern from 'chai-match-pattern';
44
import chaiJsonSchemaAjv from 'chai-json-schema-ajv';
5-
import { output } from 'codeceptjs';
5+
6+
// CodeceptJS output module. Looked up lazily on each property access from the
7+
// in-process handle the framework registers on globalThis — this avoids a
8+
// top-level `import 'codeceptjs'`, which fails to resolve inside the codeceptjs
9+
// repo's own CI (the project IS the codeceptjs package).
10+
const output = new Proxy({}, {
11+
get(_, key) {
12+
const o = globalThis.codeceptjs?.output
13+
if (!o) throw new Error('CodeceptJS output module not available — make sure the test is running through the CodeceptJS runner.')
14+
const v = o[key]
15+
return typeof v === 'function' ? v.bind(o) : v
16+
}
17+
});
618

719
use(chaiExclude);
820
use(chaiMatchPattern);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codeceptjs/expect-helper",
3-
"version": "4.0.0-beta.3",
3+
"version": "4.0.0-beta.5",
44
"description": "Expect helper for CodeceptJS (ESM, CodeceptJS 4.x)",
55
"type": "module",
66
"types": "index.d.ts",

0 commit comments

Comments
 (0)