Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d224e99

Browse filesBrowse files
authored
Switch to istanbul coverage provider (#796)
* Switch to istanbul coverage provider * Add tests for errors * Simplify camelcase logic
1 parent f025624 commit d224e99
Copy full SHA for d224e99

File tree

Expand file treeCollapse file tree

7 files changed

+400
-76
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+400
-76
lines changed

‎__tests__/utils/index.ts

Copy file name to clipboardExpand all lines: __tests__/utils/index.ts
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@ import type { FluentVue } from '../../src'
77
install()
88

99
export function mountWithFluent<T>(
10-
fluent: FluentVue,
10+
fluent: FluentVue | null,
1111
component: ComponentOptions<T>,
1212
): VueWrapper<ComponentPublicInstance<T>> {
1313
if (isVue3) {
1414
// eslint-disable-next-line @typescript-eslint/no-var-requires
1515
const { mount } = require('@vue/test-utils')
1616

17+
const plugins = fluent ? [fluent] : []
18+
1719
return mount(component, {
1820
global: {
19-
plugins: [fluent],
21+
plugins,
2022
},
2123
})
2224
}
@@ -25,7 +27,8 @@ export function mountWithFluent<T>(
2527
const { createLocalVue, mount } = require('@vue/test-utils')
2628

2729
const localVue = createLocalVue()
28-
localVue.use(fluent)
30+
if (fluent)
31+
localVue.use(fluent)
2932
return mount(component, {
3033
localVue,
3134
})

‎__tests__/vue/composition.spec.ts

Copy file name to clipboardExpand all lines: __tests__/vue/composition.spec.ts
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,29 @@ describe('composition api', () => {
4646
// Assert
4747
expect(mounted.html()).toEqual('<a href="/foo" aria-label="Aria label">link text</a>')
4848
})
49+
50+
it('thrpws when used outside of setup', () => {
51+
// Arrange
52+
// Act
53+
const use = () => useFluent()
54+
55+
// Assert
56+
expect(use).toThrowError('[fluent-vue] useFluent called outside of setup')
57+
})
58+
59+
it('throws when used without installing plugin', () => {
60+
// Arrange
61+
const component = {
62+
template: '<span></span>',
63+
setup() {
64+
useFluent()
65+
},
66+
}
67+
68+
// Act
69+
const mount = () => mountWithFluent(null, component)
70+
71+
// Asser
72+
expect(mount).toThrowError('[fluent-vue] useFluent called without installing plugin')
73+
})
4974
})

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"@ls-lint/ls-lint": "^1.11.2",
8484
"@release-it-plugins/lerna-changelog": "^5.0.0",
8585
"@types/node": "^17.0.10",
86-
"@vitest/coverage-c8": "^0.23.4",
86+
"@vitest/coverage-istanbul": "^0.24.3",
8787
"@vue/compiler-sfc": "^3.2.41",
8888
"@vue/test-utils": "^2.1.0",
8989
"esbuild-plugin-globals": "^0.1.1",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.