web-analytics.test.js 859 B

1234567891011121314151617181920212223242526
  1. import { loadFixture } from './test-utils.js';
  2. import assert from 'node:assert/strict';
  3. import { before, describe, it } from 'node:test';
  4. describe('Vercel Web Analytics', () => {
  5. describe('output: static', () => {
  6. /** @type {import('./test-utils.js').Fixture} */
  7. let fixture;
  8. before(async () => {
  9. fixture = await loadFixture({
  10. root: './fixtures/with-web-analytics-enabled/output-as-static/',
  11. output: 'static',
  12. });
  13. await fixture.build();
  14. });
  15. it('ensures that Vercel Web Analytics is present in the header', async () => {
  16. const pageOne = await fixture.readFile('../.vercel/output/static/one/index.html');
  17. const pageTwo = await fixture.readFile('../.vercel/output/static/two/index.html');
  18. assert.match(pageOne, /\/_vercel\/insights\/script.js/);
  19. assert.match(pageTwo, /\/_vercel\/insights\/script.js/);
  20. });
  21. });
  22. });