refactor(ivy): ngcc - implement abstract FileSystem (#29643)
This commit introduces a new interface, which abstracts access to the underlying `FileSystem`. There is initially one concrete implementation, `NodeJsFileSystem`, which is simply wrapping the `fs` library of NodeJs. Going forward, we can provide a `MockFileSystem` for test, which should allow us to stop using `mock-fs` for most of the unit tests. We could also implement a `CachedFileSystem` that may improve the performance of ngcc. PR Close #29643
This commit is contained in:

committed by
Andrew Kushnir

parent
1fd2cc6340
commit
16d7dde2ad
@ -8,7 +8,7 @@
|
||||
|
||||
import * as ts from 'typescript';
|
||||
|
||||
import {ClassMemberKind, Import, isNamedClassDeclaration, isNamedFunctionDeclaration, isNamedVariableDeclaration} from '../../../src/ngtsc/reflection';
|
||||
import {ClassMemberKind, CtorParameter, Import, isNamedClassDeclaration, isNamedFunctionDeclaration, isNamedVariableDeclaration} from '../../../src/ngtsc/reflection';
|
||||
import {Esm2015ReflectionHost} from '../../src/host/esm2015_host';
|
||||
import {MockLogger} from '../helpers/mock_logger';
|
||||
import {getDeclaration, makeTestBundleProgram, makeTestProgram} from '../helpers/utils';
|
||||
@ -1007,7 +1007,7 @@ describe('Esm2015ReflectionHost', () => {
|
||||
const parameters = host.getConstructorParameters(classNode) !;
|
||||
|
||||
expect(parameters.length).toBe(1);
|
||||
expect(parameters[0]).toEqual(jasmine.objectContaining({
|
||||
expect(parameters[0]).toEqual(jasmine.objectContaining<CtorParameter>({
|
||||
name: 'arg1',
|
||||
decorators: [],
|
||||
}));
|
||||
@ -1021,7 +1021,7 @@ describe('Esm2015ReflectionHost', () => {
|
||||
const parameters = host.getConstructorParameters(classNode) !;
|
||||
|
||||
expect(parameters.length).toBe(1);
|
||||
expect(parameters[0]).toEqual(jasmine.objectContaining({
|
||||
expect(parameters[0]).toEqual(jasmine.objectContaining<CtorParameter>({
|
||||
name: 'arg1',
|
||||
decorators: null,
|
||||
}));
|
||||
@ -1035,7 +1035,7 @@ describe('Esm2015ReflectionHost', () => {
|
||||
const parameters = host.getConstructorParameters(classNode) !;
|
||||
|
||||
expect(parameters.length).toBe(1);
|
||||
expect(parameters[0]).toEqual(jasmine.objectContaining({
|
||||
expect(parameters[0]).toEqual(jasmine.objectContaining<CtorParameter>({
|
||||
name: 'arg1',
|
||||
decorators: null,
|
||||
}));
|
||||
@ -1115,11 +1115,11 @@ describe('Esm2015ReflectionHost', () => {
|
||||
const parameters = host.getConstructorParameters(classNode);
|
||||
|
||||
expect(parameters !.length).toBe(2);
|
||||
expect(parameters ![0]).toEqual(jasmine.objectContaining({
|
||||
expect(parameters ![0]).toEqual(jasmine.objectContaining<CtorParameter>({
|
||||
name: 'arg1',
|
||||
decorators: null,
|
||||
}));
|
||||
expect(parameters ![1]).toEqual(jasmine.objectContaining({
|
||||
expect(parameters ![1]).toEqual(jasmine.objectContaining<CtorParameter>({
|
||||
name: 'arg2',
|
||||
decorators: jasmine.any(Array) as any
|
||||
}));
|
||||
|
Reference in New Issue
Block a user