You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2019/10/28 11:57:59 UTC

[incubator-echarts] 01/01: test(visual): sort actions meta data by keys

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch test-actions-name-sort
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit b45a1acf5086ff98d31bb132c2d53b886427d246
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Oct 28 19:57:39 2019 +0800

    test(visual): sort actions meta data by keys
---
 test/runTest/actions/update.js | 2 +-
 test/runTest/store.js          | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/test/runTest/actions/update.js b/test/runTest/actions/update.js
index b82aab6..5fd45d8 100644
--- a/test/runTest/actions/update.js
+++ b/test/runTest/actions/update.js
@@ -30,5 +30,5 @@ glob('*.json', (err, files) => {
         const actions = JSON.parse(fs.readFileSync(file, 'utf-8'));
         result[file.replace(/.json$/, '')] = actions.length;
     });
-    fs.writeFileSync('__meta__.json', JSON.stringify(result, null, 2), 'utf-8');
+    fs.writeFileSync('__meta__.json', JSON.stringify(result, Object.keys(result).sort((a, b) => a.localeCompare(b)), 2), 'utf-8');
 });
\ No newline at end of file
diff --git a/test/runTest/store.js b/test/runTest/store.js
index 93e7856..ae8c0b2 100644
--- a/test/runTest/store.js
+++ b/test/runTest/store.js
@@ -144,5 +144,8 @@ module.exports.updateActionsMeta = function (testName, actions) {
         metaData = {};
     }
     metaData[testName] = actions.length;
-    fs.writeFileSync(metaPath, JSON.stringify(metaData, null, 2), 'utf-8');
+
+    fs.writeFileSync(metaPath, JSON.stringify(
+        metaData, Object.keys(metaData).sort((a, b) => a.localeCompare(b)), 2
+    ), 'utf-8');
 };
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org