Skip to content

Commit 84f4856

Browse files
authored
Fix fourslash tests (#62641)
1 parent 16a52ed commit 84f4856

10 files changed

+19
-12
lines changed

src/harness/fourslashInterfaceImpl.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ export class Verify extends VerifyNegatable {
279279
return this.state.verifyCompletions(optionsArray[0]);
280280
}
281281
for (const options of optionsArray) {
282+
if (options.preferences && Object.keys(options).length === 1 && optionsArray.length > 1 && optionsArray.indexOf(options) > 0) {
283+
throw new Error("Did you mean to put 'preferences' in the previous 'verify.completions' object argument instead of their own object?");
284+
}
282285
this.state.verifyCompletions(options);
283286
}
284287
return {

tests/baselines/reference/jsxClassAttributeResolution.errors.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ file.tsx(2,19): error TS2741: Property 'ref' is missing in type '{}' but require
1212
"name": "@types/react",
1313
"version": "0.0.1",
1414
"main": "",
15-
"types": "index.d.ts",
15+
"types": "index.d.ts"
1616
}
1717
==== node_modules/@types/react/index.d.ts (0 errors) ====
1818
interface IntrinsicClassAttributesAlias<T> {

tests/baselines/reference/jsxClassAttributeResolution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const a = <App></App>;
88
"name": "@types/react",
99
"version": "0.0.1",
1010
"main": "",
11-
"types": "index.d.ts",
11+
"types": "index.d.ts"
1212
}
1313
//// [index.d.ts]
1414
interface IntrinsicClassAttributesAlias<T> {

tests/cases/compiler/jsxClassAttributeResolution.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const a = <App></App>;
88
"name": "@types/react",
99
"version": "0.0.1",
1010
"main": "",
11-
"types": "index.d.ts",
11+
"types": "index.d.ts"
1212
}
1313
// @filename: node_modules/@types/react/index.d.ts
1414
interface IntrinsicClassAttributesAlias<T> {

tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports47.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// @filename: node_modules/react/package.json
1010
////{
1111
//// "name": "react",
12-
//// "types": "index.d.ts",
12+
//// "types": "index.d.ts"
1313
////}
1414

1515
// @filename: node_modules/react/index.d.ts

tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports48.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// @filename: node_modules/react/package.json
1010
////{
1111
//// "name": "react",
12-
//// "types": "index.d.ts",
12+
//// "types": "index.d.ts"
1313
////}
1414

1515
// @filename: node_modules/react/index.d.ts

tests/cases/fourslash/completionsThisProperties_globalType.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ test.markerNames().forEach(marker => {
2323
kind: "var",
2424
kindModifiers: "declare",
2525
sortText: completion.SortText.GlobalsOrKeywords
26-
}]
27-
}, {
26+
}],
2827
preferences: {
2928
includeInsertTextCompletions: true
3029
}

tests/cases/fourslash/completionsWithDeprecatedTag9.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,24 @@
1111
////class Foo {
1212
//// foo: number;
1313
//// m() {
14-
//// foo/**/
14+
//// [|foo|]/**/
1515
//// }
1616
////}
1717

1818
verify.completions({
1919
marker: "",
2020
includes: [{
21+
name: "foo",
22+
insertText: "this.foo",
23+
kind: "property",
24+
source: completion.CompletionSource.ThisProperty,
25+
sortText: completion.SortText.SuggestedClassMembers,
26+
}, {
2127
name: "foo",
2228
kind: "var",
2329
kindModifiers: "deprecated,declare",
2430
sortText: completion.SortText.Deprecated(completion.SortText.GlobalsOrKeywords),
25-
}]
26-
}, {
31+
}],
2732
preferences: {
2833
includeInsertTextCompletions: true
2934
}

tests/cases/fourslash/organizeImportsReactJsx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// @filename: node_modules/react/package.json
1414
////{
1515
//// "name": "react",
16-
//// "types": "index.d.ts",
16+
//// "types": "index.d.ts"
1717
////}
1818

1919
// @filename: node_modules/react/index.d.ts

tests/cases/fourslash/organizeImportsReactJsxDev.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// @filename: node_modules/react/package.json
1414
////{
1515
//// "name": "react",
16-
//// "types": "index.d.ts",
16+
//// "types": "index.d.ts"
1717
////}
1818

1919
// @filename: node_modules/react/index.d.ts

0 commit comments

Comments
 (0)