Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI for SvelteKit PRs #513

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/sveltekit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

# This runs CI specifically for development of the `sveltekit` branch.
# It uses our new testing infrastructure.

name: SvelteKit CI

on:
pull_request:
branches: [sveltekit]

jobs:
unit-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
- run: npm ci
- run: npm run build
env:
NODE_ENV: production
- run: npm run test:coverage
- name: Report Coverage
uses: davelosert/vitest-coverage-report-action@v2

check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
- run: npm ci
- run: npm run build
env:
NODE_ENV: production
- run: npm run check
5 changes: 4 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ const config: StorybookConfig = {
core: {
disableTelemetry: true, // 👈 Disables telemetry
},
stories: ["../src/**/*.stories.@(js|jsx|ts|tsx|svelte)"],
stories: [
"../src/lib/**/*.stories.@(js|jsx|ts|tsx|svelte)",
"../src/routes/**/*.stories.@(js|jsx|ts|tsx|svelte)",
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
Expand Down
19 changes: 17 additions & 2 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strict": false,
"moduleResolution": "bundler"
}
},
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
"include": [
".svelte-kit/**",
"vite.config.js",
"vite.config.ts",
"src/lib/**/*.js",
"src/lib/**/*.ts",
"src/lib/**/*.svelte",
"src/routes/**/*.js",
"src/routes/**/*.ts",
"src/routes/**/*.svelte",
"tests/**/*.js",
"tests/**/*.ts",
"tests/**/*.svelte"
],
"exclude": ["node_modules/**", "public/**"]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { rest } from "msw";

import meFixture from "../fixtures/users/me.json";
import { me as meFixture } from "@/test/fixtures/accounts";
import projectFixture from "../fixtures/projects/project.json";
import projDocsPage1 from "../fixtures/projects/project-documents-expanded.json";
import projDocsPage2 from "../fixtures/projects/project-documents-2.json";
Expand Down
2 changes: 1 addition & 1 deletion src/routes/stories/project-embed.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import documents from "$lib/api/fixtures/projects/project-documents-expanded.json";
import project from "$lib/api/fixtures/projects/project.json";
import * as mock from "$lib/api/fixtures/mock.js";
import * as mock from "$lib/api/fixtures/mock";

export const meta = {
title: "Embed / Project",
Expand Down
9 changes: 7 additions & 2 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,21 @@ export default defineConfig({

test: {
setupFiles: ["./vitest-setup.js"],
include: ["src/**/*.{test,spec}.{js,ts}"],
include: [
"src/lib/**/*.{test,spec}.{js,ts}",
"src/routes/**/*.{test,spec}.{js,ts}",
],
exclude: [
...configDefaults.exclude,
"storybook-static",
"node_modules",
"./src/config/*",
"../src/**/*.stories.@(js|jsx|ts|tsx|svelte)",
],
environment: "jsdom",
coverage: {
reporter: ["text", "html", "clover", "json"],
include: ["src/lib/**", "src/routes/**"],
reporter: ["text", "html", "lcov", "clover", "json", "json-summary"],
},
},
});
Loading