-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify tests testing different values of
module
- Loading branch information
1 parent
33f70c0
commit 2a8e8b6
Showing
48 changed files
with
595 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/dynamicImportDefer(module=commonjs).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//// [tests/cases/conformance/importDefer/dynamicImportDefer.ts] //// | ||
|
||
//// [a.ts] | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
|
||
//// [b.ts] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.foo = foo; | ||
function foo() { | ||
console.log("foo from a"); | ||
} | ||
//// [b.js] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
Promise.resolve().then(() => require("./a.js")); // TODO: Without this the import.defer cannot resolve ./a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/dynamicImportDefer(module=es2015).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//// [tests/cases/conformance/importDefer/dynamicImportDefer.ts] //// | ||
|
||
//// [a.ts] | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
|
||
//// [b.ts] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
|
||
|
||
//// [a.js] | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
//// [b.js] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a |
29 changes: 29 additions & 0 deletions
29
tests/baselines/reference/dynamicImportDefer(module=es2015).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//// [tests/cases/conformance/importDefer/dynamicImportDefer.ts] //// | ||
|
||
=== a.ts === | ||
export function foo() { | ||
>foo : Symbol(foo, Decl(a.ts, 0, 0)) | ||
|
||
console.log("foo from a"); | ||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) | ||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) | ||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) | ||
} | ||
|
||
=== b.ts === | ||
import.defer("./a.js").then(ns => { | ||
>import.defer("./a.js").then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) | ||
>"./a.js" : Symbol("a", Decl(a.ts, 0, 0)) | ||
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) | ||
>ns : Symbol(ns, Decl(b.ts, 0, 28)) | ||
|
||
ns.foo(); | ||
>ns.foo : Symbol(foo, Decl(a.ts, 0, 0)) | ||
>ns : Symbol(ns, Decl(b.ts, 0, 28)) | ||
>foo : Symbol(foo, Decl(a.ts, 0, 0)) | ||
|
||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
>"./a.js" : Symbol("a", Decl(a.ts, 0, 0)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/dynamicImportDefer(module=es2020).errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
b.ts(1,1): error TS18060: Deferred imports are only supported when the '--module' flag is set to 'esnext' or 'nodenext'. | ||
|
||
|
||
==== a.ts (0 errors) ==== | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
|
||
==== b.ts (1 errors) ==== | ||
import.defer("./a.js").then(ns => { | ||
~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS18060: Deferred imports are only supported when the '--module' flag is set to 'esnext' or 'nodenext'. | ||
ns.foo(); | ||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
|
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/dynamicImportDefer(module=es2020).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//// [tests/cases/conformance/importDefer/dynamicImportDefer.ts] //// | ||
|
||
//// [a.ts] | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
|
||
//// [b.ts] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
|
||
|
||
//// [a.js] | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
//// [b.js] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a |
29 changes: 29 additions & 0 deletions
29
tests/baselines/reference/dynamicImportDefer(module=es2020).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//// [tests/cases/conformance/importDefer/dynamicImportDefer.ts] //// | ||
|
||
=== a.ts === | ||
export function foo() { | ||
>foo : Symbol(foo, Decl(a.ts, 0, 0)) | ||
|
||
console.log("foo from a"); | ||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) | ||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) | ||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) | ||
} | ||
|
||
=== b.ts === | ||
import.defer("./a.js").then(ns => { | ||
>import.defer("./a.js").then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) | ||
>"./a.js" : Symbol("a", Decl(a.ts, 0, 0)) | ||
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) | ||
>ns : Symbol(ns, Decl(b.ts, 0, 28)) | ||
|
||
ns.foo(); | ||
>ns.foo : Symbol(foo, Decl(a.ts, 0, 0)) | ||
>ns : Symbol(ns, Decl(b.ts, 0, 28)) | ||
>foo : Symbol(foo, Decl(a.ts, 0, 0)) | ||
|
||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
>"./a.js" : Symbol("a", Decl(a.ts, 0, 0)) | ||
|
59 changes: 59 additions & 0 deletions
59
tests/baselines/reference/dynamicImportDefer(module=es2020).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
//// [tests/cases/conformance/importDefer/dynamicImportDefer.ts] //// | ||
|
||
=== a.ts === | ||
export function foo() { | ||
>foo : () => void | ||
> : ^^^^^^^^^^ | ||
|
||
console.log("foo from a"); | ||
>console.log("foo from a") : void | ||
> : ^^^^ | ||
>console.log : (...data: any[]) => void | ||
> : ^^^^ ^^ ^^^^^ | ||
>console : Console | ||
> : ^^^^^^^ | ||
>log : (...data: any[]) => void | ||
> : ^^^^ ^^ ^^^^^ | ||
>"foo from a" : "foo from a" | ||
> : ^^^^^^^^^^^^ | ||
} | ||
|
||
=== b.ts === | ||
import.defer("./a.js").then(ns => { | ||
>import.defer("./a.js").then(ns => { ns.foo();}) : Promise<void> | ||
> : ^^^^^^^^^^^^^ | ||
>import.defer("./a.js").then : <TResult1 = typeof import("a"), TResult2 = never>(onfulfilled?: (value: typeof import("a")) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2> | ||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>import.defer("./a.js") : Promise<typeof import("a")> | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>import.defer : any | ||
> : ^^^ | ||
>defer : any | ||
> : ^^^ | ||
>"./a.js" : "./a.js" | ||
> : ^^^^^^^^ | ||
>then : <TResult1 = typeof import("a"), TResult2 = never>(onfulfilled?: (value: typeof import("a")) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2> | ||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>ns => { ns.foo();} : (ns: typeof import("a")) => void | ||
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>ns : typeof import("a") | ||
> : ^^^^^^^^^^^^^^^^^^ | ||
|
||
ns.foo(); | ||
>ns.foo() : void | ||
> : ^^^^ | ||
>ns.foo : () => void | ||
> : ^^^^^^^^^^ | ||
>ns : typeof import("a") | ||
> : ^^^^^^^^^^^^^^^^^^ | ||
>foo : () => void | ||
> : ^^^^^^^^^^ | ||
|
||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
>import("./a.js") : Promise<typeof import("a")> | ||
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
>"./a.js" : "./a.js" | ||
> : ^^^^^^^^ | ||
|
24 changes: 24 additions & 0 deletions
24
tests/baselines/reference/dynamicImportDefer(module=esnext).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//// [tests/cases/conformance/importDefer/dynamicImportDefer.ts] //// | ||
|
||
//// [a.ts] | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
|
||
//// [b.ts] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
|
||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a | ||
|
||
|
||
//// [a.js] | ||
export function foo() { | ||
console.log("foo from a"); | ||
} | ||
//// [b.js] | ||
import.defer("./a.js").then(ns => { | ||
ns.foo(); | ||
}); | ||
import("./a.js"); // TODO: Without this the import.defer cannot resolve ./a |
Oops, something went wrong.