Skip to content

Commit 03cbb48

Browse files
committed
fix: test result serialization with immutable or unserializable errors
1 parent aadcbea commit 03cbb48

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

integration/test-runner/tests/test-failure/browser-tests/fail-readonly-actual.test.js

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { expect } from '../../../../../node_modules/@esm-bundle/chai/esm/chai.js';
2+
3+
xit('readonly actual', function() {
4+
const fixture = Object.freeze({x: {}});
5+
expect(fixture).to.equal(null);
6+
})
7+
8+
it('symbol actual', function() {
9+
const fixture = Symbol('foo');
10+
expect(fixture).to.equal(null);
11+
})
12+
13+
it('globalThis actual', function() {
14+
const fixture = globalThis;
15+
expect(fixture).to.equal(null);
16+
})
17+
18+
it('HTMLElement actual', function() {
19+
const fixture = document.createElement('div');
20+
expect(fixture).to.equal(null);
21+
})

integration/test-runner/tests/test-failure/runTestFailureTest.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,18 @@ export function runTestFailureTest(
209209
}
210210
});
211211

212-
it('handles tests that error with a readonly actual', () => {
213-
const sessions = allSessions.filter(s => s.testFile.endsWith('fail-readonly-actual.test.js'));
212+
it('handles tests that error with an immutable or unserializable actual', () => {
213+
const sessions = allSessions.filter(s => s.testFile.endsWith('fail-unserializable-actual.test.js'));
214214
expect(sessions.length === browserCount).to.equal(true);
215215
for (const session of sessions) {
216-
expect(session.testResults!.tests.map(t => t.name)).to.eql(['readonly actual']);
216+
expect(session.testResults!.tests.map(t => t.name)).to.eql(['unserializable actual']);
217217
expect(session.passed).to.be.false;
218218
expect(session.testResults!.tests![0].error!.message).to.equal(
219219
'expected { x: {} } to equal null',
220220
);
221+
expect(session.testResults!.tests![1].error!.message).to.equal(
222+
'expected { x: {} } to equal null',
223+
);
221224
}
222225
});
223226
});

0 commit comments

Comments
 (0)