From 8d722ae1aacafeb6be048152095b06a4bbe20c2f Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Mon, 28 Oct 2019 12:41:53 +0800 Subject: [PATCH] look for test folder name for solo mode as well --- test/hydration/index.js | 5 +++-- test/preprocess/index.js | 5 +++-- test/runtime/index.js | 5 +++-- test/server-side-rendering/index.js | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/hydration/index.js b/test/hydration/index.js index fda799ef2d..85e2ccc4a0 100644 --- a/test/hydration/index.js +++ b/test/hydration/index.js @@ -41,12 +41,13 @@ describe('hydration', () => { if (dir[0] === '.') return; const config = loadConfig(`./hydration/samples/${dir}/_config.js`); + const solo = config.solo || /\.solo/.test(dir); - if (config.solo && process.env.CI) { + if (solo && process.env.CI) { throw new Error('Forgot to remove `solo: true` from test'); } - (config.skip ? it.skip : config.solo ? it.only : it)(dir, () => { + (config.skip ? it.skip : solo ? it.only : it)(dir, () => { const cwd = path.resolve(`${__dirname}/samples/${dir}`); compileOptions = config.compileOptions || {}; diff --git a/test/preprocess/index.js b/test/preprocess/index.js index ea24645295..5d83bb6059 100644 --- a/test/preprocess/index.js +++ b/test/preprocess/index.js @@ -7,12 +7,13 @@ describe('preprocess', () => { if (dir[0] === '.') return; const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); + const solo = config.solo || /\.solo/.test(dir); - if (config.solo && process.env.CI) { + if (solo && process.env.CI) { throw new Error('Forgot to remove `solo: true` from test'); } - (config.skip ? it.skip : config.solo ? it.only : it)(dir, async () => { + (config.skip ? it.skip : solo ? it.only : it)(dir, async () => { const input = fs.readFileSync(`${__dirname}/samples/${dir}/input.svelte`, 'utf-8'); const expected = fs.readFileSync(`${__dirname}/samples/${dir}/output.svelte`, 'utf-8'); diff --git a/test/runtime/index.js b/test/runtime/index.js index 5955b06c0b..14c2143e09 100644 --- a/test/runtime/index.js +++ b/test/runtime/index.js @@ -50,14 +50,15 @@ describe("runtime", () => { if (dir[0] === ".") return; const config = loadConfig(`${__dirname}/samples/${dir}/_config.js`); + const solo = config.solo || /\.solo/.test(dir); if (hydrate && config.skip_if_hydrate) return; - if (config.solo && process.env.CI) { + if (solo && process.env.CI) { throw new Error("Forgot to remove `solo: true` from test"); } - (config.skip ? it.skip : config.solo ? it.only : it)(`${dir} ${hydrate ? '(with hydration)' : ''}`, () => { + (config.skip ? it.skip : solo ? it.only : it)(`${dir} ${hydrate ? '(with hydration)' : ''}`, () => { if (failed.has(dir)) { // this makes debugging easier, by only printing compiled output once throw new Error('skipping test, already failed'); diff --git a/test/server-side-rendering/index.js b/test/server-side-rendering/index.js index 0a4b6f7496..d89b47191a 100644 --- a/test/server-side-rendering/index.js +++ b/test/server-side-rendering/index.js @@ -86,14 +86,15 @@ describe("ssr", () => { if (dir[0] === ".") return; const config = loadConfig(`./runtime/samples/${dir}/_config.js`); + const solo = config.solo || /\.solo/.test(dir); - if (config.solo && process.env.CI) { + if (solo && process.env.CI) { throw new Error("Forgot to remove `solo: true` from test"); } if (config.skip_if_ssr) return; - (config.skip ? it.skip : config.solo ? it.only : it)(dir, () => { + (config.skip ? it.skip : solo ? it.only : it)(dir, () => { const cwd = path.resolve("test/runtime/samples", dir); Object.keys(require.cache)