diff --git a/__tests__/commands/workspaces.js b/__tests__/commands/workspaces.js index 3b8254dc2a..77eb988835 100644 --- a/__tests__/commands/workspaces.js +++ b/__tests__/commands/workspaces.js @@ -11,10 +11,10 @@ const fixturesLoc = path.join(__dirname, '..', 'fixtures', 'workspace'); async function runWorkspaces( flags: Object, args: Array, - name: string, + cwdSubfolders: string[], checkSteps?: ?(config: Config, reporter: BufferReporter) => ?Promise, ): Promise { - const cwd = path.join(fixturesLoc, name); + const cwd = path.join(fixturesLoc, ...cwdSubfolders); const reporter = new reporters.BufferReporter({stdout: null, stdin: null, isSilent: true}); const config = await Config.create({cwd}, reporter); @@ -27,7 +27,7 @@ async function runWorkspaces( } test('workspaces info should list the workspaces', (): Promise => { - return runWorkspaces({}, ['info'], 'run-basic', (config, reporter) => { + return runWorkspaces({}, ['info'], ['run-basic'], (config, reporter) => { expect(reporter.getBufferJson()).toEqual({ 'workspace-1': { location: 'packages/workspace-child-1', @@ -42,3 +42,15 @@ test('workspaces info should list the workspaces', (): Promise => { }); }); }); + +test('workspaces info should list the workspaces inside workspace folder', (): Promise => { + return runWorkspaces({}, ['info'], ['run-variations', 'trailing-slash'], (config, reporter) => { + expect(reporter.getBufferJson()).toEqual({ + 'trailing-slash': { + location: 'trailing-slash', + workspaceDependencies: [], + mismatchedWorkspaceDependencies: [], + }, + }); + }); +}); diff --git a/__tests__/fixtures/workspace/run-variations/package.json b/__tests__/fixtures/workspace/run-variations/package.json new file mode 100644 index 0000000000..4ff94d187c --- /dev/null +++ b/__tests__/fixtures/workspace/run-variations/package.json @@ -0,0 +1,7 @@ +{ + "name": "my-project", + "private": true, + "workspaces": [ + "trailing-slash/" + ] +} diff --git a/__tests__/fixtures/workspace/run-variations/trailing-slash/package.json b/__tests__/fixtures/workspace/run-variations/trailing-slash/package.json new file mode 100644 index 0000000000..480bbf85e2 --- /dev/null +++ b/__tests__/fixtures/workspace/run-variations/trailing-slash/package.json @@ -0,0 +1,10 @@ +{ + "name": "trailing-slash", + "version": "1.0.0", + "license": "UNLICENSED", + "scripts": { + "prescript": "echo trailing-slash prescript", + "script": "echo trailing-slash script", + "postscript": "echo trailing-slash postscript" + } +}