This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #513 from Shopify/fix-create-slate-theme-spaces
Make sure paths with spaces don't break Create Slate Theme
- Loading branch information
Showing
3 changed files
with
32 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,22 +3,23 @@ const path = require('path'); | |
const execa = require('execa'); | ||
const createSlateTheme = require('../create-slate-theme'); | ||
const config = require('../create-slate-theme.config'); | ||
const {splitCommandString} = require('../utils'); | ||
|
||
const TEST_PROJECT = 'test-project'; | ||
const TEST_STARTER = 'test-repo'; | ||
const TEST_COMMITTISH = '123456'; | ||
const CLONE_HTTPS_COMMAND = `git clone | ||
https://github.com/shopify/${TEST_STARTER} | ||
${path.resolve(TEST_PROJECT)} | ||
"${path.resolve(TEST_PROJECT)}" | ||
--single-branch`; | ||
const CLONE_SSH_COMMAND = `git clone | ||
[email protected]:shopify/${TEST_STARTER}.git | ||
${path.resolve(TEST_PROJECT)} | ||
"${path.resolve(TEST_PROJECT)}" | ||
--single-branch`; | ||
const CLONE_BRANCH_COMMAND = `git clone | ||
-b ${TEST_COMMITTISH} | ||
https://github.com/shopify/${TEST_STARTER} | ||
${path.resolve(TEST_PROJECT)} | ||
"${path.resolve(TEST_PROJECT)}" | ||
--single-branch`; | ||
|
||
jest.mock('@shopify/slate-env', () => { | ||
|
@@ -27,7 +28,7 @@ jest.mock('@shopify/slate-env', () => { | |
|
||
beforeAll(() => { | ||
// Mock process.exit since it terminates the test runner | ||
process.exit = jest.fn(code => { | ||
process.exit = jest.fn((code) => { | ||
throw new Error(`Process exit with code: ${code}`); | ||
}); | ||
}); | ||
|
@@ -38,7 +39,7 @@ beforeEach(() => { | |
}); | ||
|
||
test('can clone a theme from a Git repo using HTTPS', async () => { | ||
const [file, ...args] = CLONE_HTTPS_COMMAND.split(/\s+/); | ||
const [file, ...args] = splitCommandString(CLONE_HTTPS_COMMAND); | ||
|
||
await createSlateTheme('test-project', 'shopify/test-repo'); | ||
|
||
|
@@ -47,7 +48,7 @@ test('can clone a theme from a Git repo using HTTPS', async () => { | |
}); | ||
|
||
test('can clone a theme from a Git repo using SSH', async () => { | ||
const [file, ...args] = CLONE_SSH_COMMAND.split(/\s+/); | ||
const [file, ...args] = splitCommandString(CLONE_SSH_COMMAND); | ||
|
||
await createSlateTheme('test-project', 'shopify/test-repo', {ssh: true}); | ||
|
||
|
@@ -56,7 +57,7 @@ test('can clone a theme from a Git repo using SSH', async () => { | |
}); | ||
|
||
test('can clone a theme from a Github repo with a specified commitish (branch)', async () => { | ||
const [file, ...args] = CLONE_BRANCH_COMMAND.split(/\s+/); | ||
const [file, ...args] = splitCommandString(CLONE_BRANCH_COMMAND); | ||
|
||
await createSlateTheme('test-project', 'shopify/test-repo#123456'); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters