Skip to content

Commit 9eb9e61

Browse files
committed
adding jsonToGraphQLQuery plugin in vite.config.mjs
1 parent c3c348e commit 9eb9e61

File tree

3 files changed

+113
-114
lines changed

3 files changed

+113
-114
lines changed

src/components/Registry/__tests__/CollapseTreeGraph.spec.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ describe("CollapseTreeGraph.vue", function () {
4646
});
4747

4848
it("can check if getGraphData method have the error in catch block", async () => {
49-
getStub.withArgs(sinon.match.any).returns({
50-
status: 404,
51-
});
49+
getStub.withArgs(sinon.match.any).returns(new Error("error"));
5250
await wrapper.vm.getGraphData();
5351
expect(wrapper.vm.noData).toBe(true);
5452
});

vite.config.mjs

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,76 @@
1-
import {defineConfig} from "vite";
2-
import {fileURLToPath, URL} from "url";
1+
import { defineConfig } from "vite";
2+
import { fileURLToPath, URL } from "url";
33
import vue from "@vitejs/plugin-vue";
4-
import vuetify, {transformAssetUrls} from "vite-plugin-vuetify";
4+
import vuetify, { transformAssetUrls } from "vite-plugin-vuetify";
55
import dns from "node:dns";
66
import eslintPlugin from "vite-plugin-eslint";
7-
import path from 'path'
8-
import {nodePolyfills} from 'vite-plugin-node-polyfills';
9-
import compress from 'vite-plugin-compress'
7+
import path from "path";
8+
import { nodePolyfills } from "vite-plugin-node-polyfills";
9+
import compress from "vite-plugin-compress";
10+
import { jsonToGraphQLQuery } from "json-to-graphql-query";
1011

1112
dns.setDefaultResultOrder("verbatim");
1213

13-
const __filename = fileURLToPath(import.meta.url)
14+
const __filename = fileURLToPath(import.meta.url);
1415
const __dirname = path.dirname(__filename);
1516

