errors and warnings / stdlib / E8123
E8123 error
mock.module replaces an export the module does not have
- area
- stdlib (x8xxx)
- fails the build
- yes
mock.module replaces an export that the module doesn't have. The replacement
table is checked against the module's exports: a name the module doesn't
export is E8123, and a replacement of the wrong type is a type error. Usually
the name is misspelled, or the export was renamed.
Example
export function now(): number return GetTime()endimport test, expect from "wowlua:test"import * as mock from "wowlua:mock"import * as clock from "/clock" mock.module(clock, { today = function(): number return 0 end }) @test("reads the clock")local function reads() expect(clock.now()).toBe(0)endexport function now(): number return GetTime()endimport test, expect from "wowlua:test"import * as mock from "wowlua:mock"import * as clock from "/clock" mock.module(clock, { now = function(): number return 0 end }) @test("reads the clock")local function reads() expect(clock.now()).toBe(0)endThe compiler reports it like this:
error[E8123]: the module has no export `today` ┌─ tests/clock.test.wowlua:5:22 │ 5 │ mock.module(clock, { today = function(): number return 0 end }) │ ^^^^^ here
Related codes
| code | message |
|---|---|
| E8119 | import internal outside a test file |
Offline
$ wowlua explain E8123 E8123 (error): mock.module replaces an export the module does not have