-
Notifications
You must be signed in to change notification settings - Fork 351
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
WIP: Add travis-ci support to this project #119
base: master
Are you sure you want to change the base?
Conversation
Currently failing with this:
and this
|
.travis.yml
Outdated
- mocha-phantomjs --version | ||
|
||
script: | ||
- yarn 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.
this should just be yarn run build
, then the test
script doesn't have to be modified. is that correct?
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.
and don't forget to add Mocha to devDependencies
in package.json
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 not sure what you mean by this:
this should just be
yarn run build
, then thetest
script doesn't have to be modified. is that correct?
Do you mean that this is travis's default behaviour so we could delete the script
part? Since there are other commands after this one, I think this is necessary.
and don't forget to add Mocha to
devDependencies
in package.json
definitely 👍
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 suggesting the following revisions
in travis.yml just run build
directly
script:
- - yarn run test
+ - yarn run build
- mocha-phantomjs ./test/test.html
- yarn run spec
in package.json restore the original test
script; there was really no reason to modify it
"scripts": {
- "test": "npm run build",
+ "test": "npm run build && open ./test/test.html",
"spec": "mocha -u tdd --reporter spec",
"build": "npm run minify",
"minify": "uglifyjs jquery.serialize-object.js -m -c --comments > dist/jquery.serialize-object.min.js"
},
...
"devDependencies": {
+ "mocha": "^5.0.1",
"uglify-js": "^2.4.16"
}
Does that make sense?
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.
In hindsight, the build
and minify
scripts cross concerns. It's a separate issue but should be patched as
- "build": "npm run minify",
+ "build": "npm run minify > dist/jquery.serialize-object.min.js",
- "minify": "uglifyjs jquery.serialize-object.js -m -c --comments > dist/jquery.serialize-object.min.js"
+ "minify": "uglifyjs jquery.serialize-object.js -m -c --comments"
If you want to sneak that in this PR, I'm cool with that
I applied suggested changes, It is still failing on the ci side with this:
As the file doesn't get generated anymore (it was created by the For the test part, maybe we can duplicate the
If test passes, we can also deploy artifacts when ran on master which would ease the release of new versions. For the mocha part, I may need some help and time. I'll have a look at this in the next weeks. |
I didn't go in too much details, but I managed to get the CI working on this project. I suppose this can be improved, but at least if it's there, someone else may improve the tests for this project 👍
Owner (@macek macek) needs to enable travis-ci project on travis-ci.org. Then, we can also add this to the readme:
See results here:
https://travis-ci.org/GabLeRoux/jquery-serialize-object
this still needs some more work, help would be appreciated.
Here's an example project with mocha running with phantom in travis:
https://github.com/jh3y/testPlayground
And a related blog post:
https://medium.com/caffeine-and-testing/getting-started-with-mocha-bfa20d403186
I don't have much time right now to continue working on this, but I think it's a good starting point.
🎉