From 616c8a89b8313b04306ff50fe283fa7065cf7286 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 30 Jun 2022 13:24:32 +0000 Subject: [PATCH] test: update schematics workspace test to no longer verify JSON5 features (#46642) The Angular CLI has removed the JSON5 parsing and now always uses `jsonc-parser`. Our test checks if JSON5 features can be parsed, but this now breaks and the test needs to be adjusted. We still want to keep the test to ensure we do not parse the Angular CLI workspace file in a different way, not e.g. supporting jsonc. PR Close #46642 --- .../test/project_tsconfig_paths_spec.ts | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/core/schematics/test/project_tsconfig_paths_spec.ts b/packages/core/schematics/test/project_tsconfig_paths_spec.ts index 7fdda4de7e2..4ac2825394e 100644 --- a/packages/core/schematics/test/project_tsconfig_paths_spec.ts +++ b/packages/core/schematics/test/project_tsconfig_paths_spec.ts @@ -8,6 +8,7 @@ import {HostTree} from '@angular-devkit/schematics'; import {UnitTestTree} from '@angular-devkit/schematics/testing'; + import {getProjectTsConfigPaths} from '../utils/project_tsconfig_paths'; describe('project tsconfig paths', () => { @@ -27,17 +28,18 @@ describe('project tsconfig paths', () => { expect((await getProjectTsConfigPaths(testTree)).buildPaths).toEqual(['my-custom-config.json']); }); - it('should be able to read workspace configuration which is using JSON5 features', async () => { - testTree.create('/my-build-config.json', ''); - testTree.create('/angular.json', `{ - version: 1, - // Comments, unquoted properties or trailing commas are only supported in JSON5. - projects: { - with_tests: { - targets: { - build: { - options: { - tsConfig: './my-build-config.json', + it('should be able to read workspace configuration which is using jsconc-parser features', + async () => { + testTree.create('/my-build-config.json', ''); + testTree.create('/angular.json', `{ + "version": 1, + // Comments are supported in the workspace configurations. + "projects": { + "with_tests": { + "targets": { + "build": { + "options": { + "tsConfig": "./my-build-config.json", } } } @@ -45,8 +47,10 @@ describe('project tsconfig paths', () => { }, }`); - expect((await getProjectTsConfigPaths(testTree)).buildPaths).toEqual(['my-build-config.json']); - }); + expect((await getProjectTsConfigPaths(testTree)).buildPaths).toEqual([ + 'my-build-config.json' + ]); + }); it('should detect test tsconfig path inside of angular.json file', async () => { testTree.create('/my-test-config.json', '');