Skip to content

Commit

Permalink
Merge pull request #84 from InseeFr/feat/sonar
Browse files Browse the repository at this point in the history
feat: add sonar
  • Loading branch information
PierreVasseur authored Aug 26, 2024
2 parents cc0e8ac + 1cbebc1 commit 1bc74d1
Show file tree
Hide file tree
Showing 8 changed files with 322 additions and 9 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Quality
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
Expand All @@ -15,5 +18,10 @@ jobs:
with:
node-version: ${{ matrix.node }}
- run: yarn
- run: yarn test
- run: yarn test --coverage --watch=false
- run: yarn build
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets. SONAR_TOKEN }}
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Impala

Impala is a module of Insee's Statistical Metadata Repository (RMéS). It exposes linked metadata on web pages and through a SPARQL editor based on [Yasgui](https://triply.cc/docs/yasgui-api).

## Getting Started

* Run Unit Tests (Vitest)

```shell
yarn test
```

* Run UI Tests (Playwright)

```shell
npx playwright test
```
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@testing-library/user-event": "14.5.2",
"@types/node": "^22.0.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"@vitest/coverage-v8": "^2.0.5",
"bestzip": "^2.2.1",
"jsdom": "^24.1.1",
"ncp": "^2.0.0",
Expand Down Expand Up @@ -56,4 +57,4 @@
"last 1 safari version"
]
}
}
}
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
baseURL: "http://localhost:3000",

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry"
Expand Down
20 changes: 20 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sonar.projectKey=InseeFr_Impala
sonar.organization=inseefr
sonar.host.url=https://sonarcloud.io

# Project name & version
sonar.projectName=Impala
sonar.projectVersion=1.2.0

# Path to sources
sonar.sources=src

# Path to tests
sonar.test.inclusions=src/**/*.spec.jsx

# Coverage
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.coverage.exclusions=src/**/*.spec.jsx

# Source encoding
sonar.sourceEncoding=UTF-8
2 changes: 1 addition & 1 deletion tests/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from "@playwright/test";

test("has title", async ({ page }) => {
await page.goto("http://localhost:3000/");
await page.goto("/");

await expect(page).toHaveTitle("Espace RDF de l'Insee");
});
6 changes: 5 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export default defineConfig({
test: {
environment: "jsdom",
dangerouslyIgnoreUnhandledErrors: true,
exclude: [...configDefaults.exclude, "tests/*"]
exclude: [...configDefaults.exclude, "tests/*"],
coverage: {
reporter: "lcov",
include: ["src/**/*.jsx"]
}
},
build: {
outDir: "temp_dist"
Expand Down
Loading

0 comments on commit 1bc74d1

Please sign in to comment.