mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 16:39:46 -05:00
Added tests
This commit is contained in:
18
tests/cases/fourslash/importJsNodeModule1.ts
Normal file
18
tests/cases/fourslash/importJsNodeModule1.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: node_modules/myMod/index.js
|
||||
//// module.exports = { n: 3, s: 'foo', b: true };
|
||||
|
||||
// @Filename: consumer.js
|
||||
//// var x = require('myMod');
|
||||
//// x/**/;
|
||||
|
||||
goTo.file('consumer.js');
|
||||
goTo.marker();
|
||||
edit.insert('.');
|
||||
verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
edit.insert('n.');
|
||||
verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
23
tests/cases/fourslash/importJsNodeModule2.ts
Normal file
23
tests/cases/fourslash/importJsNodeModule2.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: node_modules/myMod/package.json
|
||||
//// {"main": "entry.js"}
|
||||
|
||||
|
||||
// @Filename: node_modules/myMod/entry.js
|
||||
//// module.exports = { n: 3, s: 'foo', b: true };
|
||||
|
||||
// @Filename: consumer.js
|
||||
//// var x = require('myMod');
|
||||
//// x/**/;
|
||||
|
||||
goTo.file('consumer.js');
|
||||
goTo.marker();
|
||||
edit.insert('.');
|
||||
verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
edit.insert('n.');
|
||||
verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
31
tests/cases/fourslash/importJsNodeModule3.ts
Normal file
31
tests/cases/fourslash/importJsNodeModule3.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: node_modules/myMod/index.js
|
||||
//// exports.n = 3;
|
||||
//// exports.s = 'foo';
|
||||
//// exports.b = true;
|
||||
|
||||
// @Filename: node_modules/anotherMod/index.js
|
||||
//// exports.x = 3;
|
||||
//// exports.y = 'foo';
|
||||
//// exports.z = true;
|
||||
|
||||
// @Filename: consumer.js
|
||||
//// import * as x from 'myMod';
|
||||
//// import {y,z} from 'anotherMod';
|
||||
//// x/**/;
|
||||
|
||||
goTo.file('consumer.js');
|
||||
goTo.marker();
|
||||
edit.insert('.');
|
||||
verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
edit.insert('n.');
|
||||
verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
|
||||
edit.backspace(4);
|
||||
edit.insert('y.');
|
||||
verify.completionListContains("toUpperCase", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
20
tests/cases/fourslash/importJsNodeModule4.ts
Normal file
20
tests/cases/fourslash/importJsNodeModule4.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
|
||||
// @Filename: node_modules/myMod/index.js
|
||||
//// module.exports = { n: 3, s: 'foo', b: true };
|
||||
|
||||
// @Filename: consumer.js
|
||||
//// import * as x from 'myMod';
|
||||
//// x/**/;
|
||||
|
||||
goTo.file('consumer.js');
|
||||
goTo.marker();
|
||||
edit.insert('.');
|
||||
// TODO: Bug: Fix ES6 import of assignments to module.exports
|
||||
// verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
// verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
// verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property");
|
||||
// edit.insert('n.');
|
||||
// verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method");
|
||||
Reference in New Issue
Block a user