-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef73aeb
commit 9610fce
Showing
7 changed files
with
82 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: NPM Test | ||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
|
||
- run: nix develop -c '(cd packages/webapp && npm run test)' | ||
|
||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
|
||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
- run: nix develop -c '(cd packages/webapp && npm run svelte-lint-format-check)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { render, screen } from '@testing-library/svelte'; | ||
import { describe, it, expect } from 'vitest'; | ||
import Page from './+page.svelte'; | ||
|
||
describe('Page Component', () => { | ||
it('should load the page', async () => { | ||
render(Page); | ||
expect(screen.getByTestId('page-container')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@testing-library/jest-dom/vitest'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
import { sveltekit } from '@sveltejs/kit/vite'; | ||
import { loadEnv } from 'vite'; | ||
|
||
export default defineConfig({ | ||
export default defineConfig(({ mode }) => ({ | ||
plugins: [sveltekit()], | ||
|
||
resolve: { | ||
conditions: mode === 'test' ? ['browser'] : [] | ||
}, | ||
define: { | ||
'process.env': {}, | ||
'import.meta.vitest': 'undefined' | ||
}, | ||
test: { | ||
include: ['src/**/*.{test,spec}.{js,ts}'] | ||
// Jest like globals | ||
includeSource: ['src/**/*.{js,ts}'], | ||
globals: true, | ||
environment: 'jsdom', | ||
include: ['src/**/*.{test,spec}.ts'], | ||
// Extend jest-dom matchers | ||
setupFiles: ['./test-setup.ts'], | ||
// load env vars | ||
env: loadEnv('', process.cwd(), ''), | ||
testTimeout: 10000 | ||
} | ||
}); | ||
})); |