Skip to content

Commit

Permalink
fix: Windows tests crash due to memory constraints (#2927)
Browse files Browse the repository at this point in the history
* fix: tests

* update appveyor node

* fix lint

* rev excalibur-jasmine

* rev excalibur-jasmine

* temporarily xit

* Attempt to xit some dubious expectAsync

* xit more dubious

* improve test memory, still need to un-xit some tests

* fix for ci

* fix for ci

* clean up boot

* Add pool to dispose and fix default

* xit the memory killing batch rendering tests

* remove errant fdescribe

* add xit tests back
  • Loading branch information
eonarheim authored Feb 8, 2024
1 parent 85a7e9c commit a18ad6a
Show file tree
Hide file tree
Showing 54 changed files with 649 additions and 267 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ init:
# What combinations to test
environment:
matrix:
- nodejs_version: '16'
- nodejs_version: '20'
platform:
- x64
install:
Expand Down
50 changes: 44 additions & 6 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ const webpack = require('webpack');
process.env.CHROMIUM_BIN = require('puppeteer').executablePath();
process.env.CHROME_BIN = require('puppeteer').executablePath();

console.log('Chromium', process.env.CHROMIUM_BIN);

const isAppveyor = process.env.APPVEYOR_BUILD_NUMBER ? true : false;
const karmaJasmineSeedReporter = function(baseReporterDecorator) {
const KarmaJasmineSeedReporter = function(baseReporterDecorator) {
baseReporterDecorator(this);

this.onBrowserComplete = function(browser, result) {
Expand All @@ -20,8 +22,35 @@ const karmaJasmineSeedReporter = function(baseReporterDecorator) {
};

const seedReporter = {
'reporter:jasmine-seed': ['type', karmaJasmineSeedReporter] // 1. 'jasmine-seed' is a name that can be referenced in karma.conf.js
'reporter:jasmine-seed': ['type', KarmaJasmineSeedReporter], // 1. 'jasmine-seed' is a name that can be referenced in karma.conf.js
};

const SlowSpecsReporter = function(baseReporterDecorator) {
baseReporterDecorator(this);
let slowSpecs = [];
this.specSuccess = this.specFailure = function (browser, result) {
const seconds = (result.time) / 1000;
slowSpecs.push({
time: result.time,
name: result.fullName,
message:`Spec ${result.fullName} took ${seconds} seconds\n`
});
};

this.onBrowserComplete = function(browser, result) {
this.write('\n')
slowSpecs.sort((a, b) => {
return b.time - a.time;
})
for (const spec of slowSpecs.slice(0, 20)) {
this.write(spec.message);
}
slowSpecs.length = 0;
};
};
const timingReporter = {
'reporter:jasmine-slow': ['type', SlowSpecsReporter], // 1.
}

module.exports = (config) => {
config.set({
Expand All @@ -32,7 +61,9 @@ module.exports = (config) => {
require('karma-webpack'),
require('karma-chrome-launcher'),
require('karma-coverage-istanbul-reporter'),
seedReporter
require('karma-spec-reporter'),
seedReporter,
timingReporter
],
client: {
// Excalibur logs / console logs suppressed when captureConsole = false;
Expand Down Expand Up @@ -120,7 +151,7 @@ module.exports = (config) => {
// i. e.
stats: 'normal'
},
reporters: ['progress', 'coverage-istanbul', 'jasmine-seed'],
reporters: ['progress', /*'spec'*/, 'coverage-istanbul','jasmine-seed', 'jasmine-slow'],
coverageReporter: {
reporters: [
{ type: 'html', dir: 'coverage/' },
Expand All @@ -145,15 +176,22 @@ module.exports = (config) => {
},
ChromiumHeadless_with_audio: {
base: 'ChromiumHeadless',
flags: ['--autoplay-policy=no-user-gesture-required', '--mute-audio', '--disable-gpu', '--no-sandbox']
flags: [
'--autoplay-policy=no-user-gesture-required',
'--mute-audio',
'--disable-gpu',
'--no-sandbox',
'--enable-precise-memory-info',
'--js-flags="--max_old_space_size=8192 --expose-gc"'
]
},
ChromiumHeadless_with_debug: {
base: 'ChromiumHeadless',
flags: ['--remote-debugging-port=9334', '--no-sandbox', '--disable-web-security']
},
Chromium_with_debug: {
base: 'Chromium',
flags: ['--remote-debugging-port=9334', '--no-sandbox']
flags: ['--remote-debugging-address=0.0.0.0', '--remote-debugging-port=9222', '--disable-web-security', '--mute-audio', '--no-sandbox']
}
}
});
Expand Down
153 changes: 138 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jsdoc": "46.10.1",
"eslint-plugin-storybook": "0.6.15",
"excalibur-jasmine": "0.2.0",
"excalibur-jasmine": "0.3.2",
"istanbul": "0.4.5",
"istanbul-instrumenter-loader": "3.0.1",
"jasmine": "5.1.0",
Expand All @@ -99,6 +99,7 @@
"karma-coverage": "2.2.1",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.1.0",
"karma-spec-reporter": "0.0.36",
"karma-summary-reporter": "3.1.1",
"karma-webpack": "5.0.1",
"puppeteer": "15.5.0",
Expand Down
8 changes: 7 additions & 1 deletion sandbox/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,16 @@ var emitter = new ex.ParticleEmitter({
acceleration: new ex.Vector(0, 460),
beginColor: ex.Color.Red,
endColor: ex.Color.Yellow,
// particleSprite: blockSpriteLegacy,
particleSprite: blockSprite,
particleRotationalVelocity: Math.PI / 10,
randomRotation: true
});
const original = (ex.ParticleEmitter.prototype as any)._createParticle;
(ex.ParticleEmitter.prototype as any)._createParticle = function () {
const particle = original.call(this);
particle.graphics.onPostDraw = () => {};
return particle;
}
game.add(emitter);

var exploding = false;
Expand Down
Loading

0 comments on commit a18ad6a

Please sign in to comment.