Skip to content

Commit a054d67

Browse files
authored
feat(adapter): rename config helper to createConfig (#37)
* feat(adapter): rename config helper to `createConfig` * add breaking changes file
1 parent d36972e commit a054d67

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

BREAKING_CHANGES.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Breaking Changes
2+
3+
This is a list of all breaking changes introduced in the Stencil Playwright adapter. This document is broken into two sections:
4+
5+
1. Breaking changes introduced in experimental versions (i.e. pre-1.0)
6+
2. Breaking changes introduced in major releases
7+
8+
## Experimental Releases
9+
10+
### v0.2.0
11+
12+
- `createStencilPlaywrightConfig` renamed to `createConfig`

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,26 @@ For full documentation, please see the [Playwright testing docs on the official
3131
// playwright.config.ts
3232

3333
import { expect } from '@playwright/test';
34-
import { matchers, createStencilPlaywrightConfig } from '@stencil/playwright';
34+
import { matchers, createConfig } from '@stencil/playwright';
3535

3636
expect.extend(matchers);
3737

38-
export default createStencilPlaywrightConfig();
38+
export default createConfig();
3939
```
4040

4141
1. At this point, any tests can be executed using `npx playwright test` (or by updating the project's test command in the `package.json`). By default, Playwright's test matcher
4242
is configured to run all tests matching the pattern `*.e2e.ts`. This can be changed by overriding the default matcher using the
43-
[`createStencilPlaywrightConfig()` function](#createstencilplaywrightconfigoverrides-createstencilplaywrightconfigoptions-promiseplaywrighttestconfig):
43+
[`createConfig()` function](#createconfigoverrides-createstencilplaywrightconfigoptions-promiseplaywrighttestconfig):
4444

4545
```ts
4646
// playwright.config.ts
4747

4848
import { expect } from '@playwright/test';
49-
import { matchers, createStencilPlaywrightConfig } from '@stencil/playwright';
49+
import { matchers, createConfig } from '@stencil/playwright';
5050

5151
expect.extend(matchers);
5252

53-
export default createStencilPlaywrightConfig({
53+
export default createConfig({
5454
// Change which test files Playwright will execute
5555
testMatch: '*.spec.ts',
5656
// Any other Playwright config option can also be overridden
@@ -122,7 +122,7 @@ test.describe('my-component', () => {
122122

123123
## API
124124

125-
### `createStencilPlaywrightConfig(overrides?: CreateStencilPlaywrightConfigOptions): Promise<PlaywrightTestConfig>`
125+
### `createConfig(overrides?: CreateStencilPlaywrightConfigOptions): Promise<PlaywrightTestConfig>`
126126

127127
Returns a [Playwright test configuration](https://playwright.dev/docs/test-configuration#introduction).
128128

@@ -136,11 +136,11 @@ as some options to override specific values in the config options related to the
136136
// playwright.config.ts
137137

138138
import { expect } from '@playwright/test';
139-
import { matchers, createStencilPlaywrightConfig } from '@stencil/playwright';
139+
import { matchers, createConfig } from '@stencil/playwright';
140140

141141
expect.extend(matchers);
142142

143-
export default createStencilPlaywrightConfig({
143+
export default createConfig({
144144
// Change which test files Playwright will execute
145145
testMatch: '*.spec.ts',
146146

src/create-config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ export type CreateStencilPlaywrightConfigOptions = Partial<PlaywrightTestConfig>
3131
* @param overrides Values to override in the default config. Any Playwright config option can be overridden.
3232
* @returns A {@link PlaywrightTestConfig} object
3333
*/
34-
export const createStencilPlaywrightConfig = async (
35-
overrides?: CreateStencilPlaywrightConfigOptions,
36-
): Promise<PlaywrightTestConfig> => {
34+
export const createConfig = async (overrides?: CreateStencilPlaywrightConfigOptions): Promise<PlaywrightTestConfig> => {
3735
const { webServerUrl, baseURL, stencilEntryPath, stencilNamespace } = await loadConfigMeta();
3836

3937
// Set the Stencil namespace and entry path as environment variables so we can use them when constructing

src/playwright-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type CustomFixtures = {
3232
*/
3333
async function extendPageFixture(page: E2EPage) {
3434
// Make sure the Stencil namespace and entry path are set on the process so we can use them in the `setContent` tests.
35-
// These wouldn't be set if the user didn't setup the Playwright config with the `createStencilPlaywrightConfig()` helper.
35+
// These wouldn't be set if the user didn't setup the Playwright config with the `createConfig()` helper.
3636
if (!process.env[ProcessConstants.STENCIL_NAMESPACE] || !process.env[ProcessConstants.STENCIL_ENTRY_PATH]) {
3737
const { stencilNamespace, stencilEntryPath } = await loadConfigMeta();
3838

src/test/create-config.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createStencilPlaywrightConfig } from '../create-config';
1+
import { createConfig } from '../create-config';
22

33
// Mock the loadConfigMeta function to just return the default values
44
jest.mock('../load-config-meta', () => ({
@@ -10,9 +10,9 @@ jest.mock('../load-config-meta', () => ({
1010
}),
1111
}));
1212

13-
describe('createStencilPlaywrightConfig', () => {
13+
describe('createConfig', () => {
1414
it('should create a default config', async () => {
15-
const config = await createStencilPlaywrightConfig();
15+
const config = await createConfig();
1616

1717
expect(config).toEqual({
1818
testMatch: '*.e2e.ts',
@@ -30,7 +30,7 @@ describe('createStencilPlaywrightConfig', () => {
3030
});
3131

3232
it('should override the default config', async () => {
33-
const config = await createStencilPlaywrightConfig({
33+
const config = await createConfig({
3434
webServerCommand: 'npm start -- --no-open --port 4444',
3535
testDir: 'tests/e2e',
3636
});

0 commit comments

Comments
 (0)