Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions tests/e2e/allowed-hosts.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require('express');
const webpack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { createProxyMiddleware } = require('http-proxy-middleware');
const { RspackDevServer: Server } = require('@rspack/dev-server');
const config = require('../fixtures/client-config/webpack.config');
Expand All @@ -16,7 +16,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -309,7 +309,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -384,7 +384,7 @@ describe('allowed hosts', () => {
const proxyHost = IPv4;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -458,7 +458,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -535,7 +535,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -612,7 +612,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -690,7 +690,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -768,7 +768,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -846,7 +846,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -924,7 +924,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1005,7 +1005,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1083,7 +1083,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1161,7 +1161,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1239,7 +1239,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1320,7 +1320,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1398,7 +1398,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1480,7 +1480,7 @@ describe('allowed hosts', () => {
const proxyHost = devServerHost;
const proxyPort = port2;

const compiler = webpack(config);
const compiler = rspack(config);
const devServerOptions = {
client: {
webSocketURL: {
Expand Down Expand Up @@ -1562,7 +1562,7 @@ describe('allowed hosts', () => {
let consoleMessages;

beforeEach(() => {
compiler = webpack(config);
compiler = rspack(config);
pageErrors = [];
consoleMessages = [];
});
Expand Down
24 changes: 12 additions & 12 deletions tests/e2e/api.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('node:path');
const webpack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { RspackDevServer: Server } = require('@rspack/dev-server');
const config = require('../fixtures/client-config/webpack.config');
const runBrowser = require('../helpers/run-browser');
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('API', () => {
RspackDevServer: WebpackDevServer,
} = require('@rspack/dev-server');

const compiler = webpack(config);
const compiler = rspack(config);
server = new WebpackDevServer({ port }, compiler);

await server.start();
Expand All @@ -73,7 +73,7 @@ describe('API', () => {

describe('latest async API', () => {
it('should work with async API', async () => {
const compiler = webpack(config);
const compiler = rspack(config);
const server = new Server({ port }, compiler);

await server.start();
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('API', () => {
});

it('should work with callback API', async () => {
const compiler = webpack(config);
const compiler = rspack(config);
const server = new Server({ port }, compiler);

await new Promise((resolve) => {
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('API', () => {
});

it('should catch errors within startCallback', async () => {
const compiler = webpack(config);
const compiler = rspack(config);
const server = new Server(
{ port, static: 'https://absolute-url.com/somewhere' },
compiler,
Expand All @@ -172,14 +172,14 @@ describe('API', () => {
});

it('should work when using configured manually', async () => {
const compiler = webpack({
const compiler = rspack({
...config,
entry: [
'@rspack/core/hot/dev-server.js',
`@rspack/dev-server/client/index.js?hot=true&live-reload=true"`,
path.resolve(__dirname, '../fixtures/client-config/foo.js'),
],
plugins: [...config.plugins, new webpack.HotModuleReplacementPlugin()],
plugins: [...config.plugins, new rspack.HotModuleReplacementPlugin()],
});
const server = new Server({ port, hot: false, client: false }, compiler);

Expand Down Expand Up @@ -213,7 +213,7 @@ describe('API', () => {
});

it('should work and allow to rerun dev server multiple times', async () => {
const compiler = webpack(config);
const compiler = rspack(config);
const server = new Server({ port }, compiler);

await server.start();
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('API', () => {
let consoleMessages;

beforeEach(async () => {
compiler = webpack(config);
compiler = rspack(config);

({ page, browser } = await runBrowser());

Expand Down Expand Up @@ -380,7 +380,7 @@ describe('API', () => {
() =>
new Promise((resolve) => {
devServerPort = 60000 + i;
const compiler = webpack(config);
const compiler = rspack(config);
const server = new Server(
{ port: devServerPort, host: '0.0.0.0' },
compiler,
Expand Down Expand Up @@ -634,7 +634,7 @@ describe('API', () => {
'[ad42::1de2:54c2:c2fa:1234]:8080',
];

const compiler = webpack(config);
const compiler = rspack(config);
const server = new Server(options, compiler);

for (const test of tests) {
Expand All @@ -661,7 +661,7 @@ describe('API', () => {
origin: 'https://test.host',
};

const compiler = webpack(config);
const compiler = rspack(config);
const server = new Server(options, compiler);

await server.start();
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/app.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('node:fs');
const path = require('node:path');
const webpack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const wdm = require('webpack-dev-middleware');
const { RspackDevServer: Server } = require('@rspack/dev-server');
const config = require('../fixtures/client-config/webpack.config');
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('app option', () => {

describe(`should work using "${appName}" application and "${typeof server === 'function' ? 'custom server' : server}" server`, () => {
beforeEach(async () => {
compiler = webpack(config);
compiler = rspack(config);

devServer = new Server(
{
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/built-in-routes.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const webpack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { RspackDevServer: Server } = require('@rspack/dev-server');
const config = require('../fixtures/client-config/webpack.config');
const multiConfig = require('../fixtures/multi-public-path-config/webpack.config');
Expand All @@ -15,7 +15,7 @@ describe('Built in routes', () => {
let consoleMessages;

beforeEach(async () => {
compiler = webpack(config);
compiler = rspack(config);
server = new Server({ port }, compiler);

await server.start();
Expand Down Expand Up @@ -251,7 +251,7 @@ describe('Built in routes', () => {
let consoleMessages;

beforeEach(async () => {
compiler = webpack(multiConfig);
compiler = rspack(multiConfig);
server = new Server({ port }, compiler);

await server.start();
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/client-reconnect.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const webpack = require('@rspack/core');
const { rspack } = require('@rspack/core');
const { RspackDevServer: Server } = require('@rspack/dev-server');
const config = require('../fixtures/simple-config/webpack.config');
const runBrowser = require('../helpers/run-browser');
Expand All @@ -14,7 +14,7 @@ describe('client.reconnect option', () => {
let consoleMessages;

beforeEach(async () => {
compiler = webpack(config);
compiler = rspack(config);

server = new Server({ port, client: { reconnect: true } }, compiler);

Expand Down Expand Up @@ -78,7 +78,7 @@ describe('client.reconnect option', () => {
let consoleMessages;

beforeEach(async () => {
compiler = webpack(config);
compiler = rspack(config);

server = new Server({ port, client: { reconnect: false } }, compiler);

Expand Down Expand Up @@ -141,7 +141,7 @@ describe('client.reconnect option', () => {
let consoleMessages;

beforeEach(async () => {
compiler = webpack(config);
compiler = rspack(config);

server = new Server({ port, client: { reconnect: 2 } }, compiler);

Expand Down
Loading