1617
export default defineConfig({
17-
base: "./",
18-
server: {
19-
host: true,
20-
open: true,
21-
port: 8084
18+
base: "./",
19+
server: {
20+
host: true,
21+
open: true,
22+
port: 8084
23+
},
24+
preview: {
25+
host: true,
26+
open: true,
27+
port: 8085
28+
},
29+
test: {
30+
environment: "jsdom",
31+
globals: true
32+
},
33+
plugins: [
34+
vue({ template: { transformAssetUrls } }),
35+
vuetify({
36+
autoImport: true
37+
}),
38+
eslintPlugin,
39+
nodePolyfills(),
40+
compress,
41+
jsonToGraphQLQuery
42+
],
43+
resolve: {
44+
alias: {
45+
"@": fileURLToPath(new URL("./src", import.meta.url)),
46+
"source-map-js": "source-map"
2247
},
23-
preview: {
24-
host: true,
25-
open: true,
26-
port: 8085,
27-
},
28-
test: {
29-
environment: "jsdom",
30-
globals: true,
31-
},
32-
plugins: [
33-
vue({template: {transformAssetUrls}}),
34-
vuetify({
35-
autoImport: true,
36-
}),
37-
eslintPlugin,
38-
nodePolyfills(),
39-
compress,
40-
],
41-
resolve: {
42-
alias: {
43-
"@": fileURLToPath(new URL("./src", import.meta.url)),
44-
"source-map-js": "source-map"
45-
},
46-
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue", ".svg"],
47-
},
48-
optimizeDeps: {
49-
include: ["vuetify"],
50-
},
51-
css: {
52-
preprocessorOptions: {
53-
scss: {
54-
additionalData: `@use "@/styles/index.scss";`,
55-
api: "modern-compiler", // or "modern"
56-
},
57-
},
58-
},
59-
build: {
60-
// outDir: 'dist',
61-
assetsDir: 'assets',
62-
minify: 'esbuild',
63-
target: 'es2015',
64-
cssCodeSplit: true,
65-
chunkSizeWarningLimit: 1250,
66-
rollupOptions: {
67-
input: path.resolve(__dirname, "index.html"),
68-
output: {
69-
dir: "dist",
70-
format: "es",
71-
},
72-
}
48+
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue", ".svg"]
49+
},
50+
optimizeDeps: {
51+
include: ["vuetify"]
52+
},
53+
css: {
54+
preprocessorOptions: {
55+
scss: {
56+
additionalData: `@use "@/styles/index.scss";`,
57+
api: "modern-compiler" // or "modern"
58+
}
59+
}
60+
},
61+
build: {
62+
// outDir: 'dist',
63+
assetsDir: "assets",
64+
minify: "esbuild",
65+
target: "es2015",
66+
cssCodeSplit: true,
67+
chunkSizeWarningLimit: 1250,
68+
rollupOptions: {
69+
input: path.resolve(__dirname, "index.html"),
70+
output: {
71+
dir: "dist",
72+
format: "es"
73+
}
7374
}
75+
}
7476
});

vitest.config.js

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,53 @@
1-
import {fileURLToPath} from "node:url";
2-
import {defineConfig, mergeConfig} from "vite";
3-
import {configDefaults} from "vitest/config";
1+
import { fileURLToPath } from "node:url";
2+
import { defineConfig, mergeConfig } from "vite";
3+
import { configDefaults } from "vitest/config";
44
import viteConfig from "./vite.config.mjs";
5-
import {URL} from "url";
5+
import { URL } from "url";
66

77
export default mergeConfig(
8-
viteConfig,
9-
defineConfig({
10-
test: {
11-
server: {
12-
deps: {
13-
inline: ["vuetify"],
14-
},
15-
},
16-
environment: "jsdom",
17-
exclude: [...configDefaults.exclude, "e2e/*"],
18-
root: fileURLToPath(new URL("./", import.meta.url)),
19-
transformMode: {
20-
web: [/\.[jt]sx$/],
21-
},
22-
coverage: {
23-
provider: "v8", // or 'istanbul'
24-
ignoreEmptyLines: true,
25-
thresholds: {
26-
autoUpdate: true,
27-
},
28-
css: true,
29-
exclude: [
30-
"dist/*",
31-
"documentation/*",
32-
"src/main.js",
33-
"src/documentation/process_doc.js",
34-
"src/stores/index.js",
35-
"src/plugins/**",
36-
"src/router/**",
37-
"tests/*",
38-
".eslintrc.js",
39-
"vite.config.mjs",
40-
"vitest.config.js",
41-
"vue.config.js",
42-
"webpack.config.js",
43-
"eslint.config.js",
44-
"src/components/Navigation/PageHeader/Menu.vue",
45-
"src/stores/*",
46-
"src/utils/d3Graph.js",
47-
],
48-
reporter: ["html", "lcov", "text"],
49-
reportOnFailure: true,
50-
},
51-
dangerouslyIgnoreUnhandledErrors: true,
8+
viteConfig,
9+
defineConfig({
10+
test: {
11+
server: {
12+
deps: {
13+
inline: ["vuetify"]
14+
}
15+
},
16+
environment: "jsdom",
17+
exclude: [...configDefaults.exclude, "e2e/*"],
18+
root: fileURLToPath(new URL("./", import.meta.url)),
19+
transformMode: {
20+
web: [/\.[jt]sx$/]
21+
},
22+
coverage: {
23+
provider: "v8", // or 'istanbul'
24+
ignoreEmptyLines: true,
25+
thresholds: {
26+
autoUpdate: true
5227
},
53-
}),
28+
css: true,
29+
exclude: [
30+
"dist/*",
31+
"documentation/*",
32+
"src/main.js",
33+
"src/documentation/process_doc.js",
34+
"src/plugins/**",
35+
"src/router/**",
36+
"tests/*",
37+
".eslintrc.js",
38+
"vite.config.mjs",
39+
"vitest.config.js",
40+
"vue.config.js",
41+
"webpack.config.js",
42+
"eslint.config.js",
43+
"src/components/Navigation/PageHeader/Menu.vue",
44+
"src/stores/*",
45+
"src/utils/d3Graph.js"
46+
],
47+
reporter: ["html", "lcov", "text"],
48+
reportOnFailure: true
49+
},
50+
dangerouslyIgnoreUnhandledErrors: true
51+
}
52+
})
5453
);

0 commit comments

Comments
 (0)