Skip to content

Commit a570577

Browse files
committed
fix: restore test assertions and add hanbi type declarations
- Restore dev-server-rollup test files to master versions: the sed import rewrite incorrectly changed assertion strings like "import moduleA from './module-a-stub.js'" to use .ts extensions. Only actual import statements should use .ts extensions. - Add hanbi.d.ts ambient declarations for packages that use hanbi in tests (dev-server-core, dev-server-hmr, dev-server-import-maps, test-runner-core). With module:nodenext, untyped CJS modules need explicit declarations. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 59e04ae commit a570577

9 files changed

Lines changed: 12 additions & 8 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module 'hanbi';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module 'hanbi';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module 'hanbi';

packages/dev-server-rollup/test/node/plugins/alias.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('@rollup/plugin-alias', () => {
1919

2020
try {
2121
const text = await fetchText(`${host}/app.js`);
22-
expectIncludes(text, "import moduleA from './module-a-stub.ts'");
22+
expectIncludes(text, "import moduleA from './module-a-stub.js'");
2323
} finally {
2424
server.stop();
2525
}

packages/dev-server-rollup/test/node/plugins/node-resolve.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('@rollup/plugin-node-resolve', () => {
1717

1818
try {
1919
const text = await fetchText(`${host}/app.js`);
20-
expectIncludes(text, "import moduleA from './node_modules/module-a/index.ts'");
20+
expectIncludes(text, "import moduleA from './node_modules/module-a/index.js'");
2121
} finally {
2222
server.stop();
2323
}

packages/dev-server-rollup/test/node/plugins/postcss.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ html {
4949
expectIncludes(text, 'export default');
5050
expectIncludes(
5151
text,
52-
"import styleInject from './node_modules/style-inject/dist/style-inject.es.ts';",
52+
"import styleInject from './node_modules/style-inject/dist/style-inject.es.js';",
5353
);
5454
expectIncludes(text, 'styleInject(css_248z);');
5555
} finally {

packages/dev-server-rollup/test/node/rollupBundlePlugin.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ describe('rollupBundlePlugin', () => {
4747

4848
try {
4949
const textA1 = await fetchText(`${host}/a1.js`);
50-
expectIncludes(textA1, "import { b as bc, d } from './__rollup-generated__d.ts';");
50+
expectIncludes(textA1, "import { b as bc, d } from './__rollup-generated__d.js';");
5151
expectIncludes(textA1, 'var a1 = `a ${bc} ${d}`;');
5252
expectIncludes(textA1, 'export { a1 as default };');
5353

5454
const textA2 = await fetchText(`${host}/a2.js`);
55-
expectIncludes(textA2, "import { b as bc, d } from './__rollup-generated__d.ts';");
55+
expectIncludes(textA2, "import { b as bc, d } from './__rollup-generated__d.js';");
5656
expectIncludes(textA2, 'var a2 = `a ${bc} ${d}`;');
5757
expectIncludes(textA2, 'export { a2 as default };');
5858

5959
const textA3 = await fetchText(`${host}/a3.js`);
60-
expectIncludes(textA3, "import { b as bc, d } from './__rollup-generated__d.ts';");
60+
expectIncludes(textA3, "import { b as bc, d } from './__rollup-generated__d.js';");
6161
expectIncludes(textA3, 'var a3 = `a ${bc} ${d}`;');
6262
expectIncludes(textA3, 'export { a3 as default };');
6363

@@ -85,7 +85,7 @@ describe('rollupBundlePlugin', () => {
8585

8686
try {
8787
const text = await fetchText(`${host}/not-bundled.js`);
88-
expectIncludes(text, "import a from './a.ts';");
88+
expectIncludes(text, "import a from './a.js';");
8989
expectIncludes(text, 'export default `not bundled ${a}`;');
9090
} finally {
9191
server.stop();

packages/dev-server-rollup/test/node/unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('@web/dev-server-rollup', () => {
7777

7878
try {
7979
const text = await fetchText(`${host}/app.js`);
80-
expectIncludes(text, "import moduleA from './src/foo.ts'");
80+
expectIncludes(text, "import moduleA from './src/foo.js'");
8181
} finally {
8282
server.stop();
8383
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare module 'hanbi';

0 commit comments

Comments
 (0)