Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salza80 committed Jul 15, 2024
1 parent d70be08 commit ac53cbb
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lerna-debug.log*
node_modules
dist
dist-ssr
coverage
*.local

# Editor directories and files
Expand Down
189 changes: 189 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dev": "vite",
"size": "size-limit",
"build": "rollup -c",
"test": "vitest",
"test": "vitest --coverage",
"lint": "eslint src",
"preview": "vite preview"
},
Expand Down Expand Up @@ -39,6 +39,7 @@
"@size-limit/preset-small-lib": "^11.1.4",
"@types/jsdom": "^21.1.7",
"@vitejs/plugin-vue": "^5.0.5",
"@vitest/coverage-v8": "^2.0.3",
"@vue/test-utils": "^2.4.6",
"eslint": "^9.7.0",
"eslint-plugin-vue": "^9.27.0",
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useTelemetryDeck } from './hooks';
import { useTelemetryDeck } from "./"
const { signal, queue, setClientUser } = useTelemetryDeck();
const changeClientUserClick = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./hooks";
export * from "./plugin";
import { plugin } from "./plugin";
export default plugin;
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import TelementryDeckPlugin from './plugin'
import TelementryDeckPlugin from './'

const app = createApp(App)
app.use(TelementryDeckPlugin, {
Expand Down
10 changes: 6 additions & 4 deletions src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import TelemetryDeck from "@telemetrydeck/sdk";
import type { Plugin } from 'vue';

const plugin: Plugin = {
export const plugin: Plugin = {
install(app, options) {
if (!options.appID) {
throw new Error('TelemetryDeck appID is required');
}
const td = options.appID

? new TelemetryDeck({
appID: options.appID,
clientUser: options.clientUser || 'guest',
Expand All @@ -12,6 +16,4 @@ const plugin: Plugin = {
: undefined;
app.provide('td', td);
},
};

export default plugin;
};
3 changes: 3 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
coverage: {
reporter: ['json-summary', 'text', 'lcov'],
},
},
});

0 comments on commit ac53cbb

Please sign in to comment.