Skip to content

Commit 18380d7

Browse files
Merge remote-tracking branch 'origin/master' into astro
* Regenerate lockfile
2 parents 75efa1e + 7f74236 commit 18380d7

18 files changed

+2216
-1494
lines changed

.github/workflows/vrt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Node
1313
uses: actions/setup-node@v4
1414
with:
15-
node-version: 20.12.0
15+
node-version: 20.17.0
1616

1717
- name: Install dependencies
1818
run: npm install

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,18 @@ Source for [johnkurkowski.com](https://johnkurkowski.com).
1111
### Running
1212

1313
npm start
14+
15+
### Tests
16+
17+
npm test
18+
19+
Tests are run in CI and must pass prior to deployment.
20+
21+
[Lost Pixel](https://app.lost-pixel.com/) visual regression review is run during
22+
CI, but does not block deployment. If there are visual differences in your
23+
build, they require manual, asynchronous review. Before push, you can preview
24+
Lost Pixel's snapshots against your running local server in production mode.
25+
26+
npm run build
27+
npm run serve &
28+
npx lost-pixel local

lostpixel.config.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
1+
import type { Page } from 'playwright-core'
12
import type { CustomProjectConfig } from 'lost-pixel'
2-
import { readFileSync } from 'fs'
33
import { join } from 'path'
4+
import { readFileSync } from 'fs'
5+
6+
/**
7+
* Hide 3rd party embeds.
8+
*
9+
* They're a distraction from 1st party diffs.
10+
*/
11+
async function hide3rdPartyEmbeds(page: Page) {
12+
await page.addStyleTag({
13+
content: `
14+
.embed iframe,
15+
.twitter-tweet-rendered {
16+
display: none !important;
17+
}
18+
`,
19+
})
20+
}
421

22+
/**
23+
* Parse the sitemap for all pages for visual regression testing to visit.
24+
*
25+
* The sitemap is an updated yet static list of all pages. "Parse" its XML with
26+
* vanilla Node.js for the page URLs.
27+
*/
528
function pagePaths(): string[] {
629
const siteUrl = 'https://johnkurkowski.com'
730
const sitemapXml = readFileSync(
@@ -14,6 +37,9 @@ function pagePaths(): string[] {
1437
})
1538
}
1639

40+
/**
41+
* Id the pages by a friendlier, more uniform slug.
42+
*/
1743
function slugify(str: string): string {
1844
const replaced = str.replaceAll('/', '-')
1945
const stripped = replaced.replaceAll(/(^-+|-+$)/g, '')
@@ -22,6 +48,9 @@ function slugify(str: string): string {
2248

2349
export const config: CustomProjectConfig = {
2450
apiKey: process.env.LOST_PIXEL_API_KEY,
51+
beforeScreenshot: async (page) => {
52+
await hide3rdPartyEmbeds(page)
53+
},
2554
breakpoints: [414, 1280],
2655
lostPixelProjectId: 'clud602ae10romo0e861bvpv2',
2756
pageShots: {

netlify.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
publish = "dist/"
44

55
[build.environment]
6-
NODE_VERSION = "20.12.0"
7-
NPM_VERSION = "10.5.0"
6+
NODE_VERSION = "20.17.0"
7+
NPM_VERSION = "10.8.3"

0 commit comments

Comments
 (0)