Skip to content

Commit 1d1a6be

Browse files
committed
test: remove single and multiline when using updateJsonFile
(cherry picked from commit 88d0eaf)
1 parent 71b20fb commit 1d1a6be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/legacy-cli/e2e/utils/project.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const tsConfigPath = 'tsconfig.base.json';
1212
export function updateJsonFile(filePath: string, fn: (json: any) => any | void) {
1313
return readFile(filePath)
1414
.then(tsConfigJson => {
15-
const tsConfig = JSON.parse(tsConfigJson);
15+
// Remove single and multiline comments
16+
const tsConfig = JSON.parse(tsConfigJson.replace(/\/\*\s(.|\n|\r)*\s\*\/|\/\/.*/g, ''));
1617
const result = fn(tsConfig) || tsConfig;
1718

1819
return writeFile(filePath, JSON.stringify(result, null, 2));

0 commit comments

Comments
 (0)