-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from stagas/coverage
test: improve coverage
- Loading branch information
Showing
9 changed files
with
71 additions
and
45 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 |
---|---|---|
|
@@ -23,27 +23,30 @@ jobs: | |
with: | ||
deno-version: v1.x | ||
|
||
- name: Install Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
node-version: 22.x | ||
|
||
- name: Install step | ||
- name: Install dependencies | ||
run: npm install --ignore-scripts | ||
|
||
- name: Build step | ||
run: npm run build | ||
- name: Build | ||
run: bun run build | ||
|
||
- name: Generate .env file | ||
uses: SpicyPizza/[email protected] | ||
with: | ||
envkey_DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
|
||
- name: Run migrations | ||
run: npm run kysely -- migrate:latest | ||
run: bun run kysely -- migrate:latest | ||
|
||
- name: Run tests | ||
run: npm run test:ci:npm | ||
run: bun run test | ||
|
||
- name: Upload coverage deno | ||
uses: codecov/codecov-action@v4 | ||
|
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 |
---|---|---|
|
@@ -43,27 +43,30 @@ jobs: | |
with: | ||
deno-version: v1.x | ||
|
||
- name: Install Bun | ||
uses: oven-sh/setup-bun@v1 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
node-version: 22.x | ||
|
||
- name: Install modules | ||
- name: Install dependencies | ||
run: npm install --ignore-scripts | ||
|
||
- name: Build step | ||
run: npm run build | ||
- name: Build | ||
run: bun run build | ||
|
||
- name: Generate .env file | ||
uses: SpicyPizza/[email protected] | ||
with: | ||
envkey_DATABASE_URL: ${{ env.DATABASE_URL }} | ||
|
||
- name: Run migrations | ||
run: npm run kysely -- migrate:latest | ||
run: bun run kysely -- migrate:latest | ||
|
||
- name: Run tests | ||
run: npm run test:ci:npm | ||
run: bun run test | ||
|
||
- name: Upload coverage deno | ||
uses: codecov/codecov-action@v4 | ||
|
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 |
---|---|---|
|
@@ -49,7 +49,7 @@ | |
- [x] Coverage | ||
- [x] Unit | ||
- [ ] Integration | ||
- [ ] E2E | ||
- [x] E2E | ||
- [x] HMR | ||
- [x] RPC | ||
- [x] Admin | ||
|
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,4 @@ | ||
[test] | ||
preload = "./happydom.ts" | ||
coverageSkipTestFiles = true | ||
coverageReporter = ["text", "lcov"] |
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,3 @@ | ||
import { GlobalRegistrator } from "@happy-dom/global-registrator" | ||
|
||
GlobalRegistrator.register({ url: 'https://localhost' }) |
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,37 @@ | ||
import { App } from '../pages/App.tsx' | ||
import { state } from '../state.ts' | ||
|
||
// @ts-ignore | ||
globalThis.fetch = () => { | ||
return { json: () => { } } | ||
} | ||
|
||
describe('App', () => { | ||
it('works', () => { | ||
const app = <App /> | ||
expect(app).toBeInstanceOf(Element) | ||
}) | ||
|
||
it('routes', async () => { | ||
const app = <App /> | ||
expect(app).toBeInstanceOf(Element) | ||
state.url = new URL('/about', location.origin) | ||
state.url = new URL('/verify-email', location.origin) | ||
state.url = new URL('/reset-password', location.origin) | ||
}) | ||
|
||
it('user', async () => { | ||
const app = <App /> | ||
expect(app).toBeInstanceOf(Element) | ||
state.user = null | ||
state.user = { | ||
nick: 'foo', | ||
expires: new Date(), | ||
} | ||
state.user = { | ||
nick: 'foo', | ||
expires: new Date(), | ||
isAdmin: true | ||
} | ||
}) | ||
}) |
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