add: TS tests

This commit is contained in:
windingwind 2024-12-08 22:29:39 +01:00
parent 32993ba7cc
commit 085d393ddb
8 changed files with 53 additions and 4 deletions

29
package-lock.json generated
View File

@ -35,15 +35,18 @@
"unist-util-visit": "^5.0.0",
"unist-util-visit-parents": "^6.0.1",
"yamljs": "^0.3.0",
"zotero-plugin-scaffold": "file:../zotero-plugin-scaffold",
"zotero-plugin-toolkit": "^4.0.11"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@prettier/plugin-xml": "^3.2.2",
"@types/browser-or-node": "^1.3.2",
"@types/chai": "^5.0.1",
"@types/diff": "^5.0.9",
"@types/html-docx-js": "^0.3.4",
"@types/katex": "^0.16.7",
"@types/mocha": "^10.0.10",
"@types/node": "^20.10.4",
"@types/path-browserify": "^1.0.2",
"@types/seedrandom": "^3.0.8",
@ -68,7 +71,6 @@
},
"../zotero-plugin-scaffold": {
"version": "0.1.7",
"extraneous": true,
"license": "AGPL-3.0-or-later",
"dependencies": {
"@babel/generator": "^7.26.3",
@ -405,6 +407,15 @@
"integrity": "sha512-CkvJrvVMI4ZHbiL+Df22Owzq1IYnHnoSrM8s6Dmy4MRdqvdFi9bHsIvyFrSGJPOxvFI9Y3MqY2gFCqIafJBcfw==",
"dev": true
},
"node_modules/@types/chai": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.0.1.tgz",
"integrity": "sha512-5T8ajsg3M/FOncpLYW7sdOcD6yf4+722sze/tc4KQV0P8Z2rAr3SAuHCIkYmYpt8VbcQlnz8SxlOlPQYefe4cA==",
"dev": true,
"dependencies": {
"@types/deep-eql": "*"
}
},
"node_modules/@types/debug": {
"version": "4.1.12",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
@ -413,6 +424,12 @@
"@types/ms": "*"
}
},
"node_modules/@types/deep-eql": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
"integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
"dev": true
},
"node_modules/@types/diff": {
"version": "5.0.9",
"resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.0.9.tgz",
@ -474,6 +491,12 @@
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz",
"integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA=="
},
"node_modules/@types/mocha": {
"version": "10.0.10",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz",
"integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==",
"dev": true
},
"node_modules/@types/ms": {
"version": "0.7.34",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
@ -7648,6 +7671,10 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/zotero-plugin-scaffold": {
"resolved": "../zotero-plugin-scaffold",
"link": true
},
"node_modules/zotero-plugin-toolkit": {
"version": "4.0.11",
"resolved": "https://registry.npmjs.org/zotero-plugin-toolkit/-/zotero-plugin-toolkit-4.0.11.tgz",

View File

@ -57,15 +57,18 @@
"unist-util-visit": "^5.0.0",
"unist-util-visit-parents": "^6.0.1",
"yamljs": "^0.3.0",
"zotero-plugin-scaffold": "file:../zotero-plugin-scaffold",
"zotero-plugin-toolkit": "^4.0.11"
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@prettier/plugin-xml": "^3.2.2",
"@types/browser-or-node": "^1.3.2",
"@types/chai": "^5.0.1",
"@types/diff": "^5.0.9",
"@types/html-docx-js": "^0.3.4",
"@types/katex": "^0.16.7",
"@types/mocha": "^10.0.10",
"@types/node": "^20.10.4",
"@types/path-browserify": "^1.0.2",
"@types/seedrandom": "^3.0.8",

8
test/tsconfig.json Normal file
View File

@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"composite": true
},
"include": ["./**/*.spec.ts", "typings", "../node_modules/zotero-types"],
"exclude": []
}

6
test/typings/global.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
import type * as chai from "chai";
declare global {
const expect: typeof chai.expect;
const assert: typeof chai.assert;
}

View File

@ -7,8 +7,12 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"alwaysStrict": false,
"strict": true
"strict": true,
"composite": true
},
"include": ["src", "typings", "node_modules/zotero-types"],
"exclude": ["build", "addon"]
"exclude": ["build", "addon", "test"],
"references": [
{ "path": "./test" }
]
}

View File

@ -69,7 +69,8 @@ export default defineConfig({
entries: ["test/"],
prefs: {},
abortOnFail: true,
exitOnFinish: true,
exitOnFinish: false,
hooks: {},
},
// If you need to see a more detailed build log, uncomment the following line: