v0.13.7
errors and warnings / stdlib

errors and warnings / stdlib / E8108

E8108 error

wowlua:test / wowlua:mock imported outside a test file

area
stdlib (x8xxx)
fails the build
yes

A file of the addon imports wowlua:test or wowlua:mock. These modules exist only in wowlua test's emulated client, not in the game, and test files are never part of an addon build. Move the code into a test file: a *.test.wowlua file, or a file under tests/.

Example

× failswowlua
import expect from "wowlua:test" expect(1 + 1).toBe(2)
✓ compilestests/math.test.wowluawowlua
import test, expect from "wowlua:test" @test("adds")local function adds()    expect(1 + 1).toBe(2)end

The compiler reports it like this:

error[E8108]: `wowlua:test` is only for test files
  ┌─ src/main.wowlua:1:20
  │
1 │ import expect from "wowlua:test"
  │                    ^^^^^^^^^^^^^ imported here
  │
  = help: test files are `*.test.wowlua` files and the files under `tests/`
codemessage
E8119import internal outside a test file

Offline

terminal
$ wowlua explain E8108
E8108 (error): wowlua:test / wowlua:mock imported outside a test file

source on GitHub ↗