-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wrapper): remove dep to @types/vscode (#167)
This could cause consuming projects to have multiple versions of @types/vscode which can cause compliation errors in TSC BREAKING CHANGE: `getConfigurations` and `onDidChangeConfiguration` properties were removed from the `configureLogger` public API
- Loading branch information
Showing
9 changed files
with
87 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module.exports = { | ||
reporter: ["text", "lcov"], | ||
"check-coverage": false, | ||
all: true, | ||
include: ["dist/src/**/*.js"], | ||
exclude: [ | ||
// The `api.ts` is the only file which imports("vscode") | ||
// We could still test it (e.g: with `proxyquire`) | ||
// However the added value of such a test is smaller than | ||
// the overhead cost of implementing such a test: | ||
// - The api.ts only | ||
// 1. Import needed params from `vscode` package. | ||
// 2. merges user arguments with `vscode` params and calls an internal API. | ||
// | ||
// - These merges are partially "tested" at design time by TSC. | ||
// - Implementing a test with proxyquire would not test real VSCode scenarios | ||
// - The existing `configureLogger` tests are fairly complex and we are better off avoiding duplicating them. | ||
// - See: `configure-logger-spec.ts`. | ||
"dist/src/api.js" | ||
], | ||
excludeAfterRemap: false | ||
}; |
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 |
---|---|---|
@@ -1,2 +1,25 @@ | ||
export { configureLogger } from "./configure-logger"; | ||
/** | ||
* This is the only file in the `src` folder we import("vscode") | ||
* The rest of the code is implemented with Dependency Injection to | ||
* the relevant VSCode APIs to enable easier testing. | ||
*/ | ||
import { workspace } from "vscode"; | ||
import { configureLoggerInternal } from "./configure-logger"; | ||
import { BasicOutputChannel } from "@vscode-logging/logger"; | ||
export { NOOP_LOGGER } from "./noop-logger"; | ||
|
||
export function configureLogger(opts: { | ||
extName: string; | ||
logPath: string; | ||
loggingLevelProp: string; | ||
sourceLocationProp: string; | ||
logOutputChannel?: BasicOutputChannel; | ||
logConsole?: boolean; | ||
subscriptions: { dispose(): any }[]; | ||
}) { | ||
return configureLoggerInternal({ | ||
...opts, | ||
getConfiguration: workspace.getConfiguration, | ||
onDidChangeConfiguration: workspace.onDidChangeConfiguration | ||
}); | ||
} |
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