mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
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
This commit is contained in:
parent
736e7871db
commit
616c8a89b8
1 changed files with 17 additions and 13 deletions
|
|
@ -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', '');
|
||||
|
|
|
|||
Loading…
Reference in a new issue