mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(highlightjs): add test
This commit is contained in:
parent
6625997554
commit
294727600b
@ -5,3 +5,7 @@ This library was generated with [Nx](https://nx.dev).
|
|||||||
## Building
|
## Building
|
||||||
|
|
||||||
Run `nx build highlightjs` to build the library.
|
Run `nx build highlightjs` to build the library.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `nx test highlightjs` to execute the unit tests via [Vitest](https://vitest.dev/).
|
||||||
|
14
packages/highlightjs/src/syntax_highlighting.spec.ts
Normal file
14
packages/highlightjs/src/syntax_highlighting.spec.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { describe, it } from "vitest";
|
||||||
|
import definitions from "./syntax_highlighting.js";
|
||||||
|
|
||||||
|
describe("Syntax highlighting definitions", () => {
|
||||||
|
it("every entry is readable", async () => {
|
||||||
|
for (const [ mime, mapping ] of Object.entries(definitions)) {
|
||||||
|
if (mapping === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
await mapping.loader;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
@ -5,6 +5,9 @@
|
|||||||
"references": [
|
"references": [
|
||||||
{
|
{
|
||||||
"path": "./tsconfig.lib.json"
|
"path": "./tsconfig.lib.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.spec.json"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,19 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts"
|
"src/**/*.ts"
|
||||||
],
|
],
|
||||||
"references": []
|
"references": [],
|
||||||
|
"exclude": [
|
||||||
|
"vite.config.ts",
|
||||||
|
"vite.config.mts",
|
||||||
|
"vitest.config.ts",
|
||||||
|
"vitest.config.mts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.test.tsx",
|
||||||
|
"src/**/*.spec.tsx",
|
||||||
|
"src/**/*.test.js",
|
||||||
|
"src/**/*.spec.js",
|
||||||
|
"src/**/*.test.jsx",
|
||||||
|
"src/**/*.spec.jsx"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
36
packages/highlightjs/tsconfig.spec.json
Normal file
36
packages/highlightjs/tsconfig.spec.json
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/vitest",
|
||||||
|
"types": [
|
||||||
|
"vitest/globals",
|
||||||
|
"vitest/importMeta",
|
||||||
|
"vite/client",
|
||||||
|
"node",
|
||||||
|
"vitest"
|
||||||
|
],
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noImplicitReturns": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"vite.config.ts",
|
||||||
|
"vite.config.mts",
|
||||||
|
"vitest.config.ts",
|
||||||
|
"vitest.config.mts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.test.tsx",
|
||||||
|
"src/**/*.spec.tsx",
|
||||||
|
"src/**/*.test.js",
|
||||||
|
"src/**/*.spec.js",
|
||||||
|
"src/**/*.test.jsx",
|
||||||
|
"src/**/*.spec.jsx",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.lib.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference types='vitest' />
|
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import dts from 'vite-plugin-dts';
|
import dts from 'vite-plugin-dts';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@ -6,7 +6,7 @@ import * as path from 'path';
|
|||||||
export default defineConfig(() => ({
|
export default defineConfig(() => ({
|
||||||
root: __dirname,
|
root: __dirname,
|
||||||
cacheDir: '../../node_modules/.vite/packages/highlightjs',
|
cacheDir: '../../node_modules/.vite/packages/highlightjs',
|
||||||
plugins: [dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') })],
|
plugins: [dts({ entryRoot: 'src', tsconfigPath: path.join(__dirname, 'tsconfig.lib.json') }), ],
|
||||||
// Uncomment this if you are using workers.
|
// Uncomment this if you are using workers.
|
||||||
// worker: {
|
// worker: {
|
||||||
// plugins: [ nxViteTsPaths() ],
|
// plugins: [ nxViteTsPaths() ],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user