build(aio): initialise exampleMap
correctly (#22502)
The `exampleMap` needs to hold an hash object for each of the `collectExamples.exampleFolders` paths. Previously these hash objects were only created if there was actually an example file the hash's respective example folder. This could cause crashes during `yarn docs-watch` (and so also `yarn sync-and-serve`) if no examples were read in for a particular run of the doc-gen. PR Close #22502
This commit is contained in:

committed by
Alex Eagle

parent
2f0ab7ee98
commit
94707fe795
@ -25,6 +25,12 @@ describe('collectExampleRegions processor', () => {
|
||||
|
||||
describe('$process', () => {
|
||||
|
||||
it('should initialise the `exampleMap` even if there are no examples to collect', () => {
|
||||
processor.$process([]);
|
||||
expect(exampleMap['examples-1']).toEqual(jasmine.any(Object));
|
||||
expect(exampleMap['examples-2']).toEqual(jasmine.any(Object));
|
||||
});
|
||||
|
||||
it('should identify example files that are in the exampleFolders', () => {
|
||||
const docs = [
|
||||
createDoc('A', 'examples-1/x/app.js'), createDoc('B', 'examples-1/y/index.html'),
|
||||
|
Reference in New Issue
Block a user