We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
SchematicTestRunner.runExternalSchematic
1 parent 9ce8fef commit 4abb18bCopy full SHA for 4abb18b
packages/angular_devkit/schematics/src/tree/host-tree.ts
@@ -304,7 +304,12 @@ export class HostTree implements Tree {
304
// With the `fatal` option enabled, invalid data will throw a TypeError
305
return decoder.decode(data);
306
} catch (e) {
307
- if (e instanceof TypeError) {
+ // The second part should not be needed. But Jest does not support instanceof correctly.
308
+ // See: https://github.com/jestjs/jest/issues/2549
309
+ if (
310
+ e instanceof TypeError ||
311
+ (e as NodeJS.ErrnoException).code === 'ERR_ENCODING_INVALID_ENCODED_DATA'
312
+ ) {
313
throw new Error(`Failed to decode "${path}" as UTF-8 text.`);
314
}
315
throw e;
0 commit comments