0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/vercel/test/web-analytics.test.js
Chris 2e8726feec
[@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>
2023-09-14 08:02:11 -04:00

25 lines
803 B
JavaScript

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');
});
});
});