Paul Gschwendtner 2d0ff0a5d3 ci: add lint error for files with missing trailing new-line (#42478)
For quite a while it is an unspoken convention to add a trailing
new-line files within the Angular repository. This was never enforced
automatically, but has been frequently raised in pull requests through
manual review. This commit sets up a lint rule so that this is
"officially" enforced and doesn't require manual review.

PR Close #42478
2021-06-04 13:31:03 -07:00

42 lines
1.5 KiB
TypeScript

/**
* @license
* Copyright Google LLC 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 {absoluteFrom, getSourceFileOrError} from '../../file_system';
import {runInEachFileSystem} from '../../file_system/testing';
import {NOOP_PERF_RECORDER} from '../../perf';
import {makeProgram} from '../../testing';
import {IncrementalCompilation} from '../src/incremental';
runInEachFileSystem(() => {
describe('incremental reconciliation', () => {
it('should treat source files with changed versions as changed', () => {
const FOO_PATH = absoluteFrom('/foo.ts');
const {program} = makeProgram([
{name: FOO_PATH, contents: `export const FOO = true;`},
]);
const fooSf = getSourceFileOrError(program, FOO_PATH);
const versionMapFirst = new Map([[FOO_PATH, 'version.1']]);
const firstCompilation = IncrementalCompilation.fresh(
program,
versionMapFirst,
);
firstCompilation.recordSuccessfulAnalysis(null!);
firstCompilation.recordSuccessfulEmit(fooSf);
const versionMapSecond = new Map([[FOO_PATH, 'version.2']]);
const secondCompilation = IncrementalCompilation.incremental(
program, versionMapSecond, program, firstCompilation.state, new Set(),
NOOP_PERF_RECORDER);
secondCompilation.recordSuccessfulAnalysis(null!);
expect(secondCompilation.safeToSkipEmit(fooSf)).toBeFalse();
});
});
});