Skip to content
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
4 changes: 2 additions & 2 deletions __tests__/uploader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Uploader', () => {

it('fails if not logged in and not on public share', async () => {
vi.spyOn(nextcloudAuth, 'getCurrentUser').mockImplementationOnce(() => null)
expect(async () => new Uploader()).rejects.toThrow(/User is not logged in/)
await expect(async () => new Uploader()).rejects.toThrow(/User is not logged in/)
})
})

Expand Down Expand Up @@ -119,7 +119,7 @@ describe('Uploader', () => {
mime: 'text/plain',
})

expect(() => { uploader.destination = newDestination as nextcloudFiles.Folder }).toThrowError(/invalid destination/i)
expect(() => { uploader.destination = newDestination as unknown as nextcloudFiles.Folder }).toThrowError(/invalid destination/i)
})
})
})
38 changes: 18 additions & 20 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,23 @@ import type { UserConfig } from 'vitest/node'
import config from './vite.config.ts'

export default async (env) => {
const cfg = await config(env)
// Node externals does not work with vitest
cfg.plugins = cfg.plugins!.filter((plugin) => plugin && 'name' in plugin && plugin.name !== 'node-externals')

cfg.test = {
environment: 'jsdom',
environmentOptions: {
jsdom: {
url: 'https://cloud.example.com/index.php/apps/test',
return {
...await config(env),
test: {
environment: 'jsdom',
environmentOptions: {
jsdom: {
url: 'https://cloud.example.com/index.php/apps/test',
},
},
setupFiles: '__tests__/setup.ts',
coverage: {
include: ['lib/**'],
// This makes no sense to test
exclude: ['lib/utils/l10n.ts'],
reporter: ['lcov', 'text'],
},
},
setupFiles: '__tests__/setup.ts',
coverage: {
include: ['lib/**'],
// This makes no sense to test
exclude: ['lib/utils/l10n.ts'],
reporter: ['lcov', 'text'],
},
pool: 'vmForks',
} as UserConfig
return cfg
pool: 'vmForks',
} as UserConfig,
}
}
Loading