Skip to content

Commit

Permalink
Stop publishing API docs (#1750)
Browse files Browse the repository at this point in the history
- Fixes #1749
- Will do a `pnpm remove` on all our typedoc dependencies once #1745 is
merged so we don't get massive merge conflicts on our `pnpm.lock` 😅
- Our website deploy has gone from more than 12 minutes to 1 min 20 sec
🙌

## Checklist

- [ ] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [ ] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [ ] I have not broken the cheatsheet
  • Loading branch information
pokey committed Aug 8, 2023
1 parent 93918bd commit abc515d
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 108 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ node_modules
/package-lock.json
*.DS_Store

# TypeDoc output
docs/contributing/api/

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
Expand Down
6 changes: 2 additions & 4 deletions docs/contributing/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# Contributing

Welcome! So glad you've decided to help make Cursorless better. Once you've
learned how to [set up](#initial-setup) and [run / test a local copy of the
extension](#running--testing-extension-locally), you may want to check out the
[Cursorless API docs](api) to learn more about how Cursorless works. You may also find the [VSCode API docs](https://code.visualstudio.com/api) helpful to learn about VSCode extension development.
Welcome! So glad you've decided to help make Cursorless better. You'll want to start by getting [set up](#initial-setup) and learning how to [run / test a local copy of the
extension](#running--testing-extension-locally). You may also find the [VSCode API docs](https://code.visualstudio.com/api) helpful to learn about VSCode extension development.

## Initial setup

Expand Down
6 changes: 3 additions & 3 deletions docs/contributing/test-case-recorder.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ command run, and the final state, all in the form of a yaml document. See

## Test case recorder options

The test case recorder has several additional configuration options. The default configuration works for most tests, but you may find the following useful. For a full list of supported configuration options, see [the api docs](../api/interfaces/cursorless_engine_src_testCaseRecorder_TestCaseRecorder.internal.RecordTestCaseCommandArg/).
The test case recorder has several additional configuration options. The default configuration works for most tests, but you may find the following useful. For a full list of supported configuration options, see [`RecordTestCaseCommandOptions`](../../packages/cursorless-engine/src/testCaseRecorder/RecordTestCaseCommandOptions.ts).

### The options

Expand All @@ -55,15 +55,15 @@ By default, we don't capture the `that` mark returned by a command, unless the t

#### Testing the hat map

We have a way to test that the hats in the hat map update correctly during the course of a single phrase. These tests are also how we usually test our [range updating code](../api/modules/cursorless_engine_src_core_updateSelections_updateSelections).
We have a way to test that the hats in the hat map update correctly during the course of a single phrase. These tests are also how we usually test our [range updating code](../../packages/cursorless-engine/src/core/updateSelections/updateSelections.ts).

Any tests recorded in the `hatTokenMap` directory will automatically be treated as hat token map tests. To initiate a series of hat token map tests in another directory, say `"cursorless record navigation"`.

Then each time you record a test, you need to issue two commands. The second command should be of the form `"take air"` (or another decorated mark), and will tell the test case recorder which decorated mark you're checking.

### Default config per test case directory

Any test case directory that contains a `config.json` will set default configuration for all tests recorded in any descendant directory. For example, the file [`actions/config.json`](../../packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/actions/config.json) makes it so that all our action tests will capture the final `that` mark. For a full list of keys supported in this json, see [the api docs](../api/interfaces/cursorless_engine_src_testCaseRecorder_TestCaseRecorder.internal.RecordTestCaseCommandArg/).
Any test case directory that contains a `config.json` will set default configuration for all tests recorded in any descendant directory. For example, the file [`actions/config.json`](../../packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/actions/config.json) makes it so that all our action tests will capture the final `that` mark. For a full list of keys supported in this json, see [`RecordTestCaseCommandOptions`](../../packages/cursorless-engine/src/testCaseRecorder/RecordTestCaseCommandOptions.ts).

### Navigation map tests

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { ExtraSnapshotField } from "@cursorless/common";

/**
* This is the type of the `recordTestCase` command's argument. It is used to
* specify the options for recording a test case.
*/
export interface RecordTestCaseCommandOptions {
/**
* If this is set to `true`, then for each test case that we record, we expect
* that the user will issue a second command in each phrase, which refers to a
* decorated mark whose range we'd like to check that it got updated properly
* during the previous command. We use this functionality in order to check
* that the token range update works properly. For example, you might say
* `"chuck second car ox air take air"` to check that removing a character
* from a token properly updates the token.
*/
isHatTokenMapTest?: boolean;

/** If true decorations will be added to the test fixture */
isDecorationsTest?: boolean;

/**
* The directory in which to store the test cases that we record. If left out
* the user will be prompted to select a directory within the default recorded
* test case directory.
*/
directory?: string;

/**
* If `true`, don't show a little pop up each time to indicate we've recorded a
* test case
*/
isSilent?: boolean;

extraSnapshotFields?: ExtraSnapshotField[];

/**
* Whether to flash a background for calibrating a video recording
*/
showCalibrationDisplay?: boolean;

/**
* Whether we should record a tests which yield errors in addition to tests
* which do not error.
*/
recordErrors?: boolean;

/**
* Whether to capture the `that` mark returned by the action.
*/
captureFinalThatMark?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,56 +32,10 @@ import { TestCase } from "./TestCase";
import { StoredTargetMap } from "../core/StoredTargets";
import { CommandRunner } from "../CommandRunner";
import { generateSpokenForm } from "../generateSpokenForm";
import { RecordTestCaseCommandOptions } from "./RecordTestCaseCommandOptions";

const CALIBRATION_DISPLAY_DURATION_MS = 50;

interface RecordTestCaseCommandArg {
/**
* If this is set to `true`, then for each test case that we record, we expect
* that the user will issue a second command in each phrase, which refers to a
* decorated mark whose range we'd like to check that it got updated properly
* during the previous command. We use this functionality in order to check
* that the token range update works properly. For example, you might say
* `"chuck second car ox air take air"` to check that removing a character
* from a token properly updates the token.
*/
isHatTokenMapTest?: boolean;

/** If true decorations will be added to the test fixture */
isDecorationsTest?: boolean;

/**
* The directory in which to store the test cases that we record. If left out
* the user will be prompted to select a directory within the default recorded
* test case directory.
*/
directory?: string;

/**
* If `true`, don't show a little pop up each time to indicate we've recorded a
* test case
*/
isSilent?: boolean;

extraSnapshotFields?: ExtraSnapshotField[];

/**
* Whether to flash a background for calibrating a video recording
*/
showCalibrationDisplay?: boolean;

/**
* Whether we should record a tests which yield errors in addition to tests
* which do not error.
*/
recordErrors?: boolean;

/**
* Whether to capture the `that` mark returned by the action.
*/
captureFinalThatMark?: boolean;
}

const TIMING_CALIBRATION_HIGHLIGHT_ID = "timingCalibration";

/**
Expand Down Expand Up @@ -124,20 +78,20 @@ export class TestCaseRecorder {
this.takeSnapshot = this.takeSnapshot.bind(this);
}

async toggle(arg?: RecordTestCaseCommandArg) {
async toggle(options?: RecordTestCaseCommandOptions) {
if (this.active) {
showInfo(ide().messages, "recordStop", "Stopped recording test cases");
this.stop();
} else {
return await this.start(arg);
return await this.start(options);
}
}

async recordOneThenPause(arg?: RecordTestCaseCommandArg) {
async recordOneThenPause(options?: RecordTestCaseCommandOptions) {
this.pauseAfterNextCommand = true;
this.paused = false;
if (!this.active) {
return await this.start(arg);
return await this.start(options);
}
}

Expand Down Expand Up @@ -194,8 +148,8 @@ export class TestCaseRecorder {
return this.active && !this.paused;
}

async start(arg?: RecordTestCaseCommandArg) {
const { directory, ...explicitConfig } = arg ?? {};
async start(options?: RecordTestCaseCommandOptions) {
const { directory, ...explicitConfig } = options ?? {};

/**
* A list of paths of every parent directory between the root fixture
Expand Down Expand Up @@ -227,7 +181,7 @@ export class TestCaseRecorder {

// Look for a `config.json` file in ancestors of the recording directory,
// and merge it with the config provided when calling the command.
const config: RecordTestCaseCommandArg = merge(
const config: RecordTestCaseCommandOptions = merge(
{},
...(await Promise.all(
parentDirectories.map((parent) =>
Expand Down Expand Up @@ -532,7 +486,7 @@ function capitalize(str: string) {

async function readJsonIfExists(
path: string,
): Promise<RecordTestCaseCommandArg> {
): Promise<RecordTestCaseCommandOptions> {
let rawText: string;

try {
Expand Down
13 changes: 0 additions & 13 deletions packages/cursorless-org-docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,6 @@ const config = {
onBrokenMarkdownLinks: "throw",
trailingSlash: true,

plugins: [
[
"docusaurus-plugin-typedoc",
// TypeDoc options merged with docusaurus specific options
{
...require("./typedoc.js"),
docsRoot: "../../docs",
// Out path is relative to docsRoot
out: "contributing/api",
},
],
],

presets: [
[
"classic",
Expand Down
30 changes: 0 additions & 30 deletions packages/cursorless-org-docs/typedoc.js

This file was deleted.

0 comments on commit abc515d

Please sign in to comment.