Stting up vitest.

This commit is contained in:
Eric van der Vlist 2023-02-09 13:57:14 +01:00
parent 4b952001c3
commit 2387b1a4e9
5 changed files with 71 additions and 36 deletions

62
package-lock.json generated
View File

@ -21,7 +21,7 @@
"@capacitor/ios": "^4.6.3",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@solid-primitives/i18n": "^1.1.3",
"@solid-primitives/i18n": "^1.1.4",
"@solidjs/router": "^0.7.0",
"@suid/icons-material": "^0.5.8",
"@suid/material": "^0.10.1",
@ -34,14 +34,15 @@
"ol": "^7.2.2",
"osmtogeojson": "^3.0.0-beta.5",
"patch-package": "^6.5.1",
"pouchdb": "^8.0.0",
"pouchdb-browser": "^8.0.0",
"pouchdb": "^8.0.1",
"pouchdb-browser": "^8.0.1",
"proj4": "^2.8.1",
"solid-js": "^1.6.10",
"vite-plugin-solid-svg": "^0.6.0"
},
"devDependencies": {
"@capacitor/cli": "^4.6.3",
"@solidjs/testing-library": "^0.6.1",
"@testing-library/jest-dom": "^5.16.5",
"@types/lodash": "^4.14.191",
"@types/memoizee": "^0.4.8",
@ -51,7 +52,6 @@
"license-checker": "^25.0.1",
"license-compatibility-checker": "^0.3.5",
"license-report": "^6.3.0",
"solid-testing-library": ">=0.5.0",
"typescript": "^4.9.5",
"vite": ">=4.1.1",
"vite-plugin-solid": "^2.5.0",
@ -1436,9 +1436,9 @@
}
},
"node_modules/@solid-primitives/i18n": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@solid-primitives/i18n/-/i18n-1.1.3.tgz",
"integrity": "sha512-VbX4FZfIkqIrelFeGC1KgXME4aeS7kiAFb6IhIY7Ey4S+wOSGCiEesIwGeMHxyJ1xk0yCFS5YUVEXcQIBZysVw==",
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@solid-primitives/i18n/-/i18n-1.1.4.tgz",
"integrity": "sha512-TKTcwItoL+T0QJCf1W5Hav5Zdl4JKwWWdri34cgBpUEx4eSb5CouH3Mr3kH9cknaETV2oVU9lJObeCoQikLj0w==",
"peerDependencies": {
"solid-js": "^1.6.0"
}
@ -1451,6 +1451,21 @@
"solid-js": "^1.5.3"
}
},
"node_modules/@solidjs/testing-library": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@solidjs/testing-library/-/testing-library-0.6.1.tgz",
"integrity": "sha512-cS91EDopZhpVa+F55vLxbT+xrQEtc6jIYhXEleu7aCtPRKuBAhKGYQoiOAWrxRd2cXu678dhR8kuwp7ZS2gkNQ==",
"dev": true,
"dependencies": {
"@testing-library/dom": "^8.20.0"
},
"engines": {
"node": ">= 14"
},
"peerDependencies": {
"solid-js": ">=1.0.0"
}
},
"node_modules/@suid/base": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/@suid/base/-/base-0.6.3.tgz",
@ -1575,9 +1590,9 @@
}
},
"node_modules/@testing-library/dom": {
"version": "8.19.1",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.19.1.tgz",
"integrity": "sha512-P6iIPyYQ+qH8CvGauAqanhVnjrnRe0IZFSYCeGkSRW9q3u8bdVn2NPI+lasFyVsEQn1J/IFmp5Aax41+dAP9wg==",
"version": "8.20.0",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.20.0.tgz",
"integrity": "sha512-d9ULIT+a4EXLX3UU8FBjauG9NnsZHkHztXoIcTsOKoOw030fyjheN9svkTULjJxtYag9DZz5Jz5qkWZDPxTFwA==",
"dev": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
@ -6882,9 +6897,9 @@
}
},
"node_modules/pouchdb": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/pouchdb/-/pouchdb-8.0.0.tgz",
"integrity": "sha512-VYaPQ1CPTNjZ+Ltm/pl4llaDMTRCZrpg7TZ/2BpeA8RrawE66CRW7aGSWzgQarW8j/KHwEz5cVv/mwj9RMnCTg==",
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/pouchdb/-/pouchdb-8.0.1.tgz",
"integrity": "sha512-xp5S83JOQn2NAL0ZQ5CU+DI26V9/YrYuVtkXnbGEIDrYiFfj5A8gAcfbxefXb/9O+Qn4n5RaT/19+8UBSZ42sw==",
"dependencies": {
"abort-controller": "3.0.0",
"buffer-from": "1.1.2",
@ -6907,9 +6922,9 @@
}
},
"node_modules/pouchdb-browser": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/pouchdb-browser/-/pouchdb-browser-8.0.0.tgz",
"integrity": "sha512-ygZa7QPcab9Rz+gkhJfc+XM1H932FhMurrbjIGC6/RTBOXyN7ZighX6pCxtbju/h5AVXPQQoilJE2O7MYasa0g==",
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/pouchdb-browser/-/pouchdb-browser-8.0.1.tgz",
"integrity": "sha512-wXObS1Layd/gBRKwa6EBS99tFY9G3VPaMRu8ffWCohkpi9PZCm3z1xeB4P4S9Qecf0u5so+rxvbVVyTtgdhvaQ==",
"dependencies": {
"immediate": "3.3.0",
"spark-md5": "3.0.2",
@ -7615,21 +7630,6 @@
"solid-js": "^1.3"
}
},
"node_modules/solid-testing-library": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/solid-testing-library/-/solid-testing-library-0.5.0.tgz",
"integrity": "sha512-vr4Ke9Dq3bUFLaXOcN8/IVn2e9Q37w4vdmoIOmFBIPs7iCJX9IxuC0IdQqK8nzBZMQqceijkfyCE3Qc407KmaA==",
"dev": true,
"dependencies": {
"@testing-library/dom": "^8.19.0"
},
"engines": {
"node": ">= 14"
},
"peerDependencies": {
"solid-js": ">=1.0.0"
}
},
"node_modules/sort-asc": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/sort-asc/-/sort-asc-0.1.0.tgz",

