MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / testOnlyMethod

Function testOnlyMethod

src/platform/common/utils/decorators.ts:156–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154
155// Mark a method to be used only in tests
156export function testOnlyMethod() {
157 // eslint-disable-next-line @typescript-eslint/no-explicit-any
158 return function (_target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) {
159 const originalMethod = descriptor.value;
160 // eslint-disable-next-line , @typescript-eslint/no-explicit-any
161 descriptor.value = function (...args: any[]) {
162 if (!isTestExecution()) {
163 throw new Error(`Function: ${propertyKey} can only be called from test code`);
164 }
165 return originalMethod.apply(this, args);
166 };
167
168 return descriptor;
169 };
170}
171
172// Mark a method that returns a promise to chain it
173export function chainable() {

Callers 2

ServiceManagerClass · 0.90
webviewHost.tsFile · 0.90

Calls 1

isTestExecutionFunction · 0.90

Tested by

no test coverage detected