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
Run full suite of tests, every time (most of the time) #246
Conversation
Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
With this, we probably would have noticed issues with Node 6/7 earlier. |
Signed-off-by: campionfellin <campionfellin@gmail.com>
Looks like manually rebuilding doesn't run them either. Related blog post: https://blog.algolia.com/travis-encrypted-variables-external-contributions/ |
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.
Looks good. Thanks!
- Can we add a
tests/README.md
:- Explaining/providing
- How the tests work
- What this
.clasprc.json.en
is - How to configure Travis (if necessary)
- Any links that are useful.
- Moving the bottom (line 327) comment to the README.
- Explaining/providing
We can move testing instructions from the main README to the tests/
README too.
This will help others
.clasprc.json.enc
Outdated
@@ -0,0 +1,2 @@ | |||
�t�@�NM����.|9%� �M�mc)eJ�&���,nv�9��N����7=b����C,P8�O��A��T�,SЇ ��f�4wk�gn�<��2�p9p��ץ�p�Y�d|K�Z(�xn�T(��"��g���={)3�(�y��O���S�� |
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.
Can we move this file to tests/
and update the relative path in the .travis.yaml
?
- This file is only used in our tests
- Let's try to reduce the number of top-level files/folders.
.travis.yml
Outdated
cache: | ||
directories: | ||
- "$HOME/.npm" | ||
before_install: | ||
- npm install -g npm@latest | ||
- openssl aes-256-cbc -K $encrypted_0f9bbf7a60f4_key -iv $encrypted_0f9bbf7a60f4_iv |
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.
Be sure to describe exactly what this command does in the README.
It looks very complicated.
.travis.yml
Outdated
- npm run lint | ||
- npm run test | ||
- npm run lint | ||
- 'if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then npm run test; fi' |
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.
Can we not change this?
This only runs Travis tests for PRs and not commits?
Assuming this is WIP given the |
Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
Signed-off-by: campionfellin <campionfellin@gmail.com>
Ok, I think this is now working as we want: First, see https://travis-ci.org/google/clasp/builds/398823862 If you dive into each job, it skips the tests that need authentication and ends with 11 passing and 17 pending. Now, see https://travis-ci.org/campionfellin/clasp/builds/398823851 If you look closely, it has 27 passing, 1 pending. It also fails builds on Node 6/7 as we expect. The logic for this is now:
For some reason, Note, this may cause some problems with Coveralls, as the PRs will have much lower coverage, and then it will jump back up on merging with master. |
README.md
Outdated
sudo npm run build; | ||
npm run test | ||
``` | ||
See `/tests/README.md` |
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.
Write a tl;dr for how to run tests.
I'd keep:
sudo npm run build;
npm run test
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 don't see this in the tests README.
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.
It's under the Configuration Locally
header.
README.md
Outdated
@@ -345,12 +345,7 @@ clasp <command> | |||
|
|||
#### Run Tests (experimental) |
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.
Can we graduate the tests from experimental?
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.
👍
@@ -0,0 +1,63 @@ | |||
# Tests | |||
|
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.
Add a sentence here to describe what the testing situation is for clasp
. Something like:
Many of clasp
's CLI commands have unit tests that run the clasp
command and asserts the std output and std error code is as expected.
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.
👍
tests/README.md
Outdated
# Tests | ||
|
||
These tests should ideally be run for every Pull Request, though due to the need to run `clasp login` before some commands, some tests are not run. | ||
|
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.
No 2 \n's
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.
👍
tests/README.md
Outdated
|
||
# Configuration using Travis | ||
|
||
This is a bit more difficult, and why we include the `.clasprc.json.enc` file. The `.clasprc.json` file is used to authenticate many of the `clasp` commands, and is what is generated after using `clasp login`. |
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.
Add an intro sentence as to what Travis is and how clasp
uses it.
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.
👍
tests/README.md
Outdated
|
||
Change test files to use a flag that runs certain tests (what we're currently running) on PRs, and runs all tests on master. | ||
|
||
# Configuration Locally |
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.
## Local Configuration
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.
👍
tests/README.md
Outdated
Change test files to use a flag that runs certain tests (what we're currently running) on PRs, and runs all tests on master. | ||
|
||
# Configuration Locally | ||
|
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.
Add a short sentence to what this section describes.
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.
👍
tests/README.md
Outdated
# Configuration Locally | ||
|
||
1. Make sure you are logged in (`clasp login`). | ||
1. In `/tests/test.ts` change `describe.skip(...)` to `describe(...)` for relevant tests. |
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 don't see skip
ped test suites anymore. Can you remove this line?
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.
👍
tests/README.md
Outdated
|
||
1. Make sure you are logged in (`clasp login`). | ||
1. In `/tests/test.ts` change `describe.skip(...)` to `describe(...)` for relevant tests. | ||
* **Note: (All tests are relevant).** |
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.
Remove this.
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.
👍
@@ -28,7 +29,12 @@ describe('Test help for each function', () => { | |||
}); | |||
}); | |||
|
|||
describe.skip('Test clasp list function', () => { | |||
describe('Test clasp list function', () => { | |||
before(function() { |
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.
Can you extract this to a function?
function skipIfPR() {
if (!Boolean(isPR)) return this.skip();
}
before(skipIfPR);
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.
Not quite sure this will work, Typescript is not a fan:
[ts] 'this' implicitly has type 'any' because it does not have a type annotation.
I'm not sure the best way to pass this
through that makes it work.
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.
Also, isPR
is never a boolean, it's either an int
like this PR is 246
or it is "false"
(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.
OK, we can follow up in a different change.
Looking good. |
Signed-off-by: campionfellin <campionfellin@gmail.com>
Ok, I believe I addressed most of the comments and have made the instructions more concise. |
@grant This build looks like it's failing, likely because the keys to decrypt are on my Travis account, rather than yours/ https://docs.travis-ci.com/user/encrypting-files/#Automated-Encryption Essentially:
|
I installed |
Sorry for all the troubles 😔, I'll go ahead and add those steps |
No worries, https://stackoverflow.com/a/34989655 was the solution. |
Fixes longstanding testing issues
See https://travis-ci.org/campionfellin/clasp/jobs/397869625 for example
npm run test
succeeds.npm run lint
succeeds.