mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Add compiler baseline-tests for using --lib node
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
//// [modularizeLibrary_UsingES5LibAndNodeLib.ts]
|
||||
|
||||
import fs = require("fs");
|
||||
import Console = require("console");
|
||||
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
myLog.log("Logging to myLog");
|
||||
myLog.trace("show me the trace");
|
||||
|
||||
console.log("No Error using node console");
|
||||
console.log(`Current Directory ${process.cwd()}`);
|
||||
console.error("Report error");
|
||||
|
||||
|
||||
//// [modularizeLibrary_UsingES5LibAndNodeLib.js]
|
||||
"use strict";
|
||||
var fs = require("fs");
|
||||
var Console = require("console");
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
myLog.log("Logging to myLog");
|
||||
myLog.trace("show me the trace");
|
||||
console.log("No Error using node console");
|
||||
console.log("Current Directory " + process.cwd());
|
||||
console.error("Report error");
|
||||
@@ -0,0 +1,45 @@
|
||||
=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndNodeLib.ts ===
|
||||
|
||||
import fs = require("fs");
|
||||
>fs : Symbol(fs, Decl(modularizeLibrary_UsingES5LibAndNodeLib.ts, 0, 0))
|
||||
|
||||
import Console = require("console");
|
||||
>Console : Symbol(Console, Decl(modularizeLibrary_UsingES5LibAndNodeLib.ts, 1, 26))
|
||||
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
>myLog : Symbol(myLog, Decl(modularizeLibrary_UsingES5LibAndNodeLib.ts, 4, 3))
|
||||
>Console.Console : Symbol(Console.Console, Decl(lib.node.d.ts, --, --))
|
||||
>Console : Symbol(Console, Decl(modularizeLibrary_UsingES5LibAndNodeLib.ts, 1, 26))
|
||||
>Console : Symbol(Console.Console, Decl(lib.node.d.ts, --, --))
|
||||
>fs.createWriteStream : Symbol(fs.createWriteStream, Decl(lib.node.d.ts, --, --))
|
||||
>fs : Symbol(fs, Decl(modularizeLibrary_UsingES5LibAndNodeLib.ts, 0, 0))
|
||||
>createWriteStream : Symbol(fs.createWriteStream, Decl(lib.node.d.ts, --, --))
|
||||
|
||||
myLog.log("Logging to myLog");
|
||||
>myLog.log : Symbol(NodeJS.Console.log, Decl(lib.node.d.ts, --, --))
|
||||
>myLog : Symbol(myLog, Decl(modularizeLibrary_UsingES5LibAndNodeLib.ts, 4, 3))
|
||||
>log : Symbol(NodeJS.Console.log, Decl(lib.node.d.ts, --, --))
|
||||
|
||||
myLog.trace("show me the trace");
|
||||
>myLog.trace : Symbol(NodeJS.Console.trace, Decl(lib.node.d.ts, --, --))
|
||||
>myLog : Symbol(myLog, Decl(modularizeLibrary_UsingES5LibAndNodeLib.ts, 4, 3))
|
||||
>trace : Symbol(NodeJS.Console.trace, Decl(lib.node.d.ts, --, --))
|
||||
|
||||
console.log("No Error using node console");
|
||||
>console.log : Symbol(Console.log, Decl(lib.node.d.ts, --, --))
|
||||
>console : Symbol(Console, Decl(lib.node.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.node.d.ts, --, --))
|
||||
|
||||
console.log(`Current Directory ${process.cwd()}`);
|
||||
>console.log : Symbol(Console.log, Decl(lib.node.d.ts, --, --))
|
||||
>console : Symbol(Console, Decl(lib.node.d.ts, --, --))
|
||||
>log : Symbol(Console.log, Decl(lib.node.d.ts, --, --))
|
||||
>process.cwd : Symbol(NodeJS.Process.cwd, Decl(lib.node.d.ts, --, --))
|
||||
>process : Symbol(process, Decl(lib.node.d.ts, --, --))
|
||||
>cwd : Symbol(NodeJS.Process.cwd, Decl(lib.node.d.ts, --, --))
|
||||
|
||||
console.error("Report error");
|
||||
>console.error : Symbol(Console.error, Decl(lib.node.d.ts, --, --))
|
||||
>console : Symbol(Console, Decl(lib.node.d.ts, --, --))
|
||||
>error : Symbol(Console.error, Decl(lib.node.d.ts, --, --))
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
=== tests/cases/compiler/modularizeLibrary_UsingES5LibAndNodeLib.ts ===
|
||||
|
||||
import fs = require("fs");
|
||||
>fs : typeof fs
|
||||
|
||||
import Console = require("console");
|
||||
>Console : typeof Console
|
||||
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
>myLog : NodeJS.Console
|
||||
>new Console.Console(fs.createWriteStream(".\Output")) : NodeJS.Console
|
||||
>Console.Console : new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream) => NodeJS.Console
|
||||
>Console : typeof Console
|
||||
>Console : new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream) => NodeJS.Console
|
||||
>fs.createWriteStream(".\Output") : fs.WriteStream
|
||||
>fs.createWriteStream : (path: string, options?: { flags?: string; encoding?: string; fd?: number; mode?: number; }) => fs.WriteStream
|
||||
>fs : typeof fs
|
||||
>createWriteStream : (path: string, options?: { flags?: string; encoding?: string; fd?: number; mode?: number; }) => fs.WriteStream
|
||||
>".\Output" : string
|
||||
|
||||
myLog.log("Logging to myLog");
|
||||
>myLog.log("Logging to myLog") : void
|
||||
>myLog.log : (data?: any, ...optionalParams: any[]) => void
|
||||
>myLog : NodeJS.Console
|
||||
>log : (data?: any, ...optionalParams: any[]) => void
|
||||
>"Logging to myLog" : string
|
||||
|
||||
myLog.trace("show me the trace");
|
||||
>myLog.trace("show me the trace") : void
|
||||
>myLog.trace : (message: any, ...optionalParams: any[]) => void
|
||||
>myLog : NodeJS.Console
|
||||
>trace : (message: any, ...optionalParams: any[]) => void
|
||||
>"show me the trace" : string
|
||||
|
||||
console.log("No Error using node console");
|
||||
>console.log("No Error using node console") : void
|
||||
>console.log : (data?: any, ...optionalParams: any[]) => void
|
||||
>console : typeof Console
|
||||
>log : (data?: any, ...optionalParams: any[]) => void
|
||||
>"No Error using node console" : string
|
||||
|
||||
console.log(`Current Directory ${process.cwd()}`);
|
||||
>console.log(`Current Directory ${process.cwd()}`) : void
|
||||
>console.log : (data?: any, ...optionalParams: any[]) => void
|
||||
>console : typeof Console
|
||||
>log : (data?: any, ...optionalParams: any[]) => void
|
||||
>`Current Directory ${process.cwd()}` : string
|
||||
>process.cwd() : string
|
||||
>process.cwd : () => string
|
||||
>process : NodeJS.Process
|
||||
>cwd : () => string
|
||||
|
||||
console.error("Report error");
|
||||
>console.error("Report error") : void
|
||||
>console.error : (data?: any, ...optionalParams: any[]) => void
|
||||
>console : typeof Console
|
||||
>error : (data?: any, ...optionalParams: any[]) => void
|
||||
>"Report error" : string
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
lib.dom.d.ts(12899,13): error TS2300: Duplicate identifier 'console'.
|
||||
lib.node.d.ts(157,19): error TS2300: Duplicate identifier 'console'.
|
||||
tests/cases/compiler/modularizeLibrary_UsingES5LibNodeLibAndDomLib.ts(5,25): error TS2339: Property 'Console' does not exist on type 'Console'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/modularizeLibrary_UsingES5LibNodeLibAndDomLib.ts (1 errors) ====
|
||||
|
||||
import fs = require("fs");
|
||||
import Console = require("console");
|
||||
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
~~~~~~~
|
||||
!!! error TS2339: Property 'Console' does not exist on type 'Console'.
|
||||
myLog.log("Logging to myLog");
|
||||
myLog.trace("show me the trace");
|
||||
|
||||
console.log("No Error using node console");
|
||||
console.log(`Current Directory ${process.cwd()}`);
|
||||
console.error("Report error");
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [modularizeLibrary_UsingES5LibNodeLibAndDomLib.ts]
|
||||
|
||||
import fs = require("fs");
|
||||
import Console = require("console");
|
||||
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
myLog.log("Logging to myLog");
|
||||
myLog.trace("show me the trace");
|
||||
|
||||
console.log("No Error using node console");
|
||||
console.log(`Current Directory ${process.cwd()}`);
|
||||
console.error("Report error");
|
||||
|
||||
|
||||
//// [modularizeLibrary_UsingES5LibNodeLibAndDomLib.js]
|
||||
"use strict";
|
||||
var fs = require("fs");
|
||||
var Console = require("console");
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
myLog.log("Logging to myLog");
|
||||
myLog.trace("show me the trace");
|
||||
console.log("No Error using node console");
|
||||
console.log("Current Directory " + process.cwd());
|
||||
console.error("Report error");
|
||||
@@ -0,0 +1,13 @@
|
||||
// @lib: es5,node
|
||||
// @target: es5
|
||||
|
||||
import fs = require("fs");
|
||||
import Console = require("console");
|
||||
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
myLog.log("Logging to myLog");
|
||||
myLog.trace("show me the trace");
|
||||
|
||||
console.log("No Error using node console");
|
||||
console.log(`Current Directory ${process.cwd()}`);
|
||||
console.error("Report error");
|
||||
@@ -0,0 +1,13 @@
|
||||
// @lib: es5,node,dom
|
||||
// @target: es5
|
||||
|
||||
import fs = require("fs");
|
||||
import Console = require("console");
|
||||
|
||||
var myLog = new Console.Console(fs.createWriteStream(".\Output"));
|
||||
myLog.log("Logging to myLog");
|
||||
myLog.trace("show me the trace");
|
||||
|
||||
console.log("No Error using node console");
|
||||
console.log(`Current Directory ${process.cwd()}`);
|
||||
console.error("Report error");
|
||||
Reference in New Issue
Block a user