Skip to content

Commit ac9c291

Browse files
committed
fix(dev-server-hmr): use expectIncludes/expectNotIncludes for better assertion errors
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 98555b0 commit ac9c291

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

packages/dev-server-hmr/test/HmrPlugin.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { describe, it, afterEach, mock } from 'node:test';
22
import assert from 'node:assert/strict';
3-
import { createTestServer, fetchText, expectIncludes } from '@web/dev-server-core/test-helpers';
3+
import {
4+
createTestServer,
5+
fetchText,
6+
expectIncludes,
7+
expectNotIncludes,
8+
} from '@web/dev-server-core/test-helpers';
49
import { posix as pathUtil } from 'path';
510

611
import { hmrPlugin } from '../dist/index.js';
@@ -353,7 +358,7 @@ describe('HmrPlugin', () => {
353358
try {
354359
const response = await fetch(`${host}${NAME_HMR_CLIENT_IMPORT}`);
355360
const body = await response.text();
356-
assert.ok(body.includes('class HotModule'));
361+
expectIncludes(body, 'class HotModule');
357362
} finally {
358363
await server.stop();
359364
}
@@ -377,7 +382,7 @@ describe('HmrPlugin', () => {
377382
const response = await fetch(`${host}/foo.js`);
378383
const body = await response.text();
379384

380-
assert.ok(body.includes('__WDS_HMR__'));
385+
expectIncludes(body, '__WDS_HMR__');
381386
} finally {
382387
await server.stop();
383388
}
@@ -393,7 +398,7 @@ describe('HmrPlugin', () => {
393398
const response = await fetch(`${host}/foo.js`);
394399
const body = await response.text();
395400

396-
assert.ok(!body.includes('__WDS_HMR__'));
401+
expectNotIncludes(body, '__WDS_HMR__');
397402
} finally {
398403
await server.stop();
399404
}

0 commit comments

Comments
 (0)