diff --git a/packages/compiler-cli/test/compliance/linked/BUILD.bazel b/packages/compiler-cli/test/compliance/linked/BUILD.bazel index da796356b98..f26db3fc51b 100644 --- a/packages/compiler-cli/test/compliance/linked/BUILD.bazel +++ b/packages/compiler-cli/test/compliance/linked/BUILD.bazel @@ -24,10 +24,6 @@ jasmine_node_test( "//packages/compiler-cli/test/compliance/test_cases", ], shard_count = 2, - tags = [ - # TODO: renable this test after debugging the issues related to babel updates - "manual", - ], deps = [ ":test_lib", ], diff --git a/packages/compiler-cli/test/compliance/linked/linked_compile_spec.ts b/packages/compiler-cli/test/compliance/linked/linked_compile_spec.ts index 97fd96f7317..d1bc051bd7e 100644 --- a/packages/compiler-cli/test/compliance/linked/linked_compile_spec.ts +++ b/packages/compiler-cli/test/compliance/linked/linked_compile_spec.ts @@ -17,7 +17,10 @@ import {ComplianceTest} from '../test_helpers/get_compliance_tests'; import {parseGoldenPartial} from '../test_helpers/golden_partials'; import {runTests} from '../test_helpers/test_runner'; -runTests('linked compile', linkPartials); +runTests('linked compile', linkPartials, { + // TODO: Remove when https://github.com/angular/angular/issues/51647 is resolved. + skipMappingChecks: true, +}); /** * Link all the partials specified in the given `test`. diff --git a/packages/compiler-cli/test/compliance/test_helpers/check_expectations.ts b/packages/compiler-cli/test/compliance/test_helpers/check_expectations.ts index 40bf25cd602..deebc54dbf6 100644 --- a/packages/compiler-cli/test/compliance/test_helpers/check_expectations.ts +++ b/packages/compiler-cli/test/compliance/test_helpers/check_expectations.ts @@ -14,7 +14,7 @@ import {replaceMacros} from './expected_file_macros'; import {verifyUniqueFunctions} from './function_checks'; import {ExpectedFile, ExtraCheck} from './get_compliance_tests'; import {verifyPlaceholdersIntegrity, verifyUniqueConsts} from './i18n_checks'; -import {checkMappings} from './sourcemap_helpers'; +import {stripAndCheckMappings} from './sourcemap_helpers'; type ExtraCheckFunction = (generated: string, ...extraArgs: any[]) => boolean; const EXTRA_CHECK_FUNCTIONS: Record = { @@ -31,10 +31,13 @@ const EXTRA_CHECK_FUNCTIONS: Record = { * @param testPath Path to the current test case (relative to the basePath). * @param failureMessage The message to display if the expectation fails. * @param expectedFiles The list of expected-generated pairs to compare. + * @param skipMappingCheck Whether to skip checking source mappings. + * TODO: Remove this option. This only exists until we fix: + * https://github.com/angular/angular/issues/51647. */ export function checkExpectations( fs: ReadonlyFileSystem, testPath: string, failureMessage: string, expectedFiles: ExpectedFile[], - extraChecks: ExtraCheck[]): void { + extraChecks: ExtraCheck[], skipMappingCheck = false): void { const builtDirectory = getBuildOutputDirectory(fs); for (const expectedFile of expectedFiles) { const expectedPath = fs.resolve(getRootDirectory(fs), expectedFile.expected); @@ -58,7 +61,9 @@ export function checkExpectations( const generated = fs.readFile(generatedPath); let expected = fs.readFile(expectedPath); expected = replaceMacros(expected); - expected = checkMappings(fs, generated, generatedPath, expected, expectedPath); + expected = stripAndCheckMappings( + fs, generated, generatedPath, expected, expectedPath, + /** skipMappingCheck */ !!skipMappingCheck); expectEmit( generated, expected, diff --git a/packages/compiler-cli/test/compliance/test_helpers/sourcemap_helpers.ts b/packages/compiler-cli/test/compliance/test_helpers/sourcemap_helpers.ts index 29fc1d76073..1b5bed45a92 100644 --- a/packages/compiler-cli/test/compliance/test_helpers/sourcemap_helpers.ts +++ b/packages/compiler-cli/test/compliance/test_helpers/sourcemap_helpers.ts @@ -32,14 +32,19 @@ import {SourceFileLoader} from '../../../src/ngtsc/sourcemaps'; * @param expectedSource The content of the expected source file, containing mapping information. * @returns The content of the expected source file, stripped of the mapping information. */ -export function checkMappings( +export function stripAndCheckMappings( fs: ReadonlyFileSystem, generated: string, generatedPath: AbsoluteFsPath, - expectedSource: string, expectedPath: AbsoluteFsPath): string { + expectedSource: string, expectedPath: AbsoluteFsPath, skipMappingCheck: boolean): string { // Generate the candidate source maps. const actualMappings = getMappedSegments(fs, generatedPath, generated); const {expected, mappings} = extractMappings(fs, expectedSource); + // TODO: Remove when https://github.com/angular/angular/issues/51647 is fixed. + if (skipMappingCheck) { + return expected; + } + const failures: string[] = []; for (const expectedMapping of mappings) { const failure = checkMapping(actualMappings, expectedMapping); diff --git a/packages/compiler-cli/test/compliance/test_helpers/test_runner.ts b/packages/compiler-cli/test/compliance/test_helpers/test_runner.ts index f8dfdcf8b93..b1cc6e5b55e 100644 --- a/packages/compiler-cli/test/compliance/test_helpers/test_runner.ts +++ b/packages/compiler-cli/test/compliance/test_helpers/test_runner.ts @@ -45,9 +45,7 @@ function getFilenameForLocalCompilation(fileName: string): string { */ export function runTests( type: CompilationMode, compileFn: (fs: FileSystem, test: ComplianceTest) => CompileResult, - options = { - isLocalCompilation: false - }) { + options: {isLocalCompilation?: boolean, skipMappingChecks?: boolean} = {}) { describe(`compliance tests (${type})`, () => { for (const test of getAllComplianceTests()) { if (!test.compilationModeFilter.includes(type)) { @@ -73,7 +71,7 @@ export function runTests( const fs = initMockTestFileSystem(test.realTestPath); const {errors} = compileFn(fs, test); for (const expectation of test.expectations) { - transformExpectation(expectation, options.isLocalCompilation); + transformExpectation(expectation, !!options.isLocalCompilation); if (expectation.expectedErrors.length > 0) { checkErrors( test.relativePath, expectation.failureMessage, expectation.expectedErrors, @@ -82,7 +80,7 @@ export function runTests( checkNoUnexpectedErrors(test.relativePath, errors); checkExpectations( fs, test.relativePath, expectation.failureMessage, expectation.files, - expectation.extraChecks); + expectation.extraChecks, options.skipMappingChecks); } } });