angular-cn/packages/compiler-cli/ngcc/test/helpers/mock_lock_file.ts

25 lines
730 B
TypeScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {FileSystem} from '../../../src/ngtsc/file_system';
import {LockFile} from '../../src/locking/lock_file';
/**
* A mock implementation of `LockFile` that just logs its calls.
*/
export class MockLockFile implements LockFile {
constructor(
fs: FileSystem, private log: string[] = [], public path = fs.resolve('/lockfile'),
private pid = '1234') {}
write() { this.log.push('write()'); }
read(): string {
this.log.push('read()');
return this.pid;
}
remove() { this.log.push('remove()'); }
}