This commit is contained in:
Mathias Leppich 2024-05-22 08:56:24 +02:00
parent 86422bb6d7
commit 23d755d104
6 changed files with 5 additions and 16 deletions

View file

@ -112,12 +112,6 @@ Base directory for all relative paths used in the reporters.
See [`property: TestConfig.shard`].
## property: FullConfig.shardingSeed
* since: ???
- type: <[null]|[string]>
See [`property: TestConfig.shardingSeed`].
## property: FullConfig.updateSnapshots
* since: v1.10
- type: <[UpdateSnapshots]<"all"|"none"|"missing">>

View file

@ -478,7 +478,7 @@ export default defineConfig({
## property: TestConfig.shardingSeed
* since: ???
* since: v1.45
- type: ?<[string]>
Shuffle the order of test groups with a seed. By default tests are run in the order they are discovered, which is mostly alphabetical. This could lead to an uneven distribution of slow and fast tests. Shuffling the order of tests in a deterministic way can help to distribute the load more evenly.

View file

@ -55,6 +55,7 @@ export class FullConfigInternal {
cliFailOnFlakyTests?: boolean;
testIdMatcher?: Matcher;
defineConfigWasUsed = false;
shardingSeed: string | null;
constructor(location: ConfigLocation, userConfig: Config, configCLIOverrides: ConfigCLIOverrides) {
if (configCLIOverrides.projects && userConfig.projects)
@ -87,12 +88,12 @@ export class FullConfigInternal {
quiet: takeFirst(configCLIOverrides.quiet, userConfig.quiet, false),
projects: [],
shard: takeFirst(configCLIOverrides.shard, userConfig.shard, null),
shardingSeed: takeFirst(configCLIOverrides.shardingSeed, userConfig.shardingSeed, null),
updateSnapshots: takeFirst(configCLIOverrides.updateSnapshots, userConfig.updateSnapshots, 'missing'),
version: require('../../package.json').version,
workers: 0,
webServer: null,
};
this.shardingSeed = takeFirst(configCLIOverrides.shardingSeed, userConfig.shardingSeed, null);
for (const key in userConfig) {
if (key.startsWith('@'))
(this.config as any)[key] = (userConfig as any)[key];

View file

@ -595,7 +595,6 @@ export const baseFullConfig: reporterTypes.FullConfig = {
rootDir: '',
quiet: false,
shard: null,
shardingSeed: null,
updateSnapshots: 'missing',
version: '',
workers: 0,

View file

@ -182,8 +182,8 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
for (const projectSuite of rootSuite.suites)
testGroups.push(...createTestGroups(projectSuite, config.config.workers));
if (config.config.shardingSeed)
shuffleWithSeed(testGroups, config.config.shardingSeed);
if (config.shardingSeed)
shuffleWithSeed(testGroups, config.shardingSeed);
// Shard test groups.
const testGroupsInThisShard = filterForShard(config.config.shard, testGroups);

View file

@ -1806,11 +1806,6 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
current: number;
};
/**
* See [testConfig.shardingSeed](https://playwright.dev/docs/api/class-testconfig#test-config-sharding-seed).
*/
shardingSeed: null|string;
/**
* See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots).
*/