playwright/packages/playwright-test/src
Dmitry Gozman d9f849fb14
feat(test runner): replace declare/define with "options" (#10293)
1. Fixtures defined in test.extend() can now have `{ option: true }` configuration that makes them overridable in the config. Options support all other properties of fixtures - value/function, scope, auto.
```
const test = base.extend<MyOptions>({
  foo: ['default', { option: true }],
});
```

2. test.declare() and project.define are removed.

3. project.use applies overrides to default option values and nothing else. Any test.extend() and test.use() calls take priority over config options.

Required user changes: if someone used to define fixture options with test.extend(), overriding them in config will stop working. The solution is to add `{ option: true }`.

```
// Old code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: 123,
  myFixture: ({ myOption }, use) => use(2 * myOption),
});

// New code
export const test = base.extend<{ myOption: number, myFixture: number }>({
  myOption: [123, { option: true }],
  myFixture: ({ myOption }, use) => use(2 * myOption),
});
```
2021-11-18 15:45:52 -08:00
..
matchers feat(expect): show expect timeout in the error message (#10388) 2021-11-17 17:28:30 -08:00
reporters fix(html reporter): show missing attachments as warnings (#10400) 2021-11-17 18:03:13 -08:00
third_party chore: move diff_match_patch into the test package (#9475) 2021-10-13 13:38:26 -07:00
cli.ts chore(test runner): route runner errors through Reporter.onError (#10257) 2021-11-11 16:48:08 -08:00
dispatcher.ts feat(test runner): introduce TestInfo.parallelIndex (#9762) 2021-11-01 10:37:34 -07:00
expect.ts feat(api): expose step location (#9602) 2021-10-18 21:06:18 -07:00
fixtures.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
globals.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
index.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
ipc.ts feat(test runner): introduce TestInfo.parallelIndex (#9762) 2021-11-01 10:37:34 -07:00
loader.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
profiler.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
project.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
runner.ts fix(test runner): route more errors to reporter (#10263) 2021-11-12 06:47:41 -08:00
test.ts feat(reporter): expose more apis (#9603) 2021-10-19 08:38:04 -07:00
testType.ts feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
transform.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
types.ts fix(test runner): update TestInfo.duration before running afterEach hooks (#10228) 2021-11-10 16:02:27 -08:00
util.ts feat(serial): better errors from beforeAll (#10419) 2021-11-18 14:36:55 -08:00
webServer.ts fix: support even older node 12 (#9718) 2021-10-22 15:59:52 -04:00
worker.ts chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
workerRunner.ts feat(serial): better errors from beforeAll (#10419) 2021-11-18 14:36:55 -08:00