Skip to content

Commit

Permalink
fix(schematics): fix unit tests for JSON with comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Jun 26, 2020
1 parent f2af688 commit 155ec1c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
11 changes: 8 additions & 3 deletions modules/schematics/src/entity/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,14 @@ describe('Entity Schematic', () => {

describe('View engine', () => {
beforeEach(() => {
const tsConfig = JSON.parse(
appTree.readContent('./projects/bar/tsconfig.app.json')
);
// remove the first line comment from the json file
const json = appTree
.readContent('./projects/bar/tsconfig.app.json')
.split('\n')
.slice(1)
.join('\n');
const tsConfig = JSON.parse(json);

tsConfig.angularCompilerOptions = tsConfig.angularCompilerOptions || {};
tsConfig.angularCompilerOptions.enableIvy = false;
appTree.overwrite(
Expand Down
13 changes: 9 additions & 4 deletions modules/schematics/src/reducer/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
defaultAppOptions,
} from '../../../schematics-core/testing';

describe('Reducer Schematic', () => {
fdescribe('Reducer Schematic', () => {
const schematicRunner = new SchematicTestRunner(
'@ngrx/schematics',
path.join(__dirname, '../../collection.json')
Expand Down Expand Up @@ -89,9 +89,14 @@ describe('Reducer Schematic', () => {

describe('View engine', () => {
beforeEach(() => {
const tsConfig = JSON.parse(
appTree.readContent('./projects/bar/tsconfig.app.json')
);
// remove the first line comment from the json file
const json = appTree
.readContent('./projects/bar/tsconfig.app.json')
.split('\n')
.slice(1)
.join('\n');
const tsConfig = JSON.parse(json);

tsConfig.angularCompilerOptions = tsConfig.angularCompilerOptions || {};
tsConfig.angularCompilerOptions.enableIvy = false;
appTree.overwrite(
Expand Down

0 comments on commit 155ec1c

Please sign in to comment.