2021-07-22 11:01:18 -07:00
# class: WorkerInfo
2022-07-05 16:24:50 -08:00
* since: v1.10
2021-07-22 11:01:18 -07:00
* langs: js
`WorkerInfo` contains information about the worker that is running tests. It is available to [`method: Test.beforeAll` ] and [`method: Test.afterAll` ] hooks and worker-scoped fixtures.
2022-06-10 16:34:31 -08:00
```js tab=js-js
2021-07-22 11:01:18 -07:00
const { test, expect } = require('@playwright/test ');
test.beforeAll(async ({ browserName }, workerInfo) => {
console.log(`Running ${browserName} in worker #${workerInfo.workerIndex}` );
});
```
2022-06-10 16:34:31 -08:00
```js tab=js-ts
2021-07-22 11:01:18 -07:00
import { test, expect } from '@playwright/test ';
test.beforeAll(async ({ browserName }, workerInfo) => {
console.log(`Running ${browserName} in worker #${workerInfo.workerIndex}` );
});
```
## property: WorkerInfo.config
2022-07-05 16:24:50 -08:00
* since: v1.10
2021-07-22 11:01:18 -07:00
- type: < [TestConfig]>
2022-03-25 19:30:45 +01:00
Processed configuration from the [configuration file ](../test-configuration.md ).
2021-07-22 11:01:18 -07:00
2021-11-01 10:37:34 -07:00
## property: WorkerInfo.parallelIndex
2022-07-05 16:24:50 -08:00
* since: v1.10
2021-11-01 10:37:34 -07:00
- type: < [int]>
The index of the worker between `0` and `workers - 1` . It is guaranteed that workers running at the same time have a different `parallelIndex` . When a worker is restarted, for example after a failure, the new worker process has the same `parallelIndex` .
2022-03-25 19:30:45 +01:00
Also available as `process.env.TEST_PARALLEL_INDEX` . Learn more about [parallelism and sharding ](../test-parallel.md ) with Playwright Test.
2021-11-01 10:37:34 -07:00
2021-07-22 11:01:18 -07:00
## property: WorkerInfo.project
2022-07-05 16:24:50 -08:00
* since: v1.10
2021-07-22 11:01:18 -07:00
- type: < [TestProject]>
2022-03-25 19:30:45 +01:00
Processed project configuration from the [configuration file ](../test-configuration.md ).
2021-07-22 11:01:18 -07:00
## property: WorkerInfo.workerIndex
2022-07-05 16:24:50 -08:00
* since: v1.10
2021-07-22 11:01:18 -07:00
- type: < [int]>
2021-11-01 10:37:34 -07:00
The unique index of the worker process that is running the test. When a worker is restarted, for example after a failure, the new worker process gets a new unique `workerIndex` .
2022-03-25 19:30:45 +01:00
Also available as `process.env.TEST_WORKER_INDEX` . Learn more about [parallelism and sharding ](../test-parallel.md ) with Playwright Test.