Use local AMP validator to reduce test flakiness (#63838)

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
This commit is contained in:
JJ Kasper 2024-03-28 13:25:35 -07:00 committed by GitHub
parent dfeb3d10ed
commit 3299fe0b3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 4598 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,9 @@
module.exports = {
output: 'export',
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
// exportPathMap
}

View file

@ -1,6 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
optimizer: {
ampRuntimeVersion: '001515617716922',
rtv: true,

View file

@ -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'),
},
},
}

View file

@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -6,5 +6,10 @@ module.exports = {
amp: {
canonicalBase: 'http://localhost:1234',
},
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
// edit here
}

View file

@ -4,4 +4,9 @@ module.exports = {
config.experiments.topLevelAwait = true
return config
},
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -7,4 +7,9 @@ module.exports = {
'/ssr': { page: '/ssr', query: { another: 'one' } },
}
},
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -1,3 +1,8 @@
module.exports = {
output: 'export',
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -1 +1,8 @@
module.exports = { cleanDistDir: false }
module.exports = {
cleanDistDir: false,
experimental: {
amp: {
validator: require.resolve('../../../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -1,3 +1,8 @@
module.exports = {
cleanDistDir: false,
experimental: {
amp: {
validator: require.resolve('../../../../lib/amp-validator-wasm.js'),
},
},
}

View file

@ -1,5 +1,10 @@
module.exports = {
basePath: '/docs',
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
i18n: {
// localeDetection: false,
locales: [

View file

@ -1,6 +1,11 @@
module.exports = {
// basePath: '/docs',
// trailingSlash: true,
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
i18n: {
// localeDetection: false,
locales: [

View file

@ -0,0 +1,7 @@
module.exports = {
experimental: {
amp: {
validator: require.resolve('../../lib/amp-validator-wasm.js'),
},
},
}

1
test/lib/amp-readme.md Normal file
View file

@ -0,0 +1 @@
The `amp-validator-wasm.js` is used instead of the CDN as it isn't super reliable and causes test flakiness.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -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,