Skip to content

Commit 5e16992

Browse files
authored
Merge pull request #2232 from plotly/no-strings-on-test
don't write out strings from find_locale_strings during tests
2 parents 5bc25b4 + 13eb140 commit 5e16992

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"test-image": "node tasks/test_image.js",
3838
"test-image-gl2d": "node tasks/test_image.js gl2d_* --queue",
3939
"test-export": "node tasks/test_export.js",
40-
"test-syntax": "node tasks/test_syntax.js && npm run find-strings",
40+
"test-syntax": "node tasks/test_syntax.js && npm run find-strings -- --no-output",
4141
"test-bundle": "node tasks/test_bundle.js",
4242
"test": "npm run test-jasmine && npm run test-bundle && npm run test-image && npm run test-image-gl2d && npm run test-syntax && npm run lint",
4343
"start-test_dashboard": "node devtools/test_dashboard/server.js",

tasks/find_locale_strings.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ var EXIT_CODE = 0;
1313

1414
var localizeRE = /(^|[\.])(_|localize)$/;
1515

16+
var noOutput = process.argv.indexOf('--no-output') !== -1;
17+
1618
// main
1719
findLocaleStrings();
1820

@@ -70,11 +72,16 @@ function findLocaleStrings() {
7072
}
7173

7274
if(!EXIT_CODE) {
73-
var strings = Object.keys(dict).sort().map(function(k) {
74-
return k + spaces(maxLen - k.length) + ' // ' + dict[k];
75-
}).join('\n');
76-
common.writeFile(constants.pathToTranslationKeys, strings);
77-
console.log('ok find_locale_strings');
75+
if(noOutput) {
76+
console.log('ok find_locale_strings - no output requested.');
77+
}
78+
else {
79+
var strings = Object.keys(dict).sort().map(function(k) {
80+
return k + spaces(maxLen - k.length) + ' // ' + dict[k];
81+
}).join('\n');
82+
common.writeFile(constants.pathToTranslationKeys, strings);
83+
console.log('ok find_locale_strings - wrote new key file.');
84+
}
7885
}
7986
});
8087
}

0 commit comments

Comments
 (0)