Create test ts project in ligatures addon

This commit is contained in:
Daniel Imms
2025-12-24 12:09:28 -08:00
parent 23f61911e2
commit 5e5c623d8b
4 changed files with 36 additions and 7 deletions
@@ -5,9 +5,13 @@
import * as path from 'path';
import { assert } from 'chai';
import * as fontFinder from 'font-finder';
import * as ligatureSupport from '.';
// Use require to get a mutable module object (ESM imports create read-only bindings)
// eslint-disable-next-line @typescript-eslint/no-require-imports
const fontFinder = require('font-finder');
// eslint-disable-next-line @typescript-eslint/no-require-imports
const ligatureSupport = require('../out-esbuild/index');
const originalList = fontFinder.list;
@@ -18,7 +22,7 @@ describe('LigaturesAddon', () => {
const input = 'a -> b www c';
before(() => {
(fontFinder as any).list = () => Promise.resolve({
fontFinder.list = () => Promise.resolve({
'Fira Code': [{
path: path.join(__dirname, '../fonts/firaCode.otf'),
style: fontFinder.Style.Regular,
@@ -37,11 +41,11 @@ describe('LigaturesAddon', () => {
type: fontFinder.Type.Monospace,
weight: 400
}]
} as fontFinder.FontList);
});
});
after(() => {
(fontFinder as any).list = originalList;
fontFinder.list = originalList;
});
beforeEach(() => {
@@ -5,7 +5,8 @@
import { assert } from 'chai';
import parse from './parse';
// eslint-disable-next-line @typescript-eslint/no-require-imports
const parse = require('../out-esbuild/parse').default;
// TODO: integrate tests from http://test.csswg.org/suites/css-fonts-4_dev/nightly-unstable/
describe('parse', () => {
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ESNext",
"lib": [
"es2021"
],
"rootDir": ".",
"outDir": "../out-esbuild-test",
"sourceMap": true,
"removeComments": true,
"baseUrl": ".",
"strict": true,
"types": [
"../../../node_modules/@types/mocha",
"../../../node_modules/@types/node"
]
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
]
}
+2 -1
View File
@@ -2,6 +2,7 @@
"files": [],
"include": [],
"references": [
{ "path": "./src" }
{ "path": "./src" },
{ "path": "./test" }
]
}