From 86b29e70186769df7b860e9acb930cc4ec31b8a0 Mon Sep 17 00:00:00 2001 From: ygj6 <7699524+ygj6@users.noreply.github.com> Date: Tue, 10 May 2022 21:31:25 +0800 Subject: [PATCH] test: update define expression (#7517) --- playground/define/__tests__/define.spec.ts | 4 +++- playground/define/index.html | 2 +- playground/define/vite.config.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/playground/define/__tests__/define.spec.ts b/playground/define/__tests__/define.spec.ts index 5d9707e70b47ba..3a4f34c5bbe7ff 100644 --- a/playground/define/__tests__/define.spec.ts +++ b/playground/define/__tests__/define.spec.ts @@ -1,7 +1,9 @@ test('string', async () => { const defines = require('../vite.config.js').define - expect(await page.textContent('.exp')).toBe(String(eval(defines.__EXP__))) + expect(await page.textContent('.exp')).toBe( + String(typeof eval(defines.__EXP__)) + ) expect(await page.textContent('.string')).toBe(JSON.parse(defines.__STRING__)) expect(await page.textContent('.number')).toBe(String(defines.__NUMBER__)) expect(await page.textContent('.boolean')).toBe(String(defines.__BOOLEAN__)) diff --git a/playground/define/index.html b/playground/define/index.html index c89a3fe02218ff..97a7b9902a1dcb 100644 --- a/playground/define/index.html +++ b/playground/define/index.html @@ -18,7 +18,7 @@

Define