From 57b5552b01e6b0e7b045aa14d2bf478e085d8839 Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Mon, 20 Apr 2020 21:46:33 +0800 Subject: [PATCH] make test handle both ssr html and initial html --- test/runtime/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/runtime/index.ts b/test/runtime/index.ts index da2228472b..a8e1b14529 100644 --- a/test/runtime/index.ts +++ b/test/runtime/index.ts @@ -49,7 +49,7 @@ describe('runtime', () => { const failed = new Set(); - function runTest(dir, hydrate) { + function runTest(dir, hydrate, from_ssr_html) { if (dir[0] === '.') return; const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); @@ -61,7 +61,8 @@ describe('runtime', () => { throw new Error('Forgot to remove `solo: true` from test'); } - (config.skip ? it.skip : solo ? it.only : it)(`${dir} ${hydrate ? '(with hydration)' : ''}`, () => { + const testName = `${dir} ${hydrate ? `(with hydration ${from_ssr_html ? 'from ssr rendered html' : ''})` : ''}`; + (config.skip ? it.skip : solo ? it.only : it)(testName, () => { if (failed.has(dir)) { // this makes debugging easier, by only printing compiled output once throw new Error('skipping test, already failed'); @@ -151,7 +152,7 @@ describe('runtime', () => { const target = window.document.querySelector('main'); - if (hydrate) { + if (hydrate && from_ssr_html) { // ssr into target compileOptions.generate = 'ssr'; cleanRequireCache(); @@ -255,7 +256,8 @@ describe('runtime', () => { fs.readdirSync(`${__dirname}/samples`).forEach(dir => { runTest(dir, false); - runTest(dir, true); + runTest(dir, true, false); + runTest(dir, true, true); }); async function create_component(src = '
') {