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 2020/12/28 04:42:48 UTC
[incubator-echarts] 01/02: chore: fix error in visual test after
updated plugin
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch treeshakable-exports
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 3054d8bd3556d0fb3b513102981247ae8e1008a8
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Dec 28 11:59:54 2020 +0800
chore: fix error in visual test after updated plugin
---
test/runTest/runtime/{timer.js => MockDate.js} | 3 ++-
test/runTest/runtime/main.js | 4 +++-
test/runTest/util.js | 13 +++++++------
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/test/runTest/runtime/timer.js b/test/runTest/runtime/MockDate.js
similarity index 98%
rename from test/runTest/runtime/timer.js
rename to test/runTest/runtime/MockDate.js
index fd81940..6ebccb2 100644
--- a/test/runTest/runtime/timer.js
+++ b/test/runTest/runtime/MockDate.js
@@ -37,5 +37,6 @@ function MockDate(...args) {
MockDate.prototype = Object.create(NativeDate.prototype);
Object.setPrototypeOf(MockDate, NativeDate);
MockDate.now = mockNow;
-window.Date = MockDate;
+
+export default MockDate;
diff --git a/test/runTest/runtime/main.js b/test/runTest/runtime/main.js
index 50af624..9173e0f 100644
--- a/test/runTest/runtime/main.js
+++ b/test/runTest/runtime/main.js
@@ -18,7 +18,9 @@
*/
import seedrandom from 'seedrandom';
-import './timer';
+import MockDate from './MockDate';
+
+window.Date = MockDate;
if (typeof __TEST_PLAYBACK_SPEED__ === 'undefined') {
window.__TEST_PLAYBACK_SPEED__ = 1;
diff --git a/test/runTest/util.js b/test/runTest/util.js
index b2e235e..d7541d8 100644
--- a/test/runTest/util.js
+++ b/test/runTest/util.js
@@ -22,7 +22,7 @@ const fse = require('fs-extra');
const https = require('https');
const fs = require('fs');
const rollup = require('rollup');
-const resolve = require('@rollup/plugin-node-resolve');
+const {nodeResolve} = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const config = require('./config');
@@ -112,17 +112,18 @@ module.exports.buildRuntimeCode = async function () {
const bundle = await rollup.rollup({
input: path.join(__dirname, 'runtime/main.js'),
plugins: [
- resolve(),
- commonjs(),
{
- resolveId(importee) {
- return importee === 'crypto' ? importee : null;
+ // https://rollupjs.org/guide/en/#a-simple-example
+ resolveId(source, importer) {
+ return source === 'crypto' ? source : null;
},
load(id) {
// seedrandom use crypto as external module
return id === 'crypto' ? 'export default null;' : null;
}
- }
+ },
+ nodeResolve(),
+ commonjs()
]
});
const { output } = await bundle.generate({
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org