Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vercel/vercel
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 12.1.4
Choose a base ref
...
head repository: vercel/vercel
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 12.1.5
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Nov 21, 2018

  1. Make now teams add work (#1684)

    * Make `now teams add` work
    
    * Added integration test
    
    * Added comment
    leo committed Nov 21, 2018
    Copy the full SHA
    e6802d8 View commit details
  2. 12.1.5

    leo committed Nov 21, 2018
    Copy the full SHA
    da5c75c View commit details
Showing with 27 additions and 4 deletions.
  1. +1 −1 package.json
  2. +1 −1 src/commands/teams.js
  3. +10 −2 src/commands/teams/add.js
  4. +15 −0 test/integration.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "now",
"version": "12.1.4",
"version": "12.1.5",
"license": "Apache-2.0",
"description": "The command-line interface for Now",
"repository": "zeit/now-cli",
2 changes: 1 addition & 1 deletion src/commands/teams.js
Original file line number Diff line number Diff line change
@@ -145,7 +145,7 @@ async function run({ token, config }) {
}
case 'add':
case 'create': {
exitCode = await add({ teams, config });
exitCode = await add({ apiUrl, token, teams, config });
break;
}

12 changes: 10 additions & 2 deletions src/commands/teams/add.js
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ const gracefulExit = () => {
const teamUrlPrefix = rightPad('Team URL', 14) + chalk.gray('zeit.co/');
const teamNamePrefix = rightPad('Team Name', 14);

module.exports = async function({ teams, config }) {
module.exports = async function({ apiUrl, token, teams, config }) {
let slug;
let team;
let elapsed;
@@ -128,14 +128,22 @@ module.exports = async function({ teams, config }) {

// Update config file
const configCopy = Object.assign({}, config);
configCopy.sh.currentTeam = team;

if (configCopy.sh) {
configCopy.sh.currentTeam = team;
} else {
configCopy.currentTeam = team.id;
}

writeToConfigFile(configCopy);

stopSpinner();

await invite({
teams,
args: [],
token,
apiUrl,
config,
introMsg: 'Invite your teammates! When done, press enter on an empty field',
noopMsg: `You can invite teammates later by running ${cmd(
15 changes: 15 additions & 0 deletions test/integration.js
Original file line number Diff line number Diff line change
@@ -119,6 +119,21 @@ test('log in', async t => {
t.is(last, goal);
});

test('try creating a team', async t => {
const { stdout, code } = await execa(binaryPath, [
'teams',
'add',
...defaultArgs
], {
reject: false
});

// The error code is `1` because the command is expecting TTY
// because it provides an interactive interface.
t.is(code, 1);
t.true(stdout.startsWith(`> Pick a team identifier for its url`));
});

test('list the payment methods', async t => {
const { stdout, code } = await execa(binaryPath, [
'billing',