Skip to content

Commit 9a5ec5f

Browse files
committed
write json file from python
1 parent fbb89f2 commit 9a5ec5f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/common/parseEslintConfigForKnownGlobals.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const searchLines = [
1313
const restrictedGlobalLine = /^\s{4}- name:\s?([^#\s]+)/;
1414
const closingLine = /^\s{0,3}[^#\s]/;
1515

16-
process.stdout.write('["process"');
16+
const jsonFile = fs.openSync(path.join(__dirname, 'knownGlobals.json'), 'w')
17+
18+
fs.writeSync(jsonFile,'["process"');
1719

1820
const eslintConfig = readline.createInterface({
1921
input: fs.createReadStream(
@@ -27,7 +29,7 @@ eslintConfig.on('line', (line) => {
2729
if (isReadingGlobals) {
2830
const match = restrictedGlobalLine.exec(line);
2931
if (match != null) {
30-
process.stdout.write(',' + JSON.stringify(match[1]));
32+
fs.writeSync(jsonFile, ',' + JSON.stringify(match[1]));
3133
} else if (closingLine.test(line)) {
3234
isReadingGlobals = false;
3335
}
@@ -38,5 +40,6 @@ eslintConfig.on('line', (line) => {
3840
});
3941

4042
eslintConfig.once('close', () => {
41-
process.stdout.write(']');
43+
fs.writeSync(jsonFile, ']');
44+
fs.closeSync(jsonFile)
4245
});

tools/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,7 @@ def Main():
16401640
print("Can't determine the arch of: '%s'" % vm)
16411641
print(archEngineContext.stderr.rstrip())
16421642
continue
1643+
Execute([vm, 'test/common/parseEslintConfigForKnownGlobals.js'], context)
16431644
env = {
16441645
'mode': mode,
16451646
'system': utils.GuessOS(),

0 commit comments

Comments
 (0)