@@ -155,7 +155,7 @@ describe('includeTransform', () => {
|
||||
await expect(
|
||||
includeTransform({ $include: 'invalid.yaml' }, root),
|
||||
).rejects.toThrow(
|
||||
'failed to parse included file invalid.yaml, YAMLSyntaxError: Flow sequence contains an unexpected }',
|
||||
/failed to parse included file invalid.yaml, YAMLParseError: Flow sequence in block collection must be sufficiently indented and end with a \] at line 1, column 7:\s+foo: \[\}/,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ describe('yamlPlaceholderResolver', () => {
|
||||
it('rejects invalid yaml', async () => {
|
||||
read.mockResolvedValue(Buffer.from('a: 1\n----\n', 'utf-8'));
|
||||
await expect(yamlPlaceholderResolver(params)).rejects.toThrow(
|
||||
'Placeholder $a found an error in the data at ./file.yaml, YAMLSemanticError: Implicit map keys need to be followed by map values',
|
||||
/Placeholder \$a found an error in the data at .\/file.yaml, YAMLParseError: Implicit map keys need to be followed by map values at line 2, column 1:\s+a: 1/,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -156,12 +156,16 @@ describe('parseEntityYaml', () => {
|
||||
);
|
||||
|
||||
// Parse errors are always per document
|
||||
expect(results).toEqual([
|
||||
processingResult.generalError(
|
||||
testLoc,
|
||||
'YAML error at my-loc-type:my-loc-target, YAMLSemanticError: Plain value cannot start with reserved character `',
|
||||
),
|
||||
]);
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0]).toEqual({
|
||||
type: 'error',
|
||||
location: testLoc,
|
||||
error: expect.objectContaining({
|
||||
message: expect.stringMatching(
|
||||
/YAML error at my-loc-type:my-loc-target, YAMLParseError: Plain value cannot start with reserved character ` at line 1, column 1:/,
|
||||
),
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
it('should emit parsing errors for individual documents', () => {
|
||||
@@ -185,7 +189,8 @@ describe('parseEntityYaml', () => {
|
||||
),
|
||||
);
|
||||
|
||||
expect(results).toEqual([
|
||||
expect(results.length).toBe(2);
|
||||
expect(results[0]).toEqual(
|
||||
processingResult.entity(testLoc, {
|
||||
apiVersion: 'backstage.io/v1alpha1',
|
||||
kind: 'Component',
|
||||
@@ -196,11 +201,16 @@ describe('parseEntityYaml', () => {
|
||||
type: 'website',
|
||||
},
|
||||
}),
|
||||
processingResult.generalError(
|
||||
testLoc,
|
||||
'YAML error at my-loc-type:my-loc-target, YAMLSemanticError: Nested mappings are not allowed in compact mappings',
|
||||
),
|
||||
]);
|
||||
);
|
||||
expect(results[1]).toEqual({
|
||||
type: 'error',
|
||||
location: testLoc,
|
||||
error: expect.objectContaining({
|
||||
message: expect.stringMatching(
|
||||
/YAML error at my-loc-type:my-loc-target, YAMLParseError: Nested mappings are not allowed in compact mappings at line 9, column 19:\s+apiVersion: backstage.io\/v1alpha1/,
|
||||
),
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
it('must be an object at root', () => {
|
||||
|
||||
Reference in New Issue
Block a user