@lpsmods/minecraft-server-mock
v0.0.2
Published
@minecraft/server mocks for testing.
Maintainers
Readme
@lpsmods/minecraft-server-mock
Emulates the @minecraft/server package for testing.
What is this?
This package provides a mocked version of @minecraft/server 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-mockThen alias @minecraft/server 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",
},
},
});Now your source code can keep importing from @minecraft/server, and when running tests, Vitest will automatically redirect those imports to this mock package.
Not associated with or approved by Mojang Studios or Microsoft
