-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from barclayd/feat/add-vitest
feat: add vitest
- Loading branch information
Showing
12 changed files
with
104 additions
and
15 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules/ | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
/__screenshots__/ |
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
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,32 @@ | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import { createRoutesStub } from 'react-router'; | ||
import Home from '../../app/routes/_index'; | ||
|
||
test('generic browser mode test', async () => { | ||
const Stub = createRoutesStub([ | ||
{ | ||
path: '/', | ||
Component: Home, | ||
loader: () => | ||
Promise.resolve({ | ||
data: JSON.stringify({ | ||
id: 4, | ||
}), | ||
}), | ||
action() { | ||
return { | ||
errors: { | ||
username: 'test', | ||
password: 'test', | ||
}, | ||
}; | ||
}, | ||
}, | ||
]); | ||
|
||
render(<Stub initialEntries={['/']} />); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByRole('heading', { name: '4' })).toBeVisible(); | ||
}); | ||
}); |
File renamed without changes.
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,16 @@ | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
export default defineConfig({ | ||
plugins: [tsconfigPaths()], | ||
test: { | ||
globals: true, | ||
css: true, | ||
coverage: { | ||
all: false, | ||
include: ['app/**'], | ||
reporter: ['text', 'json-summary', 'json'], | ||
reportOnFailure: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineWorkspace } from 'vitest/config'; | ||
|
||
const isHeadless = | ||
process.argv.includes('--browser.headless') || !!process.env.CI; | ||
|
||
export default defineWorkspace([ | ||
{ | ||
extends: './vitest.config.ts', | ||
optimizeDeps: { | ||
include: ['react/jsx-dev-runtime'], | ||
}, | ||
server: { | ||
fs: { | ||
strict: false, | ||
}, | ||
}, | ||
test: { | ||
includeTaskLocation: true, | ||
include: ['./test/browser/*.test.tsx'], | ||
name: 'browser tests', | ||
browser: { | ||
enabled: true, | ||
headless: isHeadless, | ||
name: 'chromium', | ||
provider: 'playwright', | ||
providerOptions: {}, | ||
}, | ||
}, | ||
}, | ||
]); |
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,17 +1,18 @@ | ||
{ | ||
"name": "swipe-move", | ||
"devDependencies": { | ||
"turbo": "^2.3.3", | ||
"typescript": "5.5.4" | ||
}, | ||
"packageManager": "[email protected]", | ||
"private": true, | ||
"scripts": { | ||
"build": "turbo build", | ||
"dev": "turbo dev", | ||
"lint": "turbo lint", | ||
"test": "turbo test" | ||
"test": "turbo test", | ||
"test:integration": "vitest run --browser.headless" | ||
}, | ||
"devDependencies": { | ||
"turbo": "^2.3.3", | ||
"typescript": "5.5.4" | ||
}, | ||
"packageManager": "[email protected]", | ||
"workspaces": [ | ||
"apps/*" | ||
] | ||
|