(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestResolveForFile_AppliesMatchingScopesInOrder(t *testing.T) { |
| 110 | opts := &etscore.EffectPluginOptions{ |
| 111 | Diagnostics: true, |
| 112 | DiagnosticSeverity: map[string]etscore.Severity{"deterministicKeys": etscore.SeverityError}, |
| 113 | PipeableMinArgCount: 2, |
| 114 | Overrides: []etscore.Override{ |
| 115 | { |
| 116 | Include: []string{"src/**/*.ts"}, |
| 117 | Options: etscore.OverrideOptions{ |
| 118 | DiagnosticSeverity: map[string]etscore.Severity{"deterministicKeys": etscore.SeverityWarning}, |
| 119 | PipeableMinArgCount: intPtr(3), |
| 120 | }, |
| 121 | }, |
| 122 | { |
| 123 | Include: []string{"src/legacy/**/*.ts"}, |
| 124 | Options: etscore.OverrideOptions{ |
| 125 | DiagnosticSeverity: map[string]etscore.Severity{"deterministicKeys": etscore.SeverityOff}, |
| 126 | }, |
| 127 | }, |
| 128 | }, |
| 129 | } |
| 130 | |
| 131 | resolvedSeverity := pluginoptions.ResolveDiagnosticSeverityForFile(opts, "/repo/src/legacy/example.ts", "/repo/tsconfig.json", true) |
| 132 | effective := pluginoptions.ResolveEffectPluginOptionsForSourceFile(opts, "/repo/src/legacy/example.ts", "/repo/tsconfig.json", true) |
| 133 | if got := resolvedSeverity["deterministicKeys"]; got != etscore.SeverityOff { |
| 134 | t.Errorf("deterministicKeys severity = %v, want %v", got, etscore.SeverityOff) |
| 135 | } |
| 136 | if got := effective.GetPipeableMinArgCount(); got != 3 { |
| 137 | t.Errorf("PipeableMinArgCount = %d, want 3", got) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func TestResolveForFile_ExcludeOnlyAffectsCurrentScope(t *testing.T) { |
| 142 | opts := &etscore.EffectPluginOptions{ |
nothing calls this directly
no test coverage detected