Skip to content

Commit

Permalink
Merge branch 'v4'
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwalton committed May 13, 2024
2 parents 2cb70da + d145c11 commit 06b459d
Show file tree
Hide file tree
Showing 65 changed files with 1,842 additions and 1,647 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"files": ["test/e2e/*.js"],
"globals": {
"$": false,
"browser": false
"browser": false,
"__toSafeObject": false
},
"extends": ["eslint:recommended"],
"rules": {
Expand Down Expand Up @@ -63,6 +64,7 @@
"node/no-missing-require": "off",
"node/shebang": "off",
"no-dupe-class-members": "off",
"prefer-spread": "off",
"space-before-function-paren": [
"error",
{
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:
jobs:
lint:
name: Lint Code Base
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: NPM install
run: npm install
- name: Run Prettier
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Run tests
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
unit-tests:
name: Run unit tests
# Doesn't require anything special so let's use ubuntu as more available
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: NPM install
run: npm install
- name: Build
run: npm run build
- name: Run unit tests
run: npm run test:unit
chrome-tests:
name: Run Chrome e2e tests
# Runs best on macos for CI as linux requires extra chrome flags
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: NPM install
run: npm install
- name: Build
run: npm run build
- name: Run server
run: npm run test:server &
- name: Run e2e tests for chrome
run: npm run test:e2e -- --browsers=chrome
firefox-tests:
name: Run Firefox e2e tests
# Runs best on macos for CI as linux requires extra setup
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: NPM install
run: npm install
- name: Build
run: npm run build
- name: Run server
run: npm run test:server &
- name: Run e2e tests for firefox
run: npm run test:e2e -- --browsers=firefox
safari-tests:
name: Run Safari e2e tests
# Requires macos
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: NPM install
run: npm install
- name: Build
run: npm run build
- name: Run server
run: npm run test:server &
- name: Run e2e tests for safari
run: npm run test:e2e -- --browsers=safari
8 changes: 8 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
. "$(dirname -- "$0")/_/husky.sh"

npm exec lint-staged

grep -r "\.only(" test/e2e \
&& echo "ERROR: found .only() use in test" && exit 1

grep -r "browser\.debug(" test/e2e \
&& echo "ERROR: found browser.debug() use in test" && exit 1

exit 0
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

See the [upgrading to v4](/docs/upgrading-to-v4.md) documentation for a complete list of all API changes in version 4.

### v4.0.0 (2024-05-13)

- **[BREAKING]** Update types to support more generic usage ([#471](https://github.com/GoogleChrome/web-vitals/pull/471))
- **[BREAKING]** Split `waitingDuration` to make it easier to understand redirect delays ([#458](https://github.com/GoogleChrome/web-vitals/pull/458))
- **[BREAKING]** Rename `TTFBAttribution` fields from `*Time` to `*Duration` ([#453](https://github.com/GoogleChrome/web-vitals/pull/453))
- **[BREAKING]** Rename `resourceLoadTime` to `resourceLoadDuration` in LCP attribution ([#450](https://github.com/GoogleChrome/web-vitals/pull/450))
- **[BREAKING]** Add INP breakdown timings and LoAF attribution ([#442](https://github.com/GoogleChrome/web-vitals/pull/442))
- **[BREAKING]** Deprecate `onFID()` and remove previously deprecated APIs ([#435](https://github.com/GoogleChrome/web-vitals/pull/435))
- Expose the target element in INP attribution ([#479](https://github.com/GoogleChrome/web-vitals/pull/479))
- Save INP target after interactions to reduce null values when removed from the DOM ([#477](https://github.com/GoogleChrome/web-vitals/pull/477))
- Cap TTFB in attribution ([#440](https://github.com/GoogleChrome/web-vitals/pull/440))
- Fix `reportAllChanges` behavior for LCP when library is loaded late ([#468](https://github.com/GoogleChrome/web-vitals/pull/468))

### v3.5.2 (2024-01-25)

- Pick the first non-null `target` for INP attribution ([#421](https://github.com/GoogleChrome/web-vitals/pull/421))
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions docs/contributing.md → CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@ use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

## Testing

To test the full suite run `npm run test`.

To test a subset of browsers or metrics, run the following in separate terminals:

- `npm run watch`
- `npm run test:server`
- `npm run test:e2e -- --browsers=chrome --metrics=TTFB`

The last command can be replaced as you see fit and include comma, separated values. For example:

- `npm run test:e2e -- --browsers=chrome,firefox --metrics=TTFB,LCP`

To run an individual test, change `it('test name')` to `it.only('test name')`.

You can also add `await browser.debug()` lines to the individual test files to pause execution, and press `CTRL+C` in the command line to continue the tests.

See the https://webdriver.io/ for more information.

## Community Guidelines

This project follows [Google's Open Source Community
Expand Down
Loading

0 comments on commit 06b459d

Please sign in to comment.