@openrewrite/rewrite 8.96.2 → 8.96.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/java/tree.d.ts +11 -11
- package/dist/java/tree.d.ts.map +1 -1
- package/dist/java/visitor.d.ts.map +1 -1
- package/dist/java/visitor.js +30 -0
- package/dist/java/visitor.js.map +1 -1
- package/dist/javascript/add-import.d.ts.map +1 -1
- package/dist/javascript/add-import.js +3 -29
- package/dist/javascript/add-import.js.map +1 -1
- package/dist/javascript/format/format.d.ts +2 -0
- package/dist/javascript/format/format.d.ts.map +1 -1
- package/dist/javascript/format/format.js +7 -1
- package/dist/javascript/format/format.js.map +1 -1
- package/dist/javascript/parser-utils.d.ts.map +1 -1
- package/dist/javascript/parser-utils.js +15 -7
- package/dist/javascript/parser-utils.js.map +1 -1
- package/dist/javascript/scope.d.ts +5 -0
- package/dist/javascript/scope.d.ts.map +1 -1
- package/dist/javascript/scope.js +9 -0
- package/dist/javascript/scope.js.map +1 -1
- package/dist/javascript/templating/precedence.js +1 -1
- package/dist/javascript/templating/precedence.js.map +1 -1
- package/dist/javascript/tree.d.ts +12 -12
- package/dist/javascript/tree.d.ts.map +1 -1
- package/dist/javascript/visitor.d.ts.map +1 -1
- package/dist/javascript/visitor.js +75 -0
- package/dist/javascript/visitor.js.map +1 -1
- package/dist/rewrite-javascript-version.txt +1 -1
- package/dist/test/rewrite-test.d.ts +1 -0
- package/dist/test/rewrite-test.d.ts.map +1 -1
- package/dist/test/rewrite-test.js +13 -1
- package/dist/test/rewrite-test.js.map +1 -1
- package/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/picomatch/README.md +743 -0
- package/node_modules/picomatch/index.js +17 -0
- package/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/picomatch/lib/parse.js +1506 -0
- package/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/picomatch/package.json +83 -0
- package/node_modules/picomatch/posix.js +3 -0
- package/package.json +88 -90
- package/src/java/tree.ts +11 -11
- package/src/java/visitor.ts +36 -0
- package/src/javascript/add-import.ts +4 -33
- package/src/javascript/format/format.ts +7 -1
- package/src/javascript/parser-utils.ts +15 -7
- package/src/javascript/scope.ts +9 -0
- package/src/javascript/templating/precedence.ts +1 -1
- package/src/javascript/tree.ts +12 -12
- package/src/javascript/visitor.ts +90 -0
- package/src/test/rewrite-test.ts +14 -1
package/src/javascript/tree.ts
CHANGED
|
@@ -602,7 +602,7 @@ export namespace JS {
|
|
|
602
602
|
* Represents the index type in an indexed access.
|
|
603
603
|
* @example 'key'
|
|
604
604
|
*/
|
|
605
|
-
export interface IndexType extends JS {
|
|
605
|
+
export interface IndexType extends JS, Expression, TypeTree {
|
|
606
606
|
readonly kind: typeof Kind.IndexedAccessTypeIndexType;
|
|
607
607
|
readonly element: J.RightPadded<TypeTree>;
|
|
608
608
|
readonly type?: Type;
|
|
@@ -633,7 +633,7 @@ export namespace JS {
|
|
|
633
633
|
* Represents TypeScript computed property name.
|
|
634
634
|
* @example { [key]: value }
|
|
635
635
|
*/
|
|
636
|
-
export interface ComputedPropertyName extends JS, Expression,
|
|
636
|
+
export interface ComputedPropertyName extends JS, Expression, TypeTree, VariableDeclarator {
|
|
637
637
|
readonly kind: typeof Kind.ComputedPropertyName;
|
|
638
638
|
readonly expression: J.RightPadded<Expression>;
|
|
639
639
|
}
|
|
@@ -695,7 +695,7 @@ export namespace JS {
|
|
|
695
695
|
* @example data["key"](5, 0, 4)
|
|
696
696
|
* @example (() => { return 3 + 5 })()
|
|
697
697
|
*/
|
|
698
|
-
export interface FunctionCall extends JS, MethodCall {
|
|
698
|
+
export interface FunctionCall extends JS, TypedTree, MethodCall {
|
|
699
699
|
readonly kind: typeof Kind.FunctionCall;
|
|
700
700
|
readonly function?: J.RightPadded<Expression>;
|
|
701
701
|
readonly typeParameters?: J.Container<Expression>;
|
|
@@ -706,7 +706,7 @@ export namespace JS {
|
|
|
706
706
|
* Represents the `void` operator.
|
|
707
707
|
* @example void 0;
|
|
708
708
|
*/
|
|
709
|
-
export interface Void extends JS, Expression {
|
|
709
|
+
export interface Void extends JS, Expression, Statement {
|
|
710
710
|
readonly kind: typeof Kind.Void;
|
|
711
711
|
readonly expression: Expression;
|
|
712
712
|
}
|
|
@@ -737,7 +737,7 @@ export namespace JS {
|
|
|
737
737
|
* Represents a method declaration in classes or objects.
|
|
738
738
|
* @example class A { [Symbol.asyncIterator]() { ... } }
|
|
739
739
|
*/
|
|
740
|
-
export interface ComputedPropertyMethodDeclaration extends JS, Statement {
|
|
740
|
+
export interface ComputedPropertyMethodDeclaration extends JS, Statement, TypedTree {
|
|
741
741
|
readonly kind: typeof Kind.ComputedPropertyMethodDeclaration;
|
|
742
742
|
readonly leadingAnnotations: J.Annotation[];
|
|
743
743
|
readonly modifiers: J.Modifier[];
|
|
@@ -754,7 +754,7 @@ export namespace JS {
|
|
|
754
754
|
* @example for (const x of arr) { }
|
|
755
755
|
* @example for await (const x of arr) { }
|
|
756
756
|
*/
|
|
757
|
-
export interface ForOfLoop extends JS {
|
|
757
|
+
export interface ForOfLoop extends JS, Statement {
|
|
758
758
|
readonly kind: typeof Kind.ForOfLoop;
|
|
759
759
|
readonly await?: J.Space;
|
|
760
760
|
readonly loop: J.ForEachLoop;
|
|
@@ -768,7 +768,7 @@ export namespace JS {
|
|
|
768
768
|
* Represents a for-in loop.
|
|
769
769
|
* @example for (let key in obj) { }
|
|
770
770
|
*/
|
|
771
|
-
export interface ForInLoop extends JS {
|
|
771
|
+
export interface ForInLoop extends JS, Statement {
|
|
772
772
|
readonly kind: typeof Kind.ForInLoop;
|
|
773
773
|
readonly control: ForInLoop.Control;
|
|
774
774
|
readonly body: J.RightPadded<Statement>;
|
|
@@ -802,7 +802,7 @@ export namespace JS {
|
|
|
802
802
|
* Represents a literal type object in TypeScript.
|
|
803
803
|
* @example type T = { a: number };
|
|
804
804
|
*/
|
|
805
|
-
export interface TypeLiteral extends JS, TypeTree {
|
|
805
|
+
export interface TypeLiteral extends JS, Expression, TypeTree {
|
|
806
806
|
readonly kind: typeof Kind.TypeLiteral;
|
|
807
807
|
readonly members: J.Block;
|
|
808
808
|
readonly type?: Type;
|
|
@@ -812,7 +812,7 @@ export namespace JS {
|
|
|
812
812
|
* Represents an array destructuring pattern.
|
|
813
813
|
* @example const [a, b] = arr;
|
|
814
814
|
*/
|
|
815
|
-
export interface ArrayBindingPattern extends JS, TypedTree, VariableDeclarator {
|
|
815
|
+
export interface ArrayBindingPattern extends JS, Expression, TypedTree, VariableDeclarator {
|
|
816
816
|
readonly kind: typeof Kind.ArrayBindingPattern;
|
|
817
817
|
readonly elements: J.Container<Expression>;
|
|
818
818
|
readonly type?: Type;
|
|
@@ -822,7 +822,7 @@ export namespace JS {
|
|
|
822
822
|
* Represents a named element in a binding pattern.
|
|
823
823
|
* @example const { x: alias } = obj;
|
|
824
824
|
*/
|
|
825
|
-
export interface BindingElement extends JS, Statement, TypeTree {
|
|
825
|
+
export interface BindingElement extends JS, Statement, Expression, TypeTree {
|
|
826
826
|
readonly kind: typeof Kind.BindingElement;
|
|
827
827
|
readonly propertyName?: J.RightPadded<Expression>;
|
|
828
828
|
readonly name: TypedTree;
|
|
@@ -858,7 +858,7 @@ export namespace JS {
|
|
|
858
858
|
* Represents named exports in an export declaration.
|
|
859
859
|
* @example export { a, b };
|
|
860
860
|
*/
|
|
861
|
-
export interface NamedExports extends JS {
|
|
861
|
+
export interface NamedExports extends JS, Expression {
|
|
862
862
|
readonly kind: typeof Kind.NamedExports;
|
|
863
863
|
readonly elements: J.Container<Expression>;
|
|
864
864
|
readonly type?: Type;
|
|
@@ -868,7 +868,7 @@ export namespace JS {
|
|
|
868
868
|
* Represents a specifier in a named export.
|
|
869
869
|
* @example export { foo as bar };
|
|
870
870
|
*/
|
|
871
|
-
export interface ExportSpecifier extends JS {
|
|
871
|
+
export interface ExportSpecifier extends JS, Expression, TypedTree {
|
|
872
872
|
readonly kind: typeof Kind.ExportSpecifier;
|
|
873
873
|
readonly typeOnly: J.LeftPadded<boolean>;
|
|
874
874
|
readonly specifier: Expression;
|
|
@@ -111,6 +111,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
protected async visitAs(as_: JS.As, p: P): Promise<J | undefined> {
|
|
114
|
+
const expression = await this.visitExpression(as_, p);
|
|
115
|
+
if (!expression?.kind || expression.kind !== JS.Kind.As) {
|
|
116
|
+
return expression;
|
|
117
|
+
}
|
|
118
|
+
as_ = expression as JS.As;
|
|
119
|
+
|
|
114
120
|
const updates: any = {
|
|
115
121
|
prefix: await this.visitSpace(as_.prefix, p),
|
|
116
122
|
markers: await this.visitMarkers(as_.markers, p),
|
|
@@ -138,6 +144,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
protected async visitJsxTag(element: JSX.Tag, p: P): Promise<J | undefined> {
|
|
147
|
+
const expression = await this.visitExpression(element, p);
|
|
148
|
+
if (!expression?.kind || expression.kind !== JS.Kind.JsxTag) {
|
|
149
|
+
return expression;
|
|
150
|
+
}
|
|
151
|
+
element = expression as JSX.Tag;
|
|
152
|
+
|
|
141
153
|
const updates: any = {
|
|
142
154
|
prefix: await this.visitSpace(element.prefix, p),
|
|
143
155
|
markers: await this.visitMarkers(element.markers, p),
|
|
@@ -174,6 +186,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
174
186
|
}
|
|
175
187
|
|
|
176
188
|
protected async visitJsxEmbeddedExpression(expr: JSX.EmbeddedExpression, p: P): Promise<J | undefined> {
|
|
189
|
+
const expression = await this.visitExpression(expr, p);
|
|
190
|
+
if (!expression?.kind || expression.kind !== JS.Kind.JsxEmbeddedExpression) {
|
|
191
|
+
return expression;
|
|
192
|
+
}
|
|
193
|
+
expr = expression as JSX.EmbeddedExpression;
|
|
194
|
+
|
|
177
195
|
const updates: any = {
|
|
178
196
|
prefix: await this.visitSpace(expr.prefix, p),
|
|
179
197
|
markers: await this.visitMarkers(expr.markers, p),
|
|
@@ -455,6 +473,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
455
473
|
}
|
|
456
474
|
|
|
457
475
|
protected async visitBinaryExtensions(jsBinary: JS.Binary, p: P): Promise<J | undefined> {
|
|
476
|
+
const expression = await this.visitExpression(jsBinary, p);
|
|
477
|
+
if (!expression?.kind || expression.kind !== JS.Kind.Binary) {
|
|
478
|
+
return expression;
|
|
479
|
+
}
|
|
480
|
+
jsBinary = expression as JS.Binary;
|
|
481
|
+
|
|
458
482
|
const updates: any = {
|
|
459
483
|
prefix: await this.visitSpace(jsBinary.prefix, p),
|
|
460
484
|
markers: await this.visitMarkers(jsBinary.markers, p),
|
|
@@ -504,6 +528,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
504
528
|
}
|
|
505
529
|
|
|
506
530
|
protected async visitMappedTypeKeysRemapping(keysRemapping: JS.MappedType.KeysRemapping, p: P): Promise<J | undefined> {
|
|
531
|
+
const statement = await this.visitStatement(keysRemapping, p);
|
|
532
|
+
if (!statement?.kind || statement.kind !== JS.Kind.MappedTypeKeysRemapping) {
|
|
533
|
+
return statement;
|
|
534
|
+
}
|
|
535
|
+
keysRemapping = statement as JS.MappedType.KeysRemapping;
|
|
536
|
+
|
|
507
537
|
const updates: any = {
|
|
508
538
|
prefix: await this.visitSpace(keysRemapping.prefix, p),
|
|
509
539
|
markers: await this.visitMarkers(keysRemapping.markers, p),
|
|
@@ -514,6 +544,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
514
544
|
}
|
|
515
545
|
|
|
516
546
|
protected async visitMappedTypeParameter(mappedTypeParameter: JS.MappedType.Parameter, p: P): Promise<J | undefined> {
|
|
547
|
+
const statement = await this.visitStatement(mappedTypeParameter, p);
|
|
548
|
+
if (!statement?.kind || statement.kind !== JS.Kind.MappedTypeParameter) {
|
|
549
|
+
return statement;
|
|
550
|
+
}
|
|
551
|
+
mappedTypeParameter = statement as JS.MappedType.Parameter;
|
|
552
|
+
|
|
517
553
|
const updates: any = {
|
|
518
554
|
prefix: await this.visitSpace(mappedTypeParameter.prefix, p),
|
|
519
555
|
markers: await this.visitMarkers(mappedTypeParameter.markers, p),
|
|
@@ -767,6 +803,18 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
767
803
|
}
|
|
768
804
|
|
|
769
805
|
protected async visitAssignmentOperationExtensions(assignmentOperation: JS.AssignmentOperation, p: P): Promise<J | undefined> {
|
|
806
|
+
const expression = await this.visitExpression(assignmentOperation, p);
|
|
807
|
+
if (!expression?.kind || expression.kind !== JS.Kind.AssignmentOperation) {
|
|
808
|
+
return expression;
|
|
809
|
+
}
|
|
810
|
+
assignmentOperation = expression as JS.AssignmentOperation;
|
|
811
|
+
|
|
812
|
+
const statement = await this.visitStatement(assignmentOperation, p);
|
|
813
|
+
if (!statement?.kind || statement.kind !== JS.Kind.AssignmentOperation) {
|
|
814
|
+
return statement;
|
|
815
|
+
}
|
|
816
|
+
assignmentOperation = statement as JS.AssignmentOperation;
|
|
817
|
+
|
|
770
818
|
const updates: any = {
|
|
771
819
|
prefix: await this.visitSpace(assignmentOperation.prefix, p),
|
|
772
820
|
markers: await this.visitMarkers(assignmentOperation.markers, p),
|
|
@@ -796,6 +844,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
796
844
|
}
|
|
797
845
|
|
|
798
846
|
protected async visitIndexedAccessTypeIndexType(indexType: JS.IndexedAccessType.IndexType, p: P): Promise<J | undefined> {
|
|
847
|
+
const expression = await this.visitExpression(indexType, p);
|
|
848
|
+
if (!expression?.kind || expression.kind !== JS.Kind.IndexedAccessTypeIndexType) {
|
|
849
|
+
return expression;
|
|
850
|
+
}
|
|
851
|
+
indexType = expression as JS.IndexedAccessType.IndexType;
|
|
852
|
+
|
|
799
853
|
const updates: any = {
|
|
800
854
|
prefix: await this.visitSpace(indexType.prefix, p),
|
|
801
855
|
markers: await this.visitMarkers(indexType.markers, p),
|
|
@@ -989,6 +1043,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
989
1043
|
}
|
|
990
1044
|
|
|
991
1045
|
protected async visitForOfLoop(forOfLoop: JS.ForOfLoop, p: P): Promise<J | undefined> {
|
|
1046
|
+
const statement = await this.visitStatement(forOfLoop, p);
|
|
1047
|
+
if (!statement?.kind || statement.kind !== JS.Kind.ForOfLoop) {
|
|
1048
|
+
return statement;
|
|
1049
|
+
}
|
|
1050
|
+
forOfLoop = statement as JS.ForOfLoop;
|
|
1051
|
+
|
|
992
1052
|
const updates: any = {
|
|
993
1053
|
prefix: await this.visitSpace(forOfLoop.prefix, p),
|
|
994
1054
|
markers: await this.visitMarkers(forOfLoop.markers, p),
|
|
@@ -999,6 +1059,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
999
1059
|
}
|
|
1000
1060
|
|
|
1001
1061
|
protected async visitForInLoop(forInLoop: JS.ForInLoop, p: P): Promise<J | undefined> {
|
|
1062
|
+
const statement = await this.visitStatement(forInLoop, p);
|
|
1063
|
+
if (!statement?.kind || statement.kind !== JS.Kind.ForInLoop) {
|
|
1064
|
+
return statement;
|
|
1065
|
+
}
|
|
1066
|
+
forInLoop = statement as JS.ForInLoop;
|
|
1067
|
+
|
|
1002
1068
|
const updates: any = {
|
|
1003
1069
|
prefix: await this.visitSpace(forInLoop.prefix, p),
|
|
1004
1070
|
markers: await this.visitMarkers(forInLoop.markers, p),
|
|
@@ -1027,6 +1093,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1027
1093
|
}
|
|
1028
1094
|
|
|
1029
1095
|
protected async visitTypeLiteral(typeLiteral: JS.TypeLiteral, p: P): Promise<J | undefined> {
|
|
1096
|
+
const expression = await this.visitExpression(typeLiteral, p);
|
|
1097
|
+
if (!expression?.kind || expression.kind !== JS.Kind.TypeLiteral) {
|
|
1098
|
+
return expression;
|
|
1099
|
+
}
|
|
1100
|
+
typeLiteral = expression as JS.TypeLiteral;
|
|
1101
|
+
|
|
1030
1102
|
const updates: any = {
|
|
1031
1103
|
prefix: await this.visitSpace(typeLiteral.prefix, p),
|
|
1032
1104
|
markers: await this.visitMarkers(typeLiteral.markers, p),
|
|
@@ -1037,6 +1109,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1037
1109
|
}
|
|
1038
1110
|
|
|
1039
1111
|
protected async visitArrayBindingPattern(arrayBindingPattern: JS.ArrayBindingPattern, p: P): Promise<J | undefined> {
|
|
1112
|
+
const expression = await this.visitExpression(arrayBindingPattern, p);
|
|
1113
|
+
if (!expression?.kind || expression.kind !== JS.Kind.ArrayBindingPattern) {
|
|
1114
|
+
return expression;
|
|
1115
|
+
}
|
|
1116
|
+
arrayBindingPattern = expression as JS.ArrayBindingPattern;
|
|
1117
|
+
|
|
1040
1118
|
const updates: any = {
|
|
1041
1119
|
prefix: await this.visitSpace(arrayBindingPattern.prefix, p),
|
|
1042
1120
|
markers: await this.visitMarkers(arrayBindingPattern.markers, p),
|
|
@@ -1099,6 +1177,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1099
1177
|
}
|
|
1100
1178
|
|
|
1101
1179
|
protected async visitNamedExports(namedExports: JS.NamedExports, p: P): Promise<J | undefined> {
|
|
1180
|
+
const expression = await this.visitExpression(namedExports, p);
|
|
1181
|
+
if (!expression?.kind || expression.kind !== JS.Kind.NamedExports) {
|
|
1182
|
+
return expression;
|
|
1183
|
+
}
|
|
1184
|
+
namedExports = expression as JS.NamedExports;
|
|
1185
|
+
|
|
1102
1186
|
const updates: any = {
|
|
1103
1187
|
prefix: await this.visitSpace(namedExports.prefix, p),
|
|
1104
1188
|
markers: await this.visitMarkers(namedExports.markers, p),
|
|
@@ -1109,6 +1193,12 @@ export class JavaScriptVisitor<P> extends JavaVisitor<P> {
|
|
|
1109
1193
|
}
|
|
1110
1194
|
|
|
1111
1195
|
protected async visitExportSpecifier(exportSpecifier: JS.ExportSpecifier, p: P): Promise<J | undefined> {
|
|
1196
|
+
const expression = await this.visitExpression(exportSpecifier, p);
|
|
1197
|
+
if (!expression?.kind || expression.kind !== JS.Kind.ExportSpecifier) {
|
|
1198
|
+
return expression;
|
|
1199
|
+
}
|
|
1200
|
+
exportSpecifier = expression as JS.ExportSpecifier;
|
|
1201
|
+
|
|
1112
1202
|
const updates: any = {
|
|
1113
1203
|
prefix: await this.visitSpace(exportSpecifier.prefix, p),
|
|
1114
1204
|
markers: await this.visitMarkers(exportSpecifier.markers, p),
|
package/src/test/rewrite-test.ts
CHANGED
|
@@ -222,6 +222,7 @@ export class RecipeSpec {
|
|
|
222
222
|
const {changeset, unsettled} = await this.runCycles(allParsed.map(([_, sourceFile]) => sourceFile),
|
|
223
223
|
cycles, expectedCycles);
|
|
224
224
|
|
|
225
|
+
this.expectNoUnexpectedGeneratedFiles(flattenedSpecs, changeset);
|
|
225
226
|
this.checkReportingMarkersOnly && await this.expectNoAddedMarkers(flattenedSpecs, allParsed, changeset);
|
|
226
227
|
await this.expectResultsToMatchAfter(flattenedSpecs, changeset, allParsed);
|
|
227
228
|
await this.expectGeneratedFiles(flattenedSpecs, changeset);
|
|
@@ -511,9 +512,21 @@ export class RecipeSpec {
|
|
|
511
512
|
}
|
|
512
513
|
}
|
|
513
514
|
|
|
515
|
+
private expectNoUnexpectedGeneratedFiles(specs: SourceSpec<any>[], changeset: Result[]) {
|
|
516
|
+
const expectedPaths = new Set(specs.filter(spec => !spec.before).map(spec => spec.path));
|
|
517
|
+
const unexpected = changeset.filter(c => !c.before && c.after && !expectedPaths.has(c.after.sourcePath));
|
|
518
|
+
if (unexpected.length > 0) {
|
|
519
|
+
throw new Error([
|
|
520
|
+
"The recipe generated source files the test did not expect:",
|
|
521
|
+
...unexpected.map(c => ` ${c.after!.sourcePath}`),
|
|
522
|
+
"Describe each with a spec that has a null before and the path of the file."
|
|
523
|
+
].join("\n"));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
514
527
|
private async expectAfter(spec: SourceSpec<any>, after?: SourceFile, before?: SourceFile) {
|
|
515
528
|
if (!after) {
|
|
516
|
-
throw new Error('Expected for recipe to have produced a change for file:\n' + trimIndent(spec.before))
|
|
529
|
+
throw new Error('Expected for recipe to have produced a change for file:\n' + (trimIndent(spec.before) || spec.path))
|
|
517
530
|
}
|
|
518
531
|
await new ValidateWhitespaceVisitor().visit(after, this.executionContext);
|
|
519
532
|
const actualAfter = await TreePrinters.print(after);
|