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 2021/01/02 13:06:02 UTC

[incubator-echarts-examples] branch next updated: test: optimize type checking

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

shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-examples.git


The following commit(s) were added to refs/heads/next by this push:
     new 72a6c1d  test: optimize type checking
72a6c1d is described below

commit 72a6c1d9f7824ec0bfd458773e2149f1e4e0361a
Author: pissang <bm...@gmail.com>
AuthorDate: Sat Jan 2 21:05:45 2021 +0800

    test: optimize type checking
---
 test/main.js     |  8 ++++++++
 test/report.html | 20 +++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/test/main.js b/test/main.js
index b4b91d6..27520bf 100644
--- a/test/main.js
+++ b/test/main.js
@@ -65,6 +65,7 @@ echarts.registerPreprocessor(function (option) {
         if (!(option.series instanceof Array)) {
             option.series = [option.series];
         }
+        // @ts-ignore
         option.series.forEach(function (seriesOpt) {
             if (seriesOpt.type === 'graph') {
                 seriesOpt.force = seriesOpt.force || {};
@@ -497,6 +498,13 @@ async function compareExamples(testNames, result) {
             ratio: diffMinimalLegacy.diffRatio,
             png: nodePath.basename(diffMinimalLegacyPNGPath)
         };
+
+        if (diffMinimal.diffRatio > 0 || diffMinimalLegacy.diffRatio > 0) {
+            console.log(chalk.red(`Failed ${testName}`));
+        }
+        else {
+            console.log(chalk.green(`Passed ${testName}`));
+        }
     }
 }
 
diff --git a/test/report.html b/test/report.html
index 42866d6..f554e42 100644
--- a/test/report.html
+++ b/test/report.html
@@ -21,14 +21,22 @@
         }
 
         .type-error-log {
-            padding: 5px;
+            padding: 10px;
             color: red;
             font-family:'Courier New', Courier, monospace;
+            /* https://css-tricks.com/snippets/css/make-pre-text-wrap/ */
+            white-space: pre-wrap;
         }
         .type-error-log pre {
             margin: 5px 0;
             padding: 0;
         }
+        .type-passed {
+            font-size: 14px;
+            color: green;
+            font-family:'Courier New', Courier, monospace;
+            padding: 10px;
+        }
     </style>
 
 </head>
@@ -45,11 +53,14 @@
                                     <div>全量引入</div>
                                     <div>Full Import</div>
                                 </div>
-                                <div class="type-error-log">
+                                <div class="type-error-log" v-if="item.compileErrors.full.length">
                                     <div v-for="compileError in item.compileErrors.full">
                                         <pre>[{{compileError.location.join(', ')}}] {{compileError.message}}</pre>
                                     </div>
                                 </div>
+                                <div class="type-passed" v-else>
+                                    No Error
+                                </div>
                             </el-card>
                         </el-col>
                         <el-col :span="12">
@@ -58,11 +69,14 @@
                                     <div>按需引入</div>
                                     <div>Minimal Import </div>
                                 </div>
-                                <div class="type-error-log">
+                                <div class="type-error-log" v-if="item.compileErrors.minimal.length">
                                     <div v-for="compileError in item.compileErrors.minimal">
                                         <pre>[{{compileError.location.join(', ')}}] {{compileError.message}}</pre>
                                     </div>
                                 </div>
+                                <div class="type-passed" v-else>
+                                    No Error
+                                </div>
                             </el-card>
                         </el-col>
                     </el-row>


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