Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clasp logout #164

Merged
merged 1 commit into from
May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ commander
.description('Log out')
.action(() => {
del(DOT.RC.ABSOLUTE_PATH, { force: true }); // del doesn't work with a relative path (~)
del(DOT.RC.ABSOLUTE_LOCAL_PATH, { force: true });
});

/**
Expand Down
1 change: 1 addition & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const DOT = {
NAME: `${PROJECT_NAME}rc.json`,
PATH: path.join('~', `.${PROJECT_NAME}rc.json`),
ABSOLUTE_PATH: path.join(os.homedir(), `.${PROJECT_NAME}rc.json`),
ABSOLUTE_LOCAL_PATH: path.join('.', `.${PROJECT_NAME}rc.json`),
},
};

Expand Down
5 changes: 3 additions & 2 deletions tests/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { describe, it } from 'mocha';
import { expect } from 'chai';
import * as fs from 'fs';
import * as os from 'os';

const { spawnSync } = require('child_process');
import { getScriptURL, getFileType, getAPIFileType,
saveProjectId } from './../src/utils.js';
Expand Down Expand Up @@ -202,11 +204,10 @@ describe('Test saveProjectId function from utils', () => {
});
});

// Fails when you logged in using --ownkey flag
describe.skip('Test clasp logout function', () => {
it('should logout correctly', () => {
fs.writeFileSync('.clasprc.json', ' ');
fs.writeFileSync('~/.clasprc.json', ' ');
fs.writeFileSync(path.join(os.homedir(), '/.clasprc.json'), ' ');
const result = spawnSync(
'clasp', ['logout'], { encoding: 'utf8' },
);
Expand Down