mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Cleaning up test cases and adding a few more
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should define spans for replacement that appear after the last directory seperator in import statements
|
||||
|
||||
// @typeRoots: my_typings
|
||||
|
||||
// @Filename: test.ts
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should define spans for replacement that appear after the last directory seperator in triple slash references
|
||||
|
||||
// @typeRoots: my_typings
|
||||
|
||||
// @Filename: test.ts
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for node modules and files within those modules with ts file extensions
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "f/*import_as0*/
|
||||
//// import * as foo2 from "fake-module//*import_as1*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should not give node module completions if classic module resolution is enabled
|
||||
|
||||
// @moduleResolution: classic
|
||||
|
||||
// @Filename: dir1/dir2/dir3/dir4/test0.ts
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should handle nested files in folders discovered via the baseUrl compiler option
|
||||
|
||||
// @baseUrl: tests/cases/fourslash/modules
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "subfolder//*import_as0*/
|
||||
//// import foo2 = require("subfolder//*import_equals0*/
|
||||
//// var foo3 = require("subfolder//*require0*/
|
||||
|
||||
//// import * as foo1 from "module-from-node//*import_as1*/
|
||||
//// import foo2 = require("module-from-node//*import_equals1*/
|
||||
//// var foo3 = require("module-from-node//*require1*/
|
||||
|
||||
// @Filename: modules/subfolder/module.ts
|
||||
//// export var x = 5;
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": { "module-from-node": "latest" } }
|
||||
// @Filename: node_modules/module-from-node/index.ts
|
||||
//// /*module1*/
|
||||
|
||||
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.importModuleCompletionListContains("module");
|
||||
verify.not.importModuleCompletionListItemsCountIsGreaterThan(1);
|
||||
|
||||
goTo.marker(kind + "1");
|
||||
|
||||
verify.importModuleCompletionListContains("index");
|
||||
verify.not.importModuleCompletionListItemsCountIsGreaterThan(1);
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should not give duplicate entries for similarly named files with different extensions
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "fake-module//*import_as0*/
|
||||
//// import foo2 = require("fake-module//*import_equals0*/
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for js files in node modules when allowJs is set to true
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for all node modules visible to the script
|
||||
|
||||
// @Filename: dir1/dir2/dir3/dir4/test0.ts
|
||||
//// import * as foo1 from "f/*import_as0*/
|
||||
//// import foo4 = require("f/*import_equals0*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for ambiently declared modules
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// /// <reference path="./ambientModules.d.ts" />
|
||||
//// /// <reference path="./ambientModules2.d.ts" />
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "module-/*import_as0*/
|
||||
//// import foo2 = require("module-/*import_equals0*/
|
||||
//// var foo3 = require("module-/*require0*/
|
||||
|
||||
// @Filename: package.json
|
||||
//// { "dependencies": {
|
||||
//// "module-no-main": "latest",
|
||||
//// "module-no-main-index-d-ts": "latest",
|
||||
//// "module-index-ts": "latest",
|
||||
//// "module-index-d-ts-explicit-main": "latest",
|
||||
//// "module-index-d-ts-default-main": "latest",
|
||||
//// "module-typings": "latest"
|
||||
//// } }
|
||||
|
||||
// @Filename: node_modules/module-no-main/package.json
|
||||
//// { }
|
||||
|
||||
// @Filename: node_modules/module-no-main-index-d-ts/package.json
|
||||
//// { }
|
||||
// @Filename: node_modules/module-no-main-index-d-ts/index.d.ts
|
||||
//// /*module-no-main-index-d-ts*/
|
||||
|
||||
// @Filename: node_modules/module-index-ts/package.json
|
||||
//// { }
|
||||
// @Filename: node_modules/module-index-ts/index.ts
|
||||
//// /*module-index-ts*/
|
||||
|
||||
// @Filename: node_modules/module-index-d-ts-explicit-main/package.json
|
||||
//// { "main":"./notIndex.js" }
|
||||
// @Filename: node_modules/module-index-d-ts-explicit-main/notIndex.js
|
||||
//// /*module-index-d-ts-explicit-main*/
|
||||
// @Filename: node_modules/module-index-d-ts-explicit-main/index.d.ts
|
||||
//// /*module-index-d-ts-explicit-main2*/
|
||||
|
||||
// @Filename: node_modules/module-index-d-ts-default-main/package.json
|
||||
//// { }
|
||||
// @Filename: node_modules/module-index-d-ts-default-main/index.js
|
||||
//// /*module-index-d-ts-default-main*/
|
||||
// @Filename: node_modules/module-index-d-ts-default-main/index.d.ts
|
||||
//// /*module-index-d-ts-default-main2*/
|
||||
|
||||
// @Filename: node_modules/module-typings/package.json
|
||||
//// { "typings":"./types.d.ts" }
|
||||
// @Filename: node_modules/module-typings/types.d.ts
|
||||
//// /*module-typings*/
|
||||
|
||||
const kinds = ["import_as", "import_equals", "require"];
|
||||
|
||||
for (const kind of kinds) {
|
||||
goTo.marker(kind + "0");
|
||||
|
||||
verify.importModuleCompletionListContains("module-no-main");
|
||||
verify.importModuleCompletionListContains("module-no-main-index-d-ts");
|
||||
verify.importModuleCompletionListContains("module-index-ts");
|
||||
verify.importModuleCompletionListContains("module-index-d-ts-explicit-main");
|
||||
verify.importModuleCompletionListContains("module-index-d-ts-default-main");
|
||||
verify.importModuleCompletionListContains("module-typings");
|
||||
verify.not.importModuleCompletionListItemsCountIsGreaterThan(6);
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for files that are discovered via the baseUrl compiler option
|
||||
|
||||
// @baseUrl: tests/cases/fourslash/modules
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for modules referenced via baseUrl and paths compiler options with wildcards
|
||||
|
||||
// @Filename: tsconfig.json
|
||||
//// {
|
||||
//// "compilerOptions": {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for modules referenced via baseUrl and paths compiler options with explicit name mappings
|
||||
|
||||
// @Filename: tsconfig.json
|
||||
//// {
|
||||
//// "compilerOptions": {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for typings discovered via the typeRoots compiler option
|
||||
|
||||
// @typeRoots: my_typings,my_other_typings
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should respect the types compiler option when giving completions
|
||||
|
||||
// @typeRoots: my_typings,my_other_typings
|
||||
// @types: module-x,module-z
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for typings discovered in all visible @types directories
|
||||
|
||||
// @Filename: subdirectory/test0.ts
|
||||
//// /// <reference types="m/*types_ref0*/" />
|
||||
//// import * as foo1 from "m/*import_as0*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for ts files when allowJs is false
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// import * as foo1 from "./*import_as0*/
|
||||
//// import * as foo2 from ".//*import_as1*/
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for ts and js files when allowJs is true
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: test0.ts
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for absolute paths
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// import * as foo1 from "c:/tests/cases/f/*import_as0*/
|
||||
//// import * as foo2 from "c:/tests/cases/fourslash/*import_as1*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for directories that are merged via the rootDirs compiler option
|
||||
|
||||
// @rootDirs: sub/src1,src2
|
||||
|
||||
// @Filename: src2/test0.ts
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for relative references to ts files when allowJs is false
|
||||
|
||||
// @Filename: test0.ts
|
||||
//// /// <reference path="/*0*/
|
||||
//// /// <reference path="./*1*/
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for relative references to js and ts files when allowJs is true
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: test0.ts
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should give completions for absolute paths
|
||||
|
||||
// @Filename: tests/test0.ts
|
||||
//// /// <reference path="c:/tests/cases/f/*0*/
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// Should NOT give completions for directories that are merged via the rootDirs compiler option
|
||||
|
||||
// @rootDirs: sub/src1,src2
|
||||
|
||||
// @Filename: src2/test0.ts
|
||||
//// /// <reference path="./mo/*0*/
|
||||
|
||||
// @Filename: src2/module0.ts
|
||||
//// export var w = 0;
|
||||
|
||||
// @Filename: sub/src1/module1.ts
|
||||
//// export var x = 0;
|
||||
|
||||
// @Filename: sub/src1/module2.ts
|
||||
//// export var y = 0;
|
||||
|
||||
// @Filename: sub/src1/more/module3.ts
|
||||
//// export var z = 0;
|
||||
|
||||
|
||||
// @Filename: f1.ts
|
||||
//// /*f1*/
|
||||
// @Filename: f2.tsx
|
||||
//// /*f2*/
|
||||
// @Filename: folder/f1.ts
|
||||
//// /*subf1*/
|
||||
// @Filename: f3.js
|
||||
//// /*f3*/
|
||||
// @Filename: f4.jsx
|
||||
//// /*f4*/
|
||||
// @Filename: e1.ts
|
||||
//// /*e1*/
|
||||
// @Filename: e2.js
|
||||
//// /*e2*/
|
||||
|
||||
|
||||
goTo.marker("0");
|
||||
|
||||
verify.importModuleCompletionListContains("module0.ts");
|
||||
|
||||
verify.not.importModuleCompletionListItemsCountIsGreaterThan(1);
|
||||
Reference in New Issue
Block a user