Skip to content

Commit

Permalink
chore: use pretty diagnostics in spec tests
Browse files Browse the repository at this point in the history
This allows us to ensure the accuracy of the printed diagnostics does not regress.
  • Loading branch information
lucacasonato committed May 17, 2024
1 parent 67cdf5d commit e1bcdde
Show file tree
Hide file tree
Showing 30 changed files with 414 additions and 85 deletions.
13 changes: 11 additions & 2 deletions tests/specs/graph/fast_check/cache__diagnostic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/c.ts@16
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/c.ts:1:17
|
1 | export function add(a: number, b: number) {
| ^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type


== fast check cache ==
FastCheckCacheKey(4741815020074927300):
Deps - []
Expand Down
13 changes: 11 additions & 2 deletions tests/specs/graph/fast_check/cache__diagnostic_deep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,17 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/c.ts@16
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/c.ts:1:17
|
1 | export function add(a: number, b: number) {
| ^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type


== fast check cache ==
FastCheckCacheKey(4741815020074927300):
Deps - []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,29 @@ import 'jsr:@scope/a/c'
}

Fast check https://jsr.io/@scope/a/1.0.0/c.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/a.ts@16
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/a.ts:1:17
|
1 | export function add(a: number, b: number) {
| ^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type


Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/a.ts@16
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/a.ts:1:17
|
1 | export function add(a: number, b: number) {
| ^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type


== fast check cache ==
FastCheckCacheKey(2640350593211828171):
Deps - []
Expand Down
13 changes: 11 additions & 2 deletions tests/specs/graph/fast_check/cache__diagnostic_then_nested_dep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,17 @@ jsr deps: {
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/mod.ts@16
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/mod.ts:1:17
|
1 | export function add(a: number, b: number) {
| ^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type


Fast check https://jsr.io/@scope/b/1.0.0/mod.ts:
{}
export function add(a: number, b: number): number {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,17 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
the reference 'MyClass.prototype.member.additional' from 'Export.prototype.prop' was too complex
at https://jsr.io/@scope/a/1.0.0/mod.ts@70
error[unsupported-complex-reference]: the reference 'MyClass.prototype.member.additional' from 'Export.prototype.prop' was too complex
--> https://jsr.io/@scope/a/1.0.0/mod.ts:5:1
|
5 | class MyClass {
| ^^^^^^^^^^^^^^^
6 | member: string;
| ^^^^^^^^^^^^^^^^^
7 | }
| ^ this is the reference
= hint: extract the shared type to a type alias and reference the type alias instead

info: the reference was too complex to be resolved by fast check
docs: https://jsr.io/go/slow-type-unsupported-complex-reference

16 changes: 14 additions & 2 deletions tests/specs/graph/fast_check/class_member_ref_not_found.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,17 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
could not resolve 'Public1.prototype.nonExistent' referenced from 'Export.prototype.prop'
at https://jsr.io/@scope/a/1.0.0/mod.ts@70
error[not-found-reference]: could not resolve 'Public1.prototype.nonExistent' referenced from 'Export.prototype.prop'
--> https://jsr.io/@scope/a/1.0.0/mod.ts:4:1
|
4 | class Public1 {
| ^^^^^^^^^^^^^^^
5 | prop: string;
| ^^^^^^^^^^^^^^^
6 | }
| ^ this is the reference
= hint: fix the reference to point to a symbol that exists

info: this error may be the result of a bug in Deno - if you think this is the case, please open an issue
docs: https://jsr.io/go/slow-type-not-found-reference

16 changes: 14 additions & 2 deletions tests/specs/graph/fast_check/class_static_member_ref_not_found.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,17 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
could not resolve 'Public1.nonExistent' referenced from 'Export.prototype.prop'
at https://jsr.io/@scope/a/1.0.0/mod.ts@60
error[not-found-reference]: could not resolve 'Public1.nonExistent' referenced from 'Export.prototype.prop'
--> https://jsr.io/@scope/a/1.0.0/mod.ts:4:1
|
4 | class Public1 {
| ^^^^^^^^^^^^^^^
5 | static prop: string;
| ^^^^^^^^^^^^^^^^^^^^^^
6 | }
| ^ this is the reference
= hint: fix the reference to point to a symbol that exists

info: this error may be the result of a bug in Deno - if you think this is the case, please open an issue
docs: https://jsr.io/go/slow-type-not-found-reference

12 changes: 10 additions & 2 deletions tests/specs/graph/fast_check/class_super_unsupported.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
super class expression was too complex
at https://jsr.io/@scope/a/1.0.0/mod.ts@121
error[unsupported-super-class-expr]: super class expression was too complex
--> https://jsr.io/@scope/a/1.0.0/mod.ts:4:28
|
4 | export class Child extends MyFunction(Base) {
| ^^^^^^^^^^^^^^^^ this is the superclass expression
= hint: extract the superclass expression into a variable

info: fast check was unable to infer the type of the superclass expression
docs: https://jsr.io/go/slow-type-unsupported-super-class-expr

Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/mod.ts@13
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/mod.ts:1:14
|
1 | export const test4 = function () { return "test" };
| ^^^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type

18 changes: 16 additions & 2 deletions tests/specs/graph/fast_check/cross_file_ref_module_not_found.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,19 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
could not resolve 'A.prototype.notExistent' referenced from '<unknown>'
at https://jsr.io/@scope/a/1.0.0/a.ts@0
error[not-found-reference]: could not resolve 'A.prototype.notExistent' referenced from '<unknown>'
--> https://jsr.io/@scope/a/1.0.0/a.ts:1:1
|
1 | export class A {
| ^^^^^^^^^^^^^^^^
2 | member: string;
| ^^^^^^^^^^^^^^^^^
3 | member2: string;
| ^^^^^^^^^^^^^^^^^^
4 | }
| ^ this is the reference
= hint: fix the reference to point to a symbol that exists

info: this error may be the result of a bug in Deno - if you think this is the case, please open an issue
docs: https://jsr.io/go/slow-type-not-found-reference

10 changes: 8 additions & 2 deletions tests/specs/graph/fast_check/entrypoint_js.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,11 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.js:
used a JavaScript module without type declarations as an entrypoint
at https://jsr.io/@scope/a/1.0.0/mod.js
warning[unsupported-javascript-entrypoint]: used a JavaScript module without type declarations as an entrypoint
--> https://jsr.io/@scope/a/1.0.0/mod.js
= hint: add a type declaration (d.ts) for the JavaScript module, or rewrite it to TypeScript

info: JavaScript files with no corresponding declaration require type inference to be type checked
info: fast check avoids type inference, so JavaScript entrypoints should be avoided
docs: https://jsr.io/go/slow-type-unsupported-javascript-entrypoint

Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
expando property referencing 'localDecl' conflicts with 'test.localDecl'
at https://jsr.io/@scope/a/1.0.0/mod.ts@79
error[unsupported-expando-property]: expando property referencing 'localDecl' conflicts with 'test.localDecl'
--> https://jsr.io/@scope/a/1.0.0/mod.ts:5:18
|
5 | test.localDecl = localDecl;
| ^^^^^^^^^
= hint: rename 'localDecl' to something else to avoid conflicts or create a temporary variable with a different name to use in the expando property reference

info: expando properties get converted to a namespace and the reference conflicts with a namespace export
docs: https://jsr.io/go/slow-type-unsupported-expando-property

Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
expando property referencing 'localDecl' conflicts with 'test.localDecl'
at https://jsr.io/@scope/a/1.0.0/mod.ts@146
error[unsupported-expando-property]: expando property referencing 'localDecl' conflicts with 'test.localDecl'
--> https://jsr.io/@scope/a/1.0.0/mod.ts:9:13
|
9 | test.prop = localDecl;
| ^^^^^^^^^
= hint: rename 'localDecl' to something else to avoid conflicts or create a temporary variable with a different name to use in the expando property reference

info: expando properties get converted to a namespace and the reference conflicts with a namespace export
docs: https://jsr.io/go/slow-type-unsupported-expando-property

12 changes: 10 additions & 2 deletions tests/specs/graph/fast_check/export_equals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
export assignments are a Common JS feature, which are not supported in ES modules
at https://jsr.io/@scope/a/1.0.0/mod.ts@0
error[unsupported-ts-export-assignment]: export assignments are a Common JS feature, which are not supported in ES modules
--> https://jsr.io/@scope/a/1.0.0/mod.ts:1:1
|
1 | export = 5;
| ^^^^^^^^^^^
= hint: use an export statement instead

info: CommonJS features such as export assignments are not supported in ES modules
docs: https://jsr.io/go/slow-type-unsupported-ts-export-assignment

16 changes: 14 additions & 2 deletions tests/specs/graph/fast_check/global_module.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,17 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
found global augmentations, which are not supported
at https://jsr.io/@scope/a/1.0.0/mod.ts@0
error[unsupported-global-module]: found global augmentations, which are not supported
--> https://jsr.io/@scope/a/1.0.0/mod.ts:1:1
|
1 | global {
| ^^^^^^^^
2 | declare var Test: 5;
| ^^^^^^^^^^^^^^^^^^^^^^
3 | }
| ^
= hint: remove the 'global' augmentation

info: global augmentations are not supported because they can modify global types, which can affect other modules type checking
docs: https://jsr.io/go/slow-type-unsupported-global-module

Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit type in the public API
at https://jsr.io/@scope/a/1.0.0/mod.ts@70
error[missing-explicit-type]: missing explicit type in the public API
--> https://jsr.io/@scope/a/1.0.0/mod.ts:4:7
|
4 | const key = Symbol("#keys");
| ^^^ this symbol is missing an explicit type
= hint: add an explicit type annotation to the symbol

info: all symbols in the public API must have an explicit type
docs: https://jsr.io/go/slow-type-missing-explicit-type

12 changes: 10 additions & 2 deletions tests/specs/graph/fast_check/missing_return_type.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/mod.ts@16
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/mod.ts:1:17
|
1 | export function missingReturnType() {
| ^^^^^^^^^^^^^^^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type

12 changes: 10 additions & 2 deletions tests/specs/graph/fast_check/missing_return_type_generator.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
missing explicit return type in the public API
at https://jsr.io/@scope/a/1.0.0/mod.ts@17
error[missing-explicit-return-type]: missing explicit return type in the public API
--> https://jsr.io/@scope/a/1.0.0/mod.ts:1:18
|
1 | export function* missingReturnType() {
| ^^^^^^^^^^^^^^^^^ this function is missing an explicit return type
= hint: add an explicit return type to the function

info: all functions in the public API must have an explicit return type
docs: https://jsr.io/go/slow-type-missing-explicit-return-type

10 changes: 8 additions & 2 deletions tests/specs/graph/fast_check/nested_java_script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,11 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
referenced a JavaScript module without type declarations from a TypeScript module
at https://jsr.io/@scope/a/1.0.0/a.js
error[unsupported-nested-javascript]: referenced a JavaScript module without type declarations from a TypeScript module
--> https://jsr.io/@scope/a/1.0.0/a.js
= hint: add a type declaration (d.ts) for the JavaScript module, or rewrite it to TypeScript

info: JavaScript files with no corresponding declaration require type inference to be type checked
info: fast check avoids type inference, so referencing a JavaScript file with no type declarations is not supported
docs: https://jsr.io/go/slow-type-unsupported-nested-javascript

12 changes: 10 additions & 2 deletions tests/specs/graph/fast_check/require.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,13 @@ import 'jsr:@scope/a'
}

Fast check https://jsr.io/@scope/a/1.0.0/mod.ts:
require statements are a CommonJS feature, which are not supported in ES modules
at https://jsr.io/@scope/a/1.0.0/mod.ts@0
error[unsupported-require]: require statements are a CommonJS feature, which are not supported in ES modules
--> https://jsr.io/@scope/a/1.0.0/mod.ts:1:1
|
1 | import test = require("./other.ts");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= hint: use an import statement instead

info: CommonJS features such as require are not supported in ES modules
docs: https://jsr.io/go/slow-type-unsupported-require

0 comments on commit e1bcdde

Please sign in to comment.