Skip to content

Commit 155ec1c

Browse files
fix(schematics): fix unit tests for JSON with comments
1 parent f2af688 commit 155ec1c

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

modules/schematics/src/entity/index.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,14 @@ describe('Entity Schematic', () => {
240240

241241
describe('View engine', () => {
242242
beforeEach(() => {
243-
const tsConfig = JSON.parse(
244-
appTree.readContent('./projects/bar/tsconfig.app.json')
245-
);
243+
// remove the first line comment from the json file
244+
const json = appTree
245+
.readContent('./projects/bar/tsconfig.app.json')
246+
.split('\n')
247+
.slice(1)
248+
.join('\n');
249+
const tsConfig = JSON.parse(json);
250+
246251
tsConfig.angularCompilerOptions = tsConfig.angularCompilerOptions || {};
247252
tsConfig.angularCompilerOptions.enableIvy = false;
248253
appTree.overwrite(

modules/schematics/src/reducer/index.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
defaultAppOptions,
1313
} from '../../../schematics-core/testing';
1414

15-
describe('Reducer Schematic', () => {
15+
fdescribe('Reducer Schematic', () => {
1616
const schematicRunner = new SchematicTestRunner(
1717
'@ngrx/schematics',
1818
path.join(__dirname, '../../collection.json')
@@ -89,9 +89,14 @@ describe('Reducer Schematic', () => {
8989

9090
describe('View engine', () => {
9191
beforeEach(() => {
92-
const tsConfig = JSON.parse(
93-
appTree.readContent('./projects/bar/tsconfig.app.json')
94-
);
92+
// remove the first line comment from the json file
93+
const json = appTree
94+
.readContent('./projects/bar/tsconfig.app.json')
95+
.split('\n')
96+
.slice(1)
97+
.join('\n');
98+
const tsConfig = JSON.parse(json);
99+
95100
tsConfig.angularCompilerOptions = tsConfig.angularCompilerOptions || {};
96101
tsConfig.angularCompilerOptions.enableIvy = false;
97102
appTree.overwrite(

0 commit comments

Comments
 (0)