-
Notifications
You must be signed in to change notification settings - Fork 437
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
Add clasp status tests and --json option #167
Add clasp status tests and --json option #167
Conversation
Pull Request Test Coverage Report for Build 160
💛 - Coveralls |
index.ts
Outdated
console.log(`└─ ${filePath}`); | ||
}); | ||
if (ignoredFilePaths.length) { | ||
const status = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this format.
const [filesToPush, untrackedFiles] = projectFiles;
Below use:
if (cmd.json) {
console.log(JSON.stringify({ filesToPush, untrackedFiles});
Thanks @ajlai. LGTM in general. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, pending a couple of comments I made.
@@ -106,6 +107,47 @@ describe.skip('Test clasp push function', () => { | |||
}); | |||
}); | |||
|
|||
describe.skip('Test clasp status function', () => { | |||
function setupTmpDirectory(filepathsAndContents: Array<{ file: string, data: string }>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why we need a /tmp
directory for testing. We've been using fs.writeFileSync('.clasprc.json', ' ');
if we need files for testing. Should we be changing that in the other tests as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the other tests using fs.writeFileSync
directly actually just end up dumping files into the /clasp directory. It'd probably be better to have all the test related file writing in tmp/ so we can clean up nicely afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
expect(resultJson.untrackedFiles).to.have.members(['shouldBeIgnored', 'should/alsoBeIgnored']); | ||
expect(resultJson.filesToPush).to.have.members(['build/main.js', 'appsscript.json']); | ||
}); | ||
// https://github.com/google/clasp/issues/67 - This test currently fails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After each test, maybe add fs.removeSync('/tmp');
to clean up a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keep: false
here cleans up tmpdir after the tests finish: https://github.com/google/clasp/pull/167/files#diff-9c706fb89ddc3725ae3168d13b1298eaR113
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks for changing that.
LGTM, thanks @ajlai, great work on this PR! |
Adds a working test case for
clasp status
, a failing test case for #67 and implements #163npm run test
succeeds.npm run lint
succeeds.