{"_id":"@cool-andre/screeps-server-mockup","_rev":"2-c18757811bbb6ac89d92d4cedc0c7f4c","name":"@cool-andre/screeps-server-mockup","dist-tags":{"latest":"1.5.2"},"versions":{"1.5.1":{"name":"@cool-andre/screeps-server-mockup","version":"1.5.1","license":"MIT","_id":"@cool-andre/screeps-server-mockup@1.5.1","maintainers":[{"name":"cool-andre","email":"fdlttd.fylhtq@yandex.ru"}],"homepage":"https://github.com/kvi05/screeps-server-mockup#readme","bugs":{"url":"https://github.com/kvi05/screeps-server-mockup/issues"},"dist":{"shasum":"7bb577716cd52b7963e3087db4249dfb950fcd67","tarball":"https://registry.npmjs.org/@cool-andre/screeps-server-mockup/-/screeps-server-mockup-1.5.1.tgz","fileCount":20,"integrity":"sha512-zOs4S8zAmA9gzC/pzc7ihZ0dBTwR8jM8koEcfaCmNmENwuuACKLCbbLFKdMUpMIBLmXgZ8+IX7gW7OVUvKXVYg==","signatures":[{"sig":"MEYCIQCeRkHyBXhC8jvdvqRPG4lZm4CMtpmMEA0QHOhJqJ+PXwIhAPY1l0XX0veB/Y71d2E7jdnc8I1uXoZjkZQcP8Ga93ke","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":378677},"main":"dist/src/main.js","types":"dist/src/main.d.ts","gitHead":"67f33792ddd1c62fcd67b134ce34ac773ef92e6a","scripts":{"lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","test":"npm run build && mocha dist/test --ui tdd --exit","build":"tsc","coverage":"npm run build && nyc mocha dist/test --ui tdd --exit","prepublishOnly":"npm test && npm run lint"},"_npmUser":{"name":"cool-andre","email":"fdlttd.fylhtq@yandex.ru"},"repository":{"url":"git+https://github.com/kvi05/screeps-server-mockup.git","type":"git"},"_npmVersion":"11.13.0","description":"Pre-built fork of screeps-server-mockup — no TypeScript required to install. Used by screeps-integration-tests.","directories":{},"_nodeVersion":"24.16.0","dependencies":{"lodash":"^4.17.19","screeps":"^4.3.0","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","@types/fs-extra-promise":"^1.0.8"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.0.0","mocha":"^7.0.0","eslint":"^6.8.0","typescript":"^6.0.2","@types/node":"^24.12.2","@types/mocha":"^7.0.1","npm-cli-login":"^0.1.1","eslint-plugin-import":"^2.20.0","@typescript-eslint/parser":"^2.21.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","@typescript-eslint/eslint-plugin":"^2.21.0"},"peerDependencies":{"@screeps/common":"^2.16.0","@screeps/driver":"^5.2.7","@screeps/engine":"^4.3.0"},"_npmOperationalInternal":{"tmp":"tmp/screeps-server-mockup_1.5.1_1785530469404_0.3845488681928302","host":"s3://npm-registry-packages-npm-production"}},"1.5.2":{"name":"@cool-andre/screeps-server-mockup","description":"Pre-built fork of screeps-server-mockup — no TypeScript required to install. Used by screeps-integration-tests.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/kvi05/screeps-server-mockup.git"},"version":"1.5.2","main":"dist/src/main.js","types":"dist/src/main.d.ts","scripts":{"build":"tsc","coverage":"npm run build && nyc mocha dist/test --ui tdd --exit","lint":"eslint \"src/**/*.ts\" \"test/**/*.ts\" \"utils/**/*.ts\"","prepublishOnly":"npm test && npm run lint","test":"npm run build && mocha dist/test --ui tdd --exit"},"dependencies":{"@types/fs-extra-promise":"^1.0.8","@types/lodash":"^4.14.149","@types/screeps":"^3.0.0","fs-extra-promise":"^1.0.1","lodash":"^4.17.19","screeps":"^4.3.0"},"peerDependencies":{"@screeps/common":"^2.16.0","@screeps/driver":"^5.2.7","@screeps/engine":"^4.3.0"},"devDependencies":{"@types/mocha":"^7.0.1","@types/node":"^24.12.2","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-airbnb-typescript":"^7.0.0","eslint-plugin-import":"^2.20.0","mocha":"^7.0.0","npm-cli-login":"^0.1.1","nyc":"^15.0.0","typescript":"^6.0.2"},"gitHead":"af60ffcb05975dbe257fc01194492cb0045aebb4","_id":"@cool-andre/screeps-server-mockup@1.5.2","bugs":{"url":"https://github.com/kvi05/screeps-server-mockup/issues"},"homepage":"https://github.com/kvi05/screeps-server-mockup#readme","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-Ijr8T130zmmrxWRuDiR/K+NJZadiR1I/Y9aIUIuJdnOnW9MJmtHazs99s908Fi2ClFGMAPTWSmwKpBPOW749jg==","shasum":"53e230f60681a548276153da6ea1a084fa36dc75","tarball":"https://registry.npmjs.org/@cool-andre/screeps-server-mockup/-/screeps-server-mockup-1.5.2.tgz","fileCount":20,"unpackedSize":378932,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAeQecEpK1v+9utO5NPUOoEGZalSSP5S+vAd6Qv3ISbdAiEA/h4h7pjVs8HPGjE6DDLnaX8rKyUfWX0nyW74MsbMjqQ="}]},"_npmUser":{"name":"cool-andre","email":"fdlttd.fylhtq@yandex.ru"},"directories":{},"maintainers":[{"name":"cool-andre","email":"fdlttd.fylhtq@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/screeps-server-mockup_1.5.2_1785531093431_0.01053698100578071"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-31T20:41:09.146Z","modified":"2026-07-31T20:51:33.764Z","1.5.1":"2026-07-31T20:41:09.532Z","1.5.2":"2026-07-31T20:51:33.618Z"},"bugs":{"url":"https://github.com/kvi05/screeps-server-mockup/issues"},"license":"MIT","homepage":"https://github.com/kvi05/screeps-server-mockup#readme","repository":{"type":"git","url":"git+https://github.com/kvi05/screeps-server-mockup.git"},"description":"Pre-built fork of screeps-server-mockup — no TypeScript required to install. Used by screeps-integration-tests.","maintainers":[{"name":"cool-andre","email":"fdlttd.fylhtq@yandex.ru"}],"readme":"# @cool-andre/screeps-server-mockup\r\n\r\n[![npm version](https://img.shields.io/npm/v/@cool-andre/screeps-server-mockup?color=blue)](https://www.npmjs.com/package/@cool-andre/screeps-server-mockup)\r\n[![node](https://img.shields.io/badge/node-%E2%89%A524-brightgreen.svg)](https://nodejs.org/)\r\n\r\n> Pre-built fork of [screepers/screeps-server-mockup](https://github.com/screepers/screeps-server-mockup)\r\n> at commit `703645f`.\r\n\r\n## Why this fork\r\n\r\nThis fork is published as a **pre-built npm package** — the `prepare` script has\r\nbeen removed so that downstream consumers (specifically\r\n[`screeps-integration-tests`](https://github.com/kvi05/screeps-integration-tests))\r\ndo **not** require TypeScript to install.\r\n\r\n**Differences from upstream:**\r\n- `prepare` script removed — no `tsc` at install time\r\n- `dist/` included in the published package — pre-compiled JavaScript\r\n- Package name: `@cool-andre/screeps-server-mockup` (scoped)\r\n- Repository: <https://github.com/kvi05/screeps-server-mockup>\r\n\r\nEverything else is identical to upstream at the pinned commit.\r\n\r\n---\r\n\r\n_Based on https://github.com/screepers/screeps-server-test_\r\n\r\n\r\n## Private server package for unit tests\r\n\r\nThis is a project that runs the screeps private server one tick at a time, allowing to easily check\r\ndata in between ticks and opens the possibilities for automatic testings in a reproductible\r\nenvironment.\r\n\r\n\r\n## Requirements\r\n\r\nThese are necessary to build the internal [Screeps](https://github.com/screeps/screeps) server.\r\n\r\n * Node.js 24 LTS or higher\r\n * Python (for node-gyp)\r\n * Build tools (`apt install build-essential` for Ubuntu, [Visual Studio](https://www.visualstudio.com/vs/) for Windows, etc)\r\n\r\n## Usage\r\n\r\n1. Install via npm or yarn\r\n2. Write a test script (see `examples` and `tests` folders for details)\r\n3. Run the test script\r\n\r\n\r\n## Script example (simple)\r\n\r\n``` javascript\r\nconst _ = require('lodash');\r\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\r\n\r\n// Initialize server\r\nconst server = new ScreepsServer();\r\nawait server.world.reset();     // reset world but add invaders and source keepers users\r\nawait server.world.stubWorld(); // create a stub world composed of 9 rooms with sources and controller\r\n\r\n// Add a bot in W0N1\r\nconst modules = {\r\n    main: `module.exports.loop = function() {\r\n        console.log('Tick!',Game.time);\r\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\r\n        _.sample(Game.spawns).createCreep([MOVE]);\r\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\r\n    };`\r\n};\r\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 15, y: 15, modules });\r\n\r\n// Start server and run a tick\r\nawait server.start();\r\nawait server.tick();\r\n```\r\n\r\n\r\n## Script example (complete)\r\n\r\n``` javascript\r\nconst _ = require('lodash');\r\nconst { ScreepsServer, TerrainMatrix } = require('screeps-server-mockup');\r\n\r\n// Initialize server\r\nconst server = new ScreepsServer();\r\nawait server.world.reset(); // reset world but add invaders and source keepers users\r\n\r\n// Prepare the terrain for a new room\r\nconst terrain = new TerrainMatrix();\r\nconst walls = [[10, 10], [10, 40], [40, 10], [40, 40]];\r\n_.each(walls, ([x, y]) => terrain.set(x, y, 'wall'));\r\n\r\n// Create a new room with terrain and basic objects\r\nawait server.world.addRoom('W0N1');\r\nawait server.world.setTerrain('W0N1', terrain);\r\nawait server.world.addRoomObject('W0N1', 'controller', 10, 10, { level: 0 });\r\nawait server.world.addRoomObject('W0N1', 'source', 10, 40, { energy: 1000, energyCapacity: 1000, ticksToRegeneration: 300 });\r\nawait server.world.addRoomObject('W0N1', 'mineral', 40, 40, { mineralType: 'H', density: 3, mineralAmount: 3000 });\r\n\r\n// Add a bot in W0N1\r\nconst modules = {\r\n    main: `module.exports.loop = function() {\r\n        console.log('Tick!',Game.time);\r\n        const directions = [TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT];\r\n        _.sample(Game.spawns).createCreep([MOVE]);\r\n        _.each(Game.creeps, c => c.move(_.sample(directions)));\r\n    };`\r\n};\r\nconst bot = await server.world.addBot({ username: 'bot', room: 'W0N1', x: 25, y: 25, modules });\r\n\r\n// Print console logs every tick\r\nbot.on('console', (logs, results, userid, username) => {\r\n    _.each(logs, line => console.log(`[console|${username}]`, line));\r\n});\r\n\r\n// Start server and run several ticks\r\nawait server.start();\r\nfor (let i = 0; i < 10; i++) {\r\n    console.log('[tick]', await server.world.gameTime);\r\n    await server.tick();\r\n    _.each(await bot.newNotifications, ({ message }) => console.log('[notification]', message));\r\n    console.log('[memory]', await bot.memory, '\\n');\r\n}\r\n\r\n// Stop server and disconnect storage\r\nserver.stop();\r\nprocess.exit(); // required as there is no way to properly shutdown storage :(\r\n```\r\n\r\nEach tick should output something like:\r\n\r\n>[tick] 1\r\n\r\n>[console|bot] Tick! 1\r\n\r\n>[memory] {\"creeps\":{\"Arianna\":{}}}\r\n\r\n\r\n## Tests\r\n\r\n```\r\nyarn lint // or npm run lint\r\nyarn test // or npm run test\r\n```\r\n","readmeFilename":"README.md"}