MCPcopy
hub / github.com/microsoft/vscode-js-debug / itIntegratesBasic

Function itIntegratesBasic

src/test/testIntegrationUtils.ts:49–84  ·  view source on GitHub ↗
(
  test: string,
  fn: (s: IIntegrationState) => Promise<void> | void,
  testFunction: TestFunction | ExclusiveTestFunction = it,
)

Source from the content-addressed store, hash-verified

47}
48
49const itIntegratesBasic = (
50 test: string,
51 fn: (s: IIntegrationState) => Promise<void> | void,
52 testFunction: TestFunction | ExclusiveTestFunction = it,
53) =>
54 testFunction(test, async function() {
55 if (!this.test?.file) {
56 throw new Error(`Could not find file for test`);
57 }
58
59 const golden = new GoldenText(
60 this.test!.titlePath().join(' '),
61 this.test?.file!,
62 testWorkspace,
63 );
64 const root = new TestRoot(golden, this.test!.fullTitle());
65 await root.initialize;
66
67 try {
68 (this.test as IGoldenReporterTextTest).goldenText = golden;
69
70 await fn({ golden, r: root, context: this as Mocha.Context & { test: Mocha.Runnable } });
71 } finally {
72 try {
73 await root.disconnect();
74 } catch (e) {
75 console.warn('Error disconnecting test root:', e);
76 }
77 }
78
79 if (golden.hasNonAssertedLogs()) {
80 throw new Error(
81 `Whoa, test "${test}" has some logs that it did not assert!\n\n${golden.getOutput()}`,
82 );
83 }
84 });
85
86itIntegratesBasic.only = (test: string, fn: (s: IIntegrationState) => Promise<void> | void) =>
87 itIntegratesBasic(test, fn, it.only);

Callers 1

Calls 4

disconnectMethod · 0.95
hasNonAssertedLogsMethod · 0.95
getOutputMethod · 0.95
warnMethod · 0.65

Tested by

no test coverage detected