View File

@ -14,6 +14,7 @@
"license": "GPL-3.0-only",
"devDependencies": {
"@capacitor/cli": "^4.6.3",
"@solidjs/testing-library": "^0.6.1",
"@testing-library/jest-dom": "^5.16.5",
"@types/lodash": "^4.14.191",
"@types/memoizee": "^0.4.8",
@ -23,7 +24,6 @@
"license-checker": "^25.0.1",
"license-compatibility-checker": "^0.3.5",
"license-report": "^6.3.0",
"solid-testing-library": ">=0.5.0",
"typescript": "^4.9.5",
"vite": ">=4.1.1",
"vite-plugin-solid": "^2.5.0",
@ -41,7 +41,7 @@
"@capacitor/ios": "^4.6.3",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@solid-primitives/i18n": "^1.1.3",
"@solid-primitives/i18n": "^1.1.4",
"@solidjs/router": "^0.7.0",
"@suid/icons-material": "^0.5.8",
"@suid/material": "^0.10.1",
@ -54,8 +54,8 @@
"ol": "^7.2.2",
"osmtogeojson": "^3.0.0-beta.5",
"patch-package": "^6.5.1",
"pouchdb": "^8.0.0",
"pouchdb-browser": "^8.0.0",
"pouchdb": "^8.0.1",
"pouchdb-browser": "^8.0.1",
"proj4": "^2.8.1",
"solid-js": "^1.6.10",
"vite-plugin-solid-svg": "^0.6.0"

5
src/db/gpx.test.ts Normal file
View File

@ -0,0 +1,5 @@
import { describe, it } from 'vitest';
describe('putNewGpx', () => {
it("doesn't return an error", () => {});
});

View File

@ -64,7 +64,7 @@ const compactRteOrTrkseg = (params: any) => {
export const compactRteOrTrksegDebounced = debounceByParam(
compactRteOrTrkseg,
property('id'),
3600000 * (1 + Math.random())
60 * 60 * 1000 * (1 + Math.random())
);
export const getRteDocs: ({

30
vitest.config.ts Normal file
View File

@ -0,0 +1,30 @@
/// <reference types="vitest" />
/// <reference types="vite/client" />
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
test: {
environment: 'jsdom',
globals: true,
transformMode: { web: [/\.[jt]sx?$/] },
setupFiles: ['node_modules/@testing-library/jest-dom/extend-expect.js'],
// otherwise, solid would be loaded twice:
deps: { registerNodeLoader: true },
// if you have few tests, try commenting one
// or both out to improve performance:
threads: false,
isolate: false,
},
build: {
target: 'esnext',
},
resolve: {
conditions: ['development', 'browser'],
},
});