Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestAutoImportPathsNodeModules(t *testing.T) {
const content = `// @Filename: tsconfig.json
{
"compilerOptions": {
"module": "amd",
"module": "commonjs",
"moduleResolution": "node",
"rootDir": "ts",
"baseUrl": ".",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestAutoImportsWithRootDirsAndRootedPath01(t *testing.T) {
// @Filename: /dir/tsconfig.json
{
"compilerOptions": {
"module": "amd",
"module": "commonjs",
"moduleResolution": "classic",
"rootDirs": ["D:/"]
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class /*2*/Control{
{
"extends": "../tsbase.json",
"compilerOptions": {
"outFile": "Source.js"
"outDir": "."
},
"files": [
"Source.ts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestGetDeclarationDiagnostics(t *testing.T) {
defer testutil.RecoverAndFail(t, "Panic on fourslash test")
const content = `// @strict: false
// @declaration: true
// @outFile: true
// @outDir: out
// @Filename: inputFile1.ts
namespace m {
export function foo() {
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions tsc/internal/testrunner/compiler_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,15 @@ var skippedTests = []string{
"mappedTypeUnionConstraintInferences.ts",
"lateBoundConstraintTypeChecksCorrectly.ts",
"keyofDoesntContainSymbols.ts",
"isolatedModulesOut.ts",
"noStrictGenericChecks.ts",
"noImplicitUseStrict_umd.ts",
"noImplicitUseStrict_system.ts",
"noImplicitUseStrict_es6.ts",
"noImplicitUseStrict_commonjs.ts",
"noImplicitUseStrict_amd.ts",
"noImplicitAnyIndexingSuppressed.ts",
"excessPropertyErrorsSuppressed.ts",
"moduleNoneDynamicImport.ts",
"moduleNoneErrors.ts",
"moduleNoneOutFile.ts",
"noErrorUsingImportExportModuleAugmentationInDeclarationFile1.ts",
"noErrorUsingImportExportModuleAugmentationInDeclarationFile2.ts",
"noErrorUsingImportExportModuleAugmentationInDeclarationFile3.ts",
Expand Down
16 changes: 12 additions & 4 deletions tsc/internal/testutil/harnessutil/harnessutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,9 @@ func GetConfigNameFromFileName(filename string) string {

func SkipUnsupportedCompilerOptions(t *testing.T, options *core.CompilerOptions) {
t.Helper()
failOnUnsupportedCompilerOptions(t, options)
switch options.Module {
case core.ModuleKindAMD, core.ModuleKindUMD, core.ModuleKindSystem:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the skips here? Is this leftover from you finding tests to fix? I'd hope we would still error if someone tries to introduce them somehow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the skips here? Is this leftover from you finding tests to fix? I'd hope we would still error if someone tries to introduce them somehow.

It felt like the logical thing to do. But I see your point - let me push a commit that does t.Fail() if an old compiler option is specified.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah there's actually a bunch of stuff here I missed - let me take another proper look - apologies for marking it draft a little too early!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed now - I've changed these cases to fail with t.Fatalf rather than silently skip. This flagged some other issues, so I've changed those tests using outFile to outDir, and module:amd to module:commonjs where needed to prevent excess diagnostics

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; I wonder how much more it'd take to do this for all of the other options.

Probably also the func is misnamed but, it is somewhat temporary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; I wonder how much more it'd take to do this for all of the other options.

happy to send followup PRs if this is directionally right - these were the first two I noticed that caused us issues. But I don't want to make this any harder to review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort of surprised this matters for you at all? These are our internal tests, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We read all of the fixtures to know what we should be succeeding/failing to parse. (since there's not really a TS conformance suite anywhere).

Since some of these have no errors.txt (because they were skipped), our harness was expecting these to parse without errors (incorrect behaviour)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just filter out cases that are skipped here, but then we risk not testing everything and possibly introducing regressions.

case core.ModuleKindUMD, core.ModuleKindSystem:
t.Skipf("unsupported module kind %s", options.Module)
}
switch options.ModuleResolution {
Expand All @@ -1252,9 +1253,6 @@ func SkipUnsupportedCompilerOptions(t *testing.T, options *core.CompilerOptions)
if options.BaseUrl != "" {
t.Skipf("unsupported baseUrl %s", options.BaseUrl)
}
if options.OutFile != "" {
t.Skipf("unsupported outFile %s", options.OutFile)
}
switch options.Target {
case core.ScriptTargetES5:
t.Skipf("unsupported target %s", options.Target)
Expand All @@ -1263,3 +1261,13 @@ func SkipUnsupportedCompilerOptions(t *testing.T, options *core.CompilerOptions)
t.Skipf("alwaysStrict=false is unsupported")
}
}

func failOnUnsupportedCompilerOptions(t *testing.T, options *core.CompilerOptions) {
t.Helper()
if options.Module == core.ModuleKindAMD {
t.Fatalf("unsupported module kind %s", options.Module)
}
if options.OutFile != "" {
t.Fatalf("unsupported outFile %s", options.OutFile)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//// [tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration.ts] ////

//// [ambientExternalModuleWithInternalImportDeclaration_0.ts]
declare module 'M' {
namespace C {
export var f: number;
}
class C {
foo(): void;
}
import X = C;
export = X;

}

//// [ambientExternalModuleWithInternalImportDeclaration_1.ts]
///<reference path='ambientExternalModuleWithInternalImportDeclaration_0.ts'/>
import A = require('M');
var c = new A();

//// [ambientExternalModuleWithInternalImportDeclaration_0.js]
"use strict";
//// [ambientExternalModuleWithInternalImportDeclaration_1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
///<reference path='ambientExternalModuleWithInternalImportDeclaration_0.ts'/>
const A = require("M");
var c = new A();
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//// [tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration.ts] ////

=== ambientExternalModuleWithInternalImportDeclaration_1.ts ===
///<reference path='ambientExternalModuleWithInternalImportDeclaration_0.ts'/>
import A = require('M');
>A : Symbol(A, Decl(ambientExternalModuleWithInternalImportDeclaration_1.ts, 0, 0))

var c = new A();
>c : Symbol(c, Decl(ambientExternalModuleWithInternalImportDeclaration_1.ts, 2, 3))
>A : Symbol(A, Decl(ambientExternalModuleWithInternalImportDeclaration_1.ts, 0, 0))

=== ambientExternalModuleWithInternalImportDeclaration_0.ts ===
declare module 'M' {
>'M' : Symbol("M", Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 0, 0))

namespace C {
>C : Symbol(C, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 3, 5))

export var f: number;
>f : Symbol(f, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 2, 18))
}
class C {
>C : Symbol(C, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 3, 5))

foo(): void;
>foo : Symbol(C.foo, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 4, 13))
}
import X = C;
>X : Symbol(X, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 6, 5))
>C : Symbol(C, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 3, 5))

export = X;
>X : Symbol(X, Decl(ambientExternalModuleWithInternalImportDeclaration_0.ts, 6, 5))

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//// [tests/cases/compiler/ambientExternalModuleWithInternalImportDeclaration.ts] ////

=== ambientExternalModuleWithInternalImportDeclaration_1.ts ===
///<reference path='ambientExternalModuleWithInternalImportDeclaration_0.ts'/>
import A = require('M');
>A : typeof A

var c = new A();
>c : A
>new A() : A
>A : typeof A

=== ambientExternalModuleWithInternalImportDeclaration_0.ts ===
declare module 'M' {
>'M' : typeof import("M")

namespace C {
>C : typeof C

export var f: number;
>f : number
}
class C {
>C : C

foo(): void;
>foo : () => void
}
import X = C;
>X : typeof C
>C : C

export = X;
>X : C

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//// [tests/cases/compiler/ambientExternalModuleWithoutInternalImportDeclaration.ts] ////

//// [ambientExternalModuleWithoutInternalImportDeclaration_0.ts]
declare module 'M' {
namespace C {
export var f: number;
}
class C {
foo(): void;
}
export = C;

}

//// [ambientExternalModuleWithoutInternalImportDeclaration_1.ts]
///<reference path='ambientExternalModuleWithoutInternalImportDeclaration_0.ts'/>
import A = require('M');
var c = new A();

//// [ambientExternalModuleWithoutInternalImportDeclaration_0.js]
"use strict";
//// [ambientExternalModuleWithoutInternalImportDeclaration_1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
///<reference path='ambientExternalModuleWithoutInternalImportDeclaration_0.ts'/>
const A = require("M");
var c = new A();
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//// [tests/cases/compiler/ambientExternalModuleWithoutInternalImportDeclaration.ts] ////

=== ambientExternalModuleWithoutInternalImportDeclaration_1.ts ===
///<reference path='ambientExternalModuleWithoutInternalImportDeclaration_0.ts'/>
import A = require('M');
>A : Symbol(A, Decl(ambientExternalModuleWithoutInternalImportDeclaration_1.ts, 0, 0))

var c = new A();
>c : Symbol(c, Decl(ambientExternalModuleWithoutInternalImportDeclaration_1.ts, 2, 3))
>A : Symbol(A, Decl(ambientExternalModuleWithoutInternalImportDeclaration_1.ts, 0, 0))

=== ambientExternalModuleWithoutInternalImportDeclaration_0.ts ===
declare module 'M' {
>'M' : Symbol("M", Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 0, 0))

namespace C {
>C : Symbol(C, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 3, 5))

export var f: number;
>f : Symbol(f, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 2, 18))
}
class C {
>C : Symbol(C, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 3, 5))

foo(): void;
>foo : Symbol(C.foo, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 4, 13))
}
export = C;
>C : Symbol(C, Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 0, 20), Decl(ambientExternalModuleWithoutInternalImportDeclaration_0.ts, 3, 5))

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//// [tests/cases/compiler/ambientExternalModuleWithoutInternalImportDeclaration.ts] ////

=== ambientExternalModuleWithoutInternalImportDeclaration_1.ts ===
///<reference path='ambientExternalModuleWithoutInternalImportDeclaration_0.ts'/>
import A = require('M');
>A : typeof A

var c = new A();
>c : A
>new A() : A
>A : typeof A

=== ambientExternalModuleWithoutInternalImportDeclaration_0.ts ===
declare module 'M' {
>'M' : typeof import("M")

namespace C {
>C : typeof C

export var f: number;
>f : number
}
class C {
>C : C

foo(): void;
>foo : () => void
}
export = C;
>C : C

}

This file was deleted.

14 changes: 0 additions & 14 deletions tsc/testdata/baselines/reference/compiler/amdDependencyComment1.js

This file was deleted.

This file was deleted.

Loading
Loading