Skip to content

Commit

Permalink
Use local AMP validator to reduce test flakiness (vercel#63838)
Browse files Browse the repository at this point in the history
We've seen test flakiness from the upstream AMP resource being
unavailable so this pulls that resource to the repo and uses that
instead.

x-ref: [slack
thread](https://vercel.slack.com/archives/C04KC8A53T7/p1711643629072819)

Closes NEXT-2961
  • Loading branch information
ijjk authored Mar 28, 2024
1 parent dfeb3d1 commit 3299fe0
Show file tree
Hide file tree
Showing 22 changed files with 4,598 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ packages/next-bundle-analyzer/index.d.ts
examples/with-typescript-graphql/lib/gql/
test/development/basic/hmr/components/parse-error.js
packages/next-swc/docs/assets/**/*
test/lib/amp-validator-wasm.js
test/production/pages-dir/production/fixture/amp-validator-wasm.js
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ bench/nested-deps/components/**/*

**/convex/_generated/**
**/.tina/__generated__/**
test/lib/amp-validator-wasm.js
test/production/pages-dir/production/fixture/amp-validator-wasm.js
2 changes: 2 additions & 0 deletions .prettierignore_staged
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ pnpm-lock.yaml
.github/actions/needs-triage/index.js
.github/actions/*/index.mjs
**/convex/_generated/**
test/lib/amp-validator-wasm.js
test/production/pages-dir/production/fixture/amp-validator-wasm.js
5 changes: 5 additions & 0 deletions test/integration/amp-export-validation/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
module.exports = {
output: 'export',
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
// exportPathMap
}
1 change: 1 addition & 0 deletions test/integration/amphtml-custom-optimizer/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
optimizer: {
ampRuntimeVersion: '001515617716922',
rtv: true,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/amphtml-custom-validator/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: 'https://cdn.ampproject.org/v0/validator_wasm.js',
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}
7 changes: 7 additions & 0 deletions test/integration/amphtml-fragment-style/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}
7 changes: 7 additions & 0 deletions test/integration/amphtml-ssg/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}
5 changes: 5 additions & 0 deletions test/integration/amphtml/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ module.exports = {
amp: {
canonicalBase: 'http://localhost:1234',
},
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
// edit here
}
5 changes: 5 additions & 0 deletions test/integration/async-modules/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ module.exports = {
config.experiments.topLevelAwait = true
return config
},
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}
5 changes: 5 additions & 0 deletions test/integration/auto-export-query-error/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ module.exports = {
'/ssr': { page: '/ssr', query: { another: 'one' } },
}
},
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../../../lib/amp-validator-wasm.js'),
},
},
}
5 changes: 5 additions & 0 deletions test/integration/export-default-map/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module.exports = {
output: 'export',
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
module.exports = { cleanDistDir: false }
module.exports = {
cleanDistDir: false,
experimental: {
amp: {
validator: require.resolve('../../../../lib/amp-validator-wasm.js'),
},
},
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module.exports = {
cleanDistDir: false,
experimental: {
amp: {
validator: require.resolve('../../../../lib/amp-validator-wasm.js'),
},
},
}
5 changes: 5 additions & 0 deletions test/integration/i18n-support-base-path/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
module.exports = {
basePath: '/docs',
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
i18n: {
// localeDetection: false,
locales: [
Expand Down
5 changes: 5 additions & 0 deletions test/integration/i18n-support/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module.exports = {
// basePath: '/docs',
// trailingSlash: true,
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
i18n: {
// localeDetection: false,
locales: [
Expand Down
7 changes: 7 additions & 0 deletions test/integration/page-config/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}
1 change: 1 addition & 0 deletions test/lib/amp-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `amp-validator-wasm.js` is used instead of the CDN as it isn't super reliable and causes test flakiness.
2,254 changes: 2,254 additions & 0 deletions test/lib/amp-validator-wasm.js

Large diffs are not rendered by default.

2,254 changes: 2,254 additions & 0 deletions test/production/pages-dir/production/fixture/amp-validator-wasm.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions test/production/pages-dir/production/fixture/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
setInterval(() => {}, 250)

module.exports = {
experimental: {
amp: {
validator: require.resolve('./amp-validator-wasm.js'),
},
},
onDemandEntries: {
// Make sure entries are not getting disposed.
maxInactiveAge: 1000 * 60 * 60,
Expand Down

0 comments on commit 3299fe0

Please sign in to comment.