diff --git a/package.json b/package.json index 88c2ee7..110ea26 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "test": "mocha --ui tdd --exit" }, "dependencies": { + "@screeps/common": "github:brisberg/common#no-storage-restart", "fs-extra-promise": "^1.0.1", "lodash": "^4.17.15", "screeps": "^4.1.5" diff --git a/test/basics.tests.js b/test/basics.tests.js index 730974c..7aa1a9a 100644 --- a/test/basics.tests.js +++ b/test/basics.tests.js @@ -16,6 +16,12 @@ suite('Basics tests', function () { test('Starting server and running a few ticks without error', async function () { server = new ScreepsServer(); + server.on('error', (msg) => { + console.log(`error: ${msg}`); + }); + server.on('info', (msg) => { + console.log(`info: ${msg}`); + }); await server.start(); for (let i = 0; i < 5; i += 1) { await server.tick(); @@ -32,6 +38,12 @@ suite('Basics tests', function () { mainLoopResetInterval: 10000, }; server = new ScreepsServer(opts); + server.on('error', (msg) => { + console.log(`error: ${msg}`); + }); + server.on('info', (msg) => { + console.log(`info: ${msg}`); + }); // Assert if options are correctly registered assert.equal(server.opts.path, opts.path); assert.equal(server.opts.logdir, opts.logdir); @@ -49,6 +61,12 @@ suite('Basics tests', function () { test('Running user code', async function () { // Server initialization server = new ScreepsServer(); + server.on('error', (msg) => { + console.log(`error: ${msg}`); + }); + server.on('info', (msg) => { + console.log(`info: ${msg}`); + }); await server.world.stubWorld(); // Code declaration const modules = { @@ -75,6 +93,12 @@ suite('Basics tests', function () { test('Getting current tick', async function () { // Server initialization server = new ScreepsServer(); + server.on('error', (msg) => { + console.log(`error: ${msg}`); + }); + server.on('info', (msg) => { + console.log(`info: ${msg}`); + }); await server.world.reset(); assert.equal(await server.world.gameTime, 1); // Run a few ticks and assert if tick is correct diff --git a/utils/stdhooks.js b/utils/stdhooks.js index 3cc8016..d2c9856 100644 --- a/utils/stdhooks.js +++ b/utils/stdhooks.js @@ -13,9 +13,9 @@ module.exports = { return stdout.apply(this, args); }; process.stderr.write = function (...args) { - if (args[0].match(/storage connection lost/i)) { - return 0; - } + // if (args[0].match(/storage connection lost/i)) { + // return 0; + // } return stdout.apply(this, args); }; }, diff --git a/yarn.lock b/yarn.lock index 446dd34..04c3fb7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -163,6 +163,14 @@ lodash "^3.10.1" q "^1.4.1" +"@screeps/common@github:brisberg/common#no-storage-restart": + version "2.14.0" + resolved "https://codeload.github.com/brisberg/common/tar.gz/27c09c2b5c740954c776d709d4c71346cc239ded" + dependencies: + eslint "^5.12.1" + lodash "^3.10.1" + q "^1.4.1" + "@screeps/driver@5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@screeps/driver/-/driver-5.1.0.tgz#2f36bf30998e4be83de7a342859add2dd595889e"