From 2bb473be933b290d672db9d7e6ee83a1d8d6620b Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Mon, 19 Dec 2022 14:51:13 +0100 Subject: [PATCH] Add question for app-dir tests --- plopfile.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plopfile.js b/plopfile.js index 26a4aca67bbb8cd..2252bfdd19d6652 100644 --- a/plopfile.js +++ b/plopfile.js @@ -6,6 +6,12 @@ module.exports = function (plop) { plop.setGenerator('test', { description: 'Create a new test', prompts: [ + { + type: 'confirm', + name: 'appDir', + message: 'Is this test for the app directory?', + default: false, + }, { type: 'input', name: 'name', @@ -37,14 +43,18 @@ module.exports = function (plop) { templateFile: `test/${ data.type === 'unit' ? 'unit' : 'e2e' }/example.txt`, - path: `test/{{type}}/${fileName}/${fileName}.test.ts`, + path: `test/{{type}}/${ + data.appDir ? 'app-dir/' : '' + }${fileName}/${fileName}.test.ts`, }, { type: 'add', templateFile: `test/${ data.type === 'unit' ? 'unit' : 'e2e' }/example-file.txt`, - path: `test/{{type}}/${fileName}/pages/index.js`, + path: `test/{{type}}/${ + data.appDir ? 'app-dir/' : '' + }${fileName}/pages/index.js`, }, ] },