Astro Quick Start
Step 1: Add the Astro Integration
To install the @codecov/astro-plugin
to your project, use the following commands.
npx astro add @codecov/astro-plugin
yarn astro add @codecov/astro-plugin
pnpm astro add @codecov/astro-plugin
Step 2: Configure the bundler plugin
Ensure the integration is at the end of your integrations array found inside your astro.config.mjs
file, and pass your configuration.
You can find a Codecov upload token on the Configuration page for your repository, under General, or your organization settings page in the Codecov UI. For more information, see the documentation.
import { defineConfig } from "astro/config";
import { codecovAstroPlugin } from "@codecov/astro-plugin";
// https://astro.build/config
export default defineConfig({
// other config settings
integrations: [
// place this after all other integrations
codecovAstroPlugin({
enableBundleAnalysis: true,
bundleName: "example-astro-bundle",
uploadToken: process.env.CODECOV_TOKEN,
}),
],
});
Step 3: Commit and push your latest changes
The plugin requires at least one commit to be made to properly upload bundle analysis information to Codecov.
git add -A && git commit -m "Add Codecov Astro plugin" && git push
Step 4: Build the Application
When building your application the plugin will automatically upload the stats information to Codecov.
npm run build
yarn run build
pnpm run build
Sending Telemetry Data on Issues and Performance
By default, Codecov's bundler plugins collects telemetry data on issues and performance metrics internally, enabling us to analyze the plugins for performance and monitor potential issues.
You can opt-out of sending this telemetry data by setting the options.telemetry
option in the plugin config to false
. For example if you're using the Astro integration, the Codecov plugin configuration might look like the following:
codecovAstroPlugin({
enableBundleAnalysis: true,
bundleName: "example-astro-bundle",
uploadToken: process.env.CODECOV_TOKEN,
telemetry: false // <- Setting to `false`
// ... other options
})
Updated about 1 month ago