@lpsmods/minecraft-server-ui-mock
v0.1.0
Published
@minecraft/server-ui mocks for testing.
Downloads
46
Maintainers
Readme
@lpsmods/minecraft-server-ui-mock
Emulates the @minecraft/server-ui package for testing.
What is this?
This package provides a mocked version of @minecraft/server-ui for testing. It helps you run unit tests without needing the real Minecraft Bedrock scripting environment.
Using with Vitest
Install the mock package as a dev dependency:
npm install -D @lpsmods/minecraft-server-mock @lpsmods/minecraft-server-ui-mockThen alias @minecraft/server-ui in your vitest.config.ts:
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
globals: true,
server: {
deps: {
inline: ["@minecraft/math"],
},
},
},
resolve: {
alias: {
"@minecraft/server": "@lpsmods/minecraft-server-mock",
"@minecraft/server-ui": "@lpsmods/minecraft-server-ui-mock",
},
},
});Now your source code can keep importing from @minecraft/server-ui, and when running tests, Vitest will automatically redirect those imports to this mock package.
Not associated with or approved by Mojang Studios or Microsoft
