aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-02-04 22:29:50 +0100
committerGitHub <[email protected]>2022-02-04 22:29:50 +0100
commit046d598c8cadd3585a98b968389b4ac95bc00224 (patch)
tree98832570af9590514002deeb9f2329f1d544031c
parentdbb3e144ea9a72a5dfe2ada9adfe70a4e549ccff (diff)
downloadfaker-046d598c8cadd3585a98b968389b4ac95bc00224.tar.xz
faker-046d598c8cadd3585a98b968389b4ac95bc00224.zip
ci: configure codecov (#426)
-rw-r--r--.github/.codecov.yml6
-rw-r--r--.github/workflows/ci.yml37
-rw-r--r--.vscode/extensions.json3
-rw-r--r--.vscode/settings.json4
-rw-r--r--README.md1
-rw-r--r--vite.config.ts14
6 files changed, 64 insertions, 1 deletions
diff --git a/.github/.codecov.yml b/.github/.codecov.yml
new file mode 100644
index 00000000..3c471565
--- /dev/null
+++ b/.github/.codecov.yml
@@ -0,0 +1,6 @@
+comment:
+ layout: 'diff, flags, files'
+ behavior: default
+ require_changes: false
+ require_base: false
+ require_head: true
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 11bc7fe8..57b725aa 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -95,3 +95,40 @@ jobs:
- name: Check formatting
run: pnpm prettier --check .
+
+ codecov:
+ runs-on: ubuntu-latest
+ name: 'Codecov: node-16, ubuntu-latest'
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v2
+ with:
+ version: 6
+
+ - name: Set node version to 16
+ uses: actions/setup-node@v2
+ with:
+ node-version: 16
+ cache: 'pnpm'
+
+ - name: Install deps
+ run: pnpm install
+ env:
+ CYPRESS_INSTALL_BINARY: 0
+
+ - name: Build
+ run: pnpm run build
+
+ - name: Generate coverage report
+ run: pnpm vitest run --coverage
+
+ - name: Upload coverage to Codecov
+ uses: codecov/[email protected]
+ with:
+ directory: ./coverage
+ fail_ci_if_error: true
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 17fab0c0..965297c1 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -2,6 +2,7 @@
"recommendations": [
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
- "esbenp.prettier-vscode"
+ "esbenp.prettier-vscode",
+ "redhat.vscode-yaml"
]
}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index a2caeede..adff015a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -7,5 +7,9 @@
"files.associations": {
"*.json5": "jsonc"
+ },
+
+ "yaml.schemas": {
+ "https://json.schemastore.org/codecov.json": ".github/.codecov.yml"
}
}
diff --git a/README.md b/README.md
index e63cab79..62a1a25c 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@
[![Chat on Discord](https://img.shields.io/discord/929487054990110771)](https://chat.fakerjs.dev)
[![Continuous Integration](https://github.com/faker-js/faker/actions/workflows/ci.yml/badge.svg)](https://github.com/faker-js/faker/actions/workflows/ci.yml)
+ [![codecov](https://codecov.io/gh/faker-js/faker/branch/main/graph/badge.svg?token=N61U168G08)](https://codecov.io/gh/faker-js/faker)
[![npm version](https://badgen.net/npm/v/@faker-js/faker)](https://www.npmjs.com/package/@faker-js/faker)
[![npm downloads](https://badgen.net/npm/dm/@faker-js/faker)](https://www.npmjs.com/package/@faker-js/faker)
[![Open Collective](https://img.shields.io/opencollective/backers/fakerjs)](https://opencollective.com/fakerjs#section-contributors)
diff --git a/vite.config.ts b/vite.config.ts
new file mode 100644
index 00000000..13e82b4d
--- /dev/null
+++ b/vite.config.ts
@@ -0,0 +1,14 @@
+/// <reference types="vitest" />
+import { defineConfig } from 'vite';
+
+// https://vitejs.dev/config/
+export default defineConfig({
+ test: {
+ coverage: {
+ all: true,
+ reporter: ['clover', 'cobertura', 'lcov', 'text'],
+ // TODO christopher 2022-02-04: Later we want to test `src` instead of `dist/cjs`
+ include: ['dist/cjs'],
+ },
+ },
+});