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`, }, ] },