Skip to content

Commit fcb4ab1

Browse files
authored
Add compiler test runner (#115)
1 parent 1841664 commit fcb4ab1

20 files changed

+868
-49
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,23 @@ jobs:
7373
# Installing gotestsum is super slow on Windows.
7474
if: ${{ matrix.os != 'windows-latest' }}
7575

76-
- run: npx hereby test:all ${RACE_FLAG:+"$RACE_FLAG"} ${NOEMBED_FLAG:+"$NOEMBED_FLAG"}
76+
- name: Tests
77+
id: test
78+
run: npx hereby test:all ${RACE_FLAG:+"$RACE_FLAG"} ${NOEMBED_FLAG:+"$NOEMBED_FLAG"}
7779
env:
7880
RACE_FLAG: ${{ (matrix.race && '--race') || '' }}
7981
NOEMBED_FLAG: ${{ (matrix.noembed && '--noembed') || '' }}
8082

8183
- run: git add .
8284
- run: git diff --staged --exit-code --stat
8385

86+
- name: Print baseline diff on failure
87+
if: ${{ failure() && steps.test.conclusion == 'failure' }}
88+
run: |
89+
npx hereby baseline-accept
90+
git add testdata/baselines/reference
91+
git diff --staged --exit-code
92+
8493
lint:
8594
runs-on: ubuntu-latest
8695
steps:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ go.work.sum
173173
# Benchmarking results
174174
*.txt
175175

176+
# Re-add baseline references
177+
!testdata/baselines/reference/**/*.txt
178+
176179
# Local baselines
177180
testdata/baselines/local
178181
testdata/baselines/tmp

internal/core/compileroptions.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type CompilerOptions struct {
1919
EmitDeclarationOnly Tristate `json:"emitDeclarationOnly"`
2020
EmitBOM Tristate `json:"emitBOM"`
2121
DownlevelIteration Tristate `json:"downlevelIteration"`
22+
Declaration Tristate `json:"declaration"`
2223
ESModuleInterop Tristate `json:"esModuleInterop"`
2324
ExactOptionalPropertyTypes Tristate `json:"exactOptionalPropertyTypes"`
2425
ExperimentalDecorators Tristate `json:"experimentalDecorators"`
@@ -32,6 +33,7 @@ type CompilerOptions struct {
3233
ModuleDetection ModuleDetectionKind `json:"moduleDetectionKind"`
3334
NewLine NewLineKind `json:"newLine"`
3435
NoEmit Tristate `json:"noEmit"`
36+
NoErrorTruncation Tristate `json:"noErrorTruncation"`
3537
NoFallthroughCasesInSwitch Tristate `json:"noFallthroughCasesInSwitch"`
3638
NoImplicitAny Tristate `json:"noImplicitAny"`
3739
NoImplicitThis Tristate `json:"noImplicitThis"`
@@ -45,6 +47,7 @@ type CompilerOptions struct {
4547
ResolveJsonModule Tristate `json:"resolveJsonModule"`
4648
ResolvePackageJsonExports Tristate `json:"resolvePackageJsonExports"`
4749
ResolvePackageJsonImports Tristate `json:"resolvePackageJsonImports"`
50+
SkipLibCheck Tristate `json:"skipLibCheck"`
4851
Strict Tristate `json:"strict"`
4952
StrictBindCallApply Tristate `json:"strictBindCallApply"`
5053
StrictBuiltinIteratorReturn Tristate `json:"strictBuiltinIteratorReturn"`
@@ -251,8 +254,9 @@ func (m ModuleResolutionKind) String() string {
251254
type NewLineKind int32
252255

253256
const (
254-
NewLineKindCRLF NewLineKind = 0
255-
NewLineKindLF NewLineKind = 1
257+
NewLineKindNone NewLineKind = 0
258+
NewLineKindCRLF NewLineKind = 1
259+
NewLineKindLF NewLineKind = 2
256260
)
257261

258262
func (newLine NewLineKind) GetNewLineCharacter() string {

internal/diagnosticwriter/diagnosticwriter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func WriteFormatDiagnostic(output io.Writer, diagnostic *ast.Diagnostic, formatO
358358
fmt.Fprintf(output, "%s(%d,%d): ", relativeFileName, line+1, character+1)
359359
}
360360

361-
fmt.Fprintf(output, "%s TS%d: ", diagnostic.Category().String(), diagnostic.Code())
361+
fmt.Fprintf(output, "%s TS%d: ", diagnostic.Category().Name(), diagnostic.Code())
362362
WriteFlattenedDiagnosticMessage(output, diagnostic, formatOpts.NewLine)
363363
fmt.Fprint(output, formatOpts.NewLine)
364364
}

0 commit comments

Comments
 (0)