Skip to content

Latest commit

 

History

History
 
 

e2e

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@rsbuild/e2e

This folder contains the e2e test cases of Rsbuild.

Tech Stack

Commands

# Run all test cases, including Rspack and Webpack
pnpm run test

# Run test cases for Rspack
pnpm run test:rspack

# Run test cases for Webpack
pnpm run test:webpack

# Run specific test case, such as "css"
pnpm run test:webpack css
pnpm run test:rspack css

Add Test Cases

Add test cases for common capabilities

Test cases added using the test method will run in webpack and Rspack.

import { expect, test } from '@playwright/test';
// will passed in webpack, and rspack
test('test 1 + 1', () => {
  expect(1 + 1).toBe(2);
});

If the capability corresponding to the test case is not yet supported in other bundlers, you can use the webpackOnlyTest or rspackOnlyTest methods for testing. Once other bundlers also support it, you can replace it with the test method.

import { webpackOnlyTest } from '@scripts/helper';
// will passed in webpack, and skipped in rspack
webpackOnlyTest('test 1 + 1', () => {
  expect(1 + 1).toBe(2);
});

Add test cases for a bundler's unique capability

If you want to add test cases for a bundler's unique capability and do not need to be supported by other bundlers, such as tools.webpack or tools.webpackChain, you can add the infix .webpack or .rspack to the file name, for example, index.webpack.test.ts.