diff --git a/karma.conf.js b/karma.conf.js index 3d77f5789..28e4a589e 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -182,7 +182,7 @@ module.exports = (config) => { '--disable-gpu', '--no-sandbox', '--enable-precise-memory-info', - '--js-flags="--max_old_space_size=8192 --expose-gc"' + '--js-flags="--max_old_space_size=8192"' ] }, ChromiumHeadless_with_debug: { diff --git a/src/engine/Debug/DebugSystem.ts b/src/engine/Debug/DebugSystem.ts index 2462f595a..c61642a36 100644 --- a/src/engine/Debug/DebugSystem.ts +++ b/src/engine/Debug/DebugSystem.ts @@ -295,12 +295,14 @@ export class DebugSystem extends System { } postupdate(engine: Scene, elapsedMs: number): void { - this._graphicsContext.save(); - if (this._camera) { - this._camera.draw(this._graphicsContext); + if (this._engine.isDebug) { + this._graphicsContext.save(); + if (this._camera) { + this._camera.draw(this._graphicsContext); + } + Debug.flush(this._graphicsContext); + this._graphicsContext.restore(); } - Debug.flush(this._graphicsContext); - this._graphicsContext.restore(); } /** diff --git a/src/spec/DebugSpec.ts b/src/spec/DebugSpec.ts index 9ba8f35c8..5ab98c91c 100644 --- a/src/spec/DebugSpec.ts +++ b/src/spec/DebugSpec.ts @@ -9,6 +9,9 @@ describe('Debug draw static', () => { it('exists', () => { expect(ex.Debug).toBeDefined(); }); + beforeEach(() => { + ex.Debug.clear(); + }); afterEach(() => { ex.Debug.clear(); diff --git a/src/spec/util/TestUtils.ts b/src/spec/util/TestUtils.ts index e9d2092fc..968895bbd 100644 --- a/src/spec/util/TestUtils.ts +++ b/src/spec/util/TestUtils.ts @@ -20,6 +20,7 @@ export namespace TestUtils { displayMode: ex.DisplayMode.Fixed, ...options }; + ex.Debug.clear(); ex.Flags._reset(); ex.Flags.enable('suppress-obsolete-message'); flags.forEach(f => ex.Flags.enable(f));