Skip to content

Commit ad66bfc

Browse files
committed
fix: rewrite .js to .ts imports in test files
Test files import from source using .js extensions which don't resolve on Node 24 with module:nodenext. Apply the same .js -> .ts import rewrite to test files as was done for source files. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 70f5530 commit ad66bfc

60 files changed

Lines changed: 373 additions & 172 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/browser-logs/test/serialize-deserialize.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import puppeteer, { Browser, Page } from 'puppeteer';
33
import fs from 'fs';
44
import path from 'path';
55

6-
import { deserialize } from '../src/deserialize.js';
6+
import { deserialize } from '../src/deserialize.ts';
77

88
const serializeScript = fs.readFileSync(require.resolve('../dist/serialize.js'), 'utf-8');
99
const defaultOptions = { browserRootDir: __dirname, cwd: __dirname };

packages/dev-server-core/test/middleware/basePathMiddleware.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from 'chai';
22

3-
import { DevServer } from '../../src/server/DevServer.js';
4-
import { createTestServer } from '../helpers.js';
3+
import { DevServer } from '../../src/server/DevServer.ts';
4+
import { createTestServer } from '../helpers.ts';
55

66
describe('base path middleware', () => {
77
describe('without a trailing /', () => {

packages/dev-server-core/test/middleware/etagCacheMiddleware.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import path from 'path';
33
import fs from 'fs';
44
import { nanoid } from 'nanoid';
55

6-
import { createTestServer, timeout } from '../helpers.js';
7-
import { DevServer } from '../../src/server/DevServer.js';
6+
import { createTestServer, timeout } from '../helpers.ts';
7+
import { DevServer } from '../../src/server/DevServer.ts';
88

99
const fixtureDir = path.resolve(__dirname, '..', 'fixtures', 'basic');
1010
const testFileAName = '/cached-file-a.js';

packages/dev-server-core/test/middleware/pluginFileParsedMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from 'chai';
22
import { Context } from 'koa';
33

4-
import { createTestServer } from '../helpers.js';
4+
import { createTestServer } from '../helpers.ts';
55

66
describe('plugin-file-parsed middleware', () => {
77
it('is called after other plugin hooks', async () => {

packages/dev-server-core/test/middleware/pluginMimeTypeMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from 'chai';
22

3-
import { createTestServer } from '../helpers.js';
3+
import { createTestServer } from '../helpers.ts';
44

55
describe('plugin-mime-type middleware', () => {
66
it('can set the mime type of a file with a string', async () => {

packages/dev-server-core/test/middleware/pluginServeMiddleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from 'chai';
22

3-
import { createTestServer } from '../helpers.js';
3+
import { createTestServer } from '../helpers.ts';
44

55
describe('plugin-serve middleware', () => {
66
it('can serve non-existing files', async () => {

packages/dev-server-core/test/middleware/pluginTransformMiddleware.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-restricted-syntax, no-await-in-loop */
22
import { expect } from 'chai';
33

4-
import { createTestServer } from '../helpers.js';
5-
import { fetchText, expectIncludes } from '../../src/test-helpers.js';
4+
import { createTestServer } from '../helpers.ts';
5+
import { fetchText, expectIncludes } from '../../src/test-helpers.ts';
66

77
describe('plugin-transform middleware', () => {
88
it('can transform a served file', async () => {

packages/dev-server-core/test/plugins/transformModuleImportsPlugin.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { expect } from 'chai';
22

3-
import { transformImports } from '../../src/plugins/transformModuleImportsPlugin.js';
4-
import type { PluginSyntaxError } from '../../src/logger/PluginSyntaxError.js';
5-
import { createTestServer } from '../helpers.js';
3+
import { transformImports } from '../../src/plugins/transformModuleImportsPlugin.ts';
4+
import type { PluginSyntaxError } from '../../src/logger/PluginSyntaxError.ts';
5+
import { createTestServer } from '../helpers.ts';
66

77
const defaultFilePath = '/root/my-file.js';
88
const defaultResolveImport = (src: string) => `RESOLVED__${src}`;

packages/dev-server-core/test/server/DevServer.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { FSWatcher } from 'chokidar';
66
import { expect } from 'chai';
77
import portfinder from 'portfinder';
88
import { Stub, stubMethod } from 'hanbi';
9-
import { ServerStartParams } from '../../src/plugins/Plugin.js';
10-
import { DevServer } from '../../src/server/DevServer.js';
11-
import { createTestServer } from '../helpers.js';
9+
import { ServerStartParams } from '../../src/plugins/Plugin.ts';
10+
import { DevServer } from '../../src/server/DevServer.ts';
11+
import { createTestServer } from '../helpers.ts';
1212

1313
describe('basic', () => {
1414
let host: string;

packages/dev-server-core/test/web-sockets/WebSocketsManager.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { expect } from 'chai';
22
import WebSocket from 'ws';
3-
import { NAME_WEB_SOCKET_API } from '../../src/web-sockets/WebSocketsManager.js';
3+
import { NAME_WEB_SOCKET_API } from '../../src/web-sockets/WebSocketsManager.ts';
44

5-
import { createTestServer } from '../helpers.js';
5+
import { createTestServer } from '../helpers.ts';
66

77
function waitFor(fn: (resolve: () => void) => void, msg: string) {
88
return new Promise<void>((resolve, reject) => {

0 commit comments

Comments
 (0)