Skip to content

Commit

Permalink
Merge pull request #1556 from glimmerjs/fix-tests
Browse files Browse the repository at this point in the history
Restore test harness on CI
  • Loading branch information
chancancode committed Feb 2, 2024
2 parents e813777 + 76b75a4 commit dc76897
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 27 deletions.
44 changes: 25 additions & 19 deletions bin/run-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,31 @@ const browser = await puppeteer.launch({

console.log('[ci] puppeteer launched');

await /** @type {Promise<void>} */ (
// eslint-disable-next-line no-async-promise-executor
new Promise(async (fulfill) => {
const page = await browser.newPage();

page.on('console', (msg) => {
const location = msg.location();
const text = msg.text();

if (location.url?.includes(`/qunit.js`)) {
console.log(text);
} else if (text === `[HARNESS] done`) {
fulfill();
}
});

await page.goto('http://localhost:60173?hidepassed&ci');
})
);
try {
await /** @type {Promise<void>} */ (
new Promise(async (fulfill, reject) => {
const page = await browser.newPage();

page.on('console', (msg) => {
const location = msg.location();
const text = msg.text();

if (location.url?.includes(`/qunit.js`)) {
console.log(text);
} else if (text === `[HARNESS] done`) {
fulfill();
} else if (text === `[HARNESS] fail`) {
reject();
}
});

await page.goto('http://localhost:60173?hidepassed&ci');
})
);
} catch {
await browser.close();
process.exit(1);
}

await browser.close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ export async function setupQunit() {
qunit.moduleDone(pause);
}

qunit.done(() => {
console.log('[HARNESS] done');
qunit.done(({ failed }) => {
if (failed > 0) {
console.log('[HARNESS] fail');
} else {
console.log('[HARNESS] done');
}
});

return {
Expand Down
12 changes: 6 additions & 6 deletions packages/@glimmer/validator/lib/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,19 @@ class MonomorphicTagImpl<T extends MonomorphicTagId = MonomorphicTagId> {

if (subtag !== null) {
if (Array.isArray(subtag)) {
revision = subtag.reduce((prev, currentTag: Tag) => {
let current = currentTag[COMPUTE]();
return current > prev ? current : prev;
}, revision);
for (const tag of subtag) {
let value = tag[COMPUTE]();
revision = Math.max(value, revision);
}
} else {
let subtagValue = subtag[COMPUTE]();

if (subtagValue === this.subtagBufferCache) {
revision = revision > this.lastValue ? revision : this.lastValue;
revision = Math.max(revision, this.lastValue);
} else {
// Clear the temporary buffer cache
this.subtagBufferCache = null;
revision = revision > subtagValue ? revision : subtagValue;
revision = Math.max(revision, subtagValue);
}
}
}
Expand Down

0 comments on commit dc76897

Please sign in to comment.