-
Notifications
You must be signed in to change notification settings - Fork 344
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
Remove all flow adapters, use flow in all tests #108
Conversation
3fc4899
to
d8d180d
Compare
@rpl could you review? It's mostly refactoring so sorry for the noise. For some reason I don't see a link to coveralls in the PR checks, not sure why though. I see the coveralls command in the build output. |
}); | ||
it('shows help', (done) => { | ||
let webExt = path.join(path.resolve(__dirname), '..', 'bin', 'web-ext'); | ||
shell.exec(`${webExt} --help`, {silent: true}, |
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 tempted to kill this test because it's slow and sometimes causes a timeout on Travis. It seems useful though because it will cover a catastrophic error in the bin/web-ext
file and maybe also program.main()
(although that has some coverage).
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.
If we don't need its contribute on the testing code coverage, how about opt to test it outside of the mocha tests, as a shell command?
e.g. by adding to .travis.yml
something like:
script: COVERAGE=y npm test && (cd ..; $TRAVIS_BUILD_DIR/bin/web-ext --help | grep -G "Usage: .*web-ext")
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.
oh yeah! I like that idea
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 moved it to npm test
which runs during CI. The check will not be run in npm run develop
which makes the test loop a lot faster.
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.
@kumar303 +1 that's even better
e9122dc
to
940e7bd
Compare
return new Promise((resolve, reject) => { | ||
|
||
if (!this._zip) { | ||
throw new Error( |
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.
Currently when this error is thrown (it shouldn't, but if it happens) the test case which use this helpers (tests/test-cmd/test-build.js) fails to detect the error and it fails for timeout reasons instead of showing the error throwed in the failure logs.
I propose to tweak the test case into something like the following diff:
diff --git a/tests/test-cmd/test.build.js b/tests/test-cmd/test.build.js
index ef19418..d5eff39 100644
--- a/tests/test-cmd/test.build.js
+++ b/tests/test-cmd/test.build.js
@@ -28,21 +28,27 @@ describe('build', () => {
/minimal_extension-1\.0\.xpi$/);
return buildResult.extensionPath;
})
.then((extensionPath) => zipFile.open(extensionPath))
.then(() => {
var fileNames = [];
- return new Promise((resolve) => {
+ return new Promise((resolve, reject) => {
zipFile.readEach((entry) => {
fileNames.push(entry.fileName);
})
.then(() => {
resolve(fileNames);
+ })
+ .catch((error) => {
+ reject(error);
});
});
})
.then((fileNames) => {
assert.deepEqual(fileNames, ['manifest.json']);
})
+ .catch((error) => {
+ assert.ifError(error);
+ })
);
});
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.
Thanks for catching that
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.
(fixed)
@kumar303 this PR looks good I just added a couple of notes/ideas above, about catching a potential failure in the build test cases and a proposal for moving the intermittent test case out of mocha. NOTE: I noticed that this PR doesn't have coveralls in the runned PR checks, I wonder why. |
I can't figure out why either. Other more recent pull requests have coverage and I've even rebased this one a couple times. Maybe it is triggering a silent failure in coveralls? |
64e95fe
to
c5fba3d
Compare
This was mainly because some errors were not reported when it was run as a shell command in .travis.yml.
c5fba3d
to
f70cd6e
Compare
0dc1fae
to
021c677
Compare
Well, huh. I can't see why coverage isn't getting published. I'm just going to merge it anyway because I can see coverage being reported on newer pull requests (even one that's based off of this branch). Thanks for the review! |
Remove all flow adapters, use flow in all tests
Fixes #87
Specifically:
bin/web-ext
smoke test tonpm test
so it doesn't slow downnpm run develop
errors.js