playwright/packages/playwright-test
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
..
src feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
types feat(test runner): replace declare/define with "options" (#10293) 2021-11-18 15:45:52 -08:00
.npmignore fix(npm): don't ship src in @playwright/test and ensure we ship cli.js in playwright-core 2021-10-22 16:15:57 -04:00
cli.js fix(monorepo): support yarn2/pnp by specifying all deps and bins (#9620) 2021-10-19 14:49:47 -04:00
index.d.ts chore: move test runner types into the playwright test package (#9472) 2021-10-14 11:55:08 +02:00
index.js fix(monorepo): explicitly list package.json exports instead of using glob patterns (#9584) 2021-10-19 12:28:02 -04:00
index.mjs chore: migrate to monorepo (#9421) 2021-10-11 16:52:17 +02:00
package.json chore: cut v1.17 (#10203) 2021-11-09 17:56:26 -08:00
README.md chore: add README's for packages (#9432) 2021-10-11 19:28:10 +02:00
reporter.d.ts chore: move test runner types into the playwright test package (#9472) 2021-10-14 11:55:08 +02:00
reporter.js feat(test-runner): export reporter api as @playwright/test/reporter (#7692) 2021-07-16 21:15:03 -07:00
reporter.mjs feat(test-runner): export reporter api as @playwright/test/reporter (#7692) 2021-07-16 21:15:03 -07:00

@playwright/test

This package contains Playwright Test. A test-runner for writing idiomatic and reliable end-to-end tests with Playwright.