Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"stylelint-config-standard-scss": "^17.0.0",
"syncpack": "^15.3.3",
"tsx": "^4.23.13",
"typescript": "^6.0.3"
"typescript": "^7.0.2"
},
"pnpm": {
"patchedDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-web-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@types/node": "^24.13.4",
"@types/react": "^19.3.0",
"sass": "^1.104.0",
"typescript": "^6.0.3",
"typescript": "^7.0.2",
"unified": "^11.0.5"
}
}
4 changes: 2 additions & 2 deletions packages/app-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
},
"devDependencies": {
"@types/node": "^24.13.4",
"typescript": "^6.0.3",
"vite": "^8.2.2",
"typescript": "^7.0.2",
"vite": "^8.3.0",
"vite-plugin-purgecss": "^0.2.13",
"vite-plugin-svgr": "^5.2.0"
}
Expand Down
17 changes: 0 additions & 17 deletions packages/lib-cheatsheet-local/jest.config.ts

This file was deleted.

11 changes: 5 additions & 6 deletions packages/lib-cheatsheet-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
"private": true,
"type": "module",
"scripts": {
"typecheck": "tsc",
"typecheck": "tsc && tsc -p ./test/tsconfig.json",
"clean": "rm -rf ./out ./dist ./tsconfig.tsbuildinfo",
"test": "jest",
"dev": "env NODE_OPTIONS=--import=tsx vite serve",
"bundle:prod": "env NODE_OPTIONS=--import=tsx vite build",
"bundle:dev": "env NODE_OPTIONS=--import=tsx vite build --mode development",
Expand All @@ -21,11 +20,11 @@
"preact": "^10.29.8"
},
"devDependencies": {
"@jest/globals": "^30.5.1",
"@types/mocha": "^10.0.10",
"@types/node": "^24.13.4",
"jest": "^30.5.1",
"typescript": "^6.0.3",
"vite": "^8.2.2",
"mocha": "^12.0.0",
"typescript": "^7.0.2",
"vite": "^8.3.0",
"vite-plugin-purgecss": "^0.2.13",
"vite-plugin-singlefile": "^2.3.3"
}
Expand Down
2 changes: 0 additions & 2 deletions packages/lib-cheatsheet-local/src/test/styleMock.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
import { afterEach, beforeEach, describe, expect, it } from "@jest/globals";
import assert from "node:assert/strict";
import { render } from "preact";
import { act } from "preact/test-utils";
import { fakeCheatsheetInfo } from "@cursorless/lib-cheatsheet";
import { App } from "../app";
import { App } from "../src/app";

describe("App", () => {
beforeEach(() => {
suite("App", () => {
setup(() => {
document.cheatsheetInfo = fakeCheatsheetInfo;
});

afterEach(() => {
teardown(() => {
for (const container of document.body.children) {
render(null, container);
}
document.body.innerHTML = "";
});

it("should render successfully", async () => {
test("should render successfully", async () => {
const container = document.createElement("div");
document.body.append(container);

await act(() => {
render(<App />, container);
});

expect(container).toBeTruthy();
assert.ok(container.childElementCount > 0);
});

it("should have a greeting as the title", async () => {
test("should have a greeting as the title", async () => {
const container = document.createElement("div");
document.body.append(container);

await act(() => {
render(<App />, container);
});

expect(container.textContent).toMatch(/Cursorless Cheatsheet/giu);
assert.match(container.textContent, /Cursorless Cheatsheet/giu);
});
});
7 changes: 7 additions & 0 deletions packages/lib-cheatsheet-local/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["node", "mocha"]
},
"include": ["**/*.ts", "**/*.tsx", "../../../resources/typings/**/*.d.ts"]
}
9 changes: 0 additions & 9 deletions packages/lib-cheatsheet-local/tsconfig.jest.json

This file was deleted.

3 changes: 1 addition & 2 deletions packages/lib-cheatsheet-local/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"src/**/*.tsx",
"src/**/*.json",
"../../resources/typings/**/*.d.ts"
],
"exclude": ["src/test"]
]
}
17 changes: 0 additions & 17 deletions packages/lib-cheatsheet/jest.config.ts

This file was deleted.

14 changes: 6 additions & 8 deletions packages/lib-cheatsheet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
"*.css"
],
"scripts": {
"typecheck": "tsc",
"clean": "rm -rf ./out ./dist ./tsconfig.tsbuildinfo",
"test": "jest"
"typecheck": "tsc && tsc -p ./test/tsconfig.json",
"clean": "rm -rf ./out ./dist ./tsconfig.tsbuildinfo"
},
"dependencies": {
"@cursorless/lib-common": "workspace:*",
"preact": "^10.29.8",
"react-bootstrap-icons": "^1.11.6"
},
"devDependencies": {
"@jest/globals": "^30.5.1",
"@types/mocha": "^10.0.10",
"@types/node": "^24.13.4",
"jest": "^30.5.1",
"jest-environment-jsdom": "^30.5.1",
"ts-jest": "^29.4.12",
"typescript": "^6.0.3"
"@types/react": "^19.3.0",
"mocha": "^12.0.0",
"typescript": "^7.0.2"
}
}
22 changes: 0 additions & 22 deletions packages/lib-cheatsheet/src/test/cheatsheet.spec.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions packages/lib-cheatsheet/src/test/formatCaptures.spec.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions packages/lib-cheatsheet/src/test/styleMock.ts

This file was deleted.

25 changes: 25 additions & 0 deletions packages/lib-cheatsheet/test/cheatsheet.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import assert from "node:assert/strict";
import { render } from "preact";
import { act } from "preact/test-utils";
import { Cheatsheet } from "../src/lib/Cheatsheet";
import { fakeCheatsheetInfo } from "../src/lib/utils/fakeCheatsheetInfo";

suite("Cheatsheet", () => {
teardown(() => {
for (const container of document.body.children) {
render(null, container);
}
document.body.innerHTML = "";
});

test("should render successfully", async () => {
const container = document.createElement("div");
document.body.append(container);

await act(() => {
render(<Cheatsheet cheatsheetInfo={fakeCheatsheetInfo} />, container);
});

assert.ok(container.childElementCount > 0);
});
});
38 changes: 38 additions & 0 deletions packages/lib-cheatsheet/test/formatCaptures.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import assert from "node:assert/strict";
import { render } from "preact";
import { act } from "preact/test-utils";
import { formatCaptures } from "../src/lib/utils/formatCaptures";

suite("formatCaptures", () => {
teardown(() => {
for (const container of document.body.children) {
render(null, container);
}
document.body.innerHTML = "";
});

test("formats capture placeholders", async () => {
const container = document.createElement("div");
document.body.append(container);

await act(() => {
render(<div>{formatCaptures("hello <target> world")}</div>, container);
});

assert.equal(container.textContent, "hello [target] world");
assert.notEqual(container.querySelector('a[href="#legend"]'), null);
});

test("leaves malformed captures as plain text", async () => {
const container = document.createElement("div");
document.body.append(container);
const input = "<<=<=<=";

await act(() => {
render(<div>{formatCaptures(input)}</div>, container);
});

assert.equal(container.textContent, input);
assert.equal(container.querySelector('a[href="#legend"]'), null);
});
});
Loading
Loading