-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow specifying a subdirectory in which to start Lexical (#66)
* Add config to start Lexical in workspace sub-directory * extract config helper * add configuration tests * update changelog
- Loading branch information
1 parent
0b8d593
commit 5f135b1
Showing
6 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { describe, test, jest, expect } from "@jest/globals"; | ||
import Configuration from "../configuration"; | ||
import { URI } from "vscode-uri"; | ||
import WorkspaceFixture from "./fixtures/workspace-fixture"; | ||
|
||
describe("Configuration", () => { | ||
test("getProjectDirUri returns the workspace URI when project dir is not configured", () => { | ||
const getConfigMock = jest.fn().mockReturnValue(undefined); | ||
const workspace = WorkspaceFixture.withUri(URI.file("/stub")); | ||
const projectDirUri = Configuration.getProjectDirUri( | ||
getConfigMock, | ||
workspace | ||
); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
expect(projectDirUri).toEqual(workspace.workspaceFolders![0].uri); | ||
}); | ||
|
||
test("getProjectDirUri returns the full directory URI when project dir is configured", () => { | ||
const getConfigMock = jest.fn().mockReturnValue("subdirectory"); | ||
const workspace = WorkspaceFixture.withUri(URI.file("/stub")); | ||
const projectDirUri = Configuration.getProjectDirUri( | ||
getConfigMock, | ||
workspace | ||
); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
expect(projectDirUri).toEqual(URI.file("/stub/subdirectory")); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { URI } from "vscode-uri"; | ||
|
||
import type { workspace as vsWorkspace } from "vscode"; | ||
|
||
namespace WorkspaceFixture { | ||
export function withUri(uri: URI): typeof vsWorkspace { | ||
return { | ||
workspaceFolders: [{ uri }], | ||
} as unknown as typeof vsWorkspace; | ||
} | ||
} | ||
|
||
export default WorkspaceFixture; |