summaryrefslogtreecommitdiff
path: root/packages/integrations/vercel/test/web-analytics.test.js
diff options
context:
space:
mode:
authorGravatar Chris <7249920+chriswdmr@users.noreply.github.com> 2023-09-14 14:02:11 +0200
committerGravatar GitHub <noreply@github.com> 2023-09-14 08:02:11 -0400
commit2e8726feec2e0d6ba8bd4db941009986e8e34141 (patch)
treede59fa68c9e8b00b1364bc82024e57f95d955b94 /packages/integrations/vercel/test/web-analytics.test.js
parent7522bb4914f2f9e8b8f3c743bc9c941fd3aca644 (diff)
downloadastro-2e8726feec2e0d6ba8bd4db941009986e8e34141.tar.gz
astro-2e8726feec2e0d6ba8bd4db941009986e8e34141.tar.zst
astro-2e8726feec2e0d6ba8bd4db941009986e8e34141.zip
[@astrojs/vercel] Individually enable Speed Insights and Web Analytics (#8021)
* Individually enable Speed Insights and Web Analytics * Update pnpm-lock.yaml * Remove .only on tests * Fix build * Move `beforeSend` out of config * Address feedback from review * Update README.md * Add back the `analytics` property and add deprecation warning when used * Add migration guide for the deprecated `analytics` property * Update packages/integrations/vercel/README.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update README.md * Fix external dependency issue * Simplify plugin and reduce scope * Update .changeset/sixty-teachers-tap.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> * Apply feedback from review * Move exposeEnv to speed-insights since it's only used there --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Matthew Phillips <matthew@skypack.dev> Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Diffstat (limited to 'packages/integrations/vercel/test/web-analytics.test.js')
-rw-r--r--packages/integrations/vercel/test/web-analytics.test.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/integrations/vercel/test/web-analytics.test.js b/packages/integrations/vercel/test/web-analytics.test.js
new file mode 100644
index 000000000..b728fae4c
--- /dev/null
+++ b/packages/integrations/vercel/test/web-analytics.test.js
@@ -0,0 +1,25 @@
+import { loadFixture } from './test-utils.js';
+import { expect } from 'chai';
+
+describe('Vercel Web Analytics', () => {
+ describe('output: static', () => {
+ /** @type {import('./test-utils.js').Fixture} */
+ let fixture;
+
+ before(async () => {
+ fixture = await loadFixture({
+ root: './fixtures/with-web-analytics-enabled/output-as-static/',
+ output: 'static',
+ });
+ await fixture.build();
+ });
+
+ it('ensures that Vercel Web Analytics is present in the header', async () => {
+ const pageOne = await fixture.readFile('../.vercel/output/static/one/index.html');
+ const pageTwo = await fixture.readFile('../.vercel/output/static/two/index.html');
+
+ expect(pageOne).to.contain('/_vercel/insights/script.js');
+ expect(pageTwo).to.contain('/_vercel/insights/script.js');
+ });
+ });
+});