-
-
Notifications
You must be signed in to change notification settings - Fork 15
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 an extraCliArgs
option to the emberNew
helper
#394
base: master
Are you sure you want to change the base?
Conversation
tests/acceptance/helpers-test.js
Outdated
return emberNew({ extraCliArgs: ['--typescript', '--no-welcome']}) | ||
.then(() => { | ||
const appPath = path.resolve(process.cwd(), 'app'); | ||
expect(fs.existsSync(appPath)).to.equal(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.
This doesn't really test the extra option, but I'm not sure how to test it either.
Testing the output of an actual existing cli options seems frail.
Should I try to use some sort of mocking / stubbing of the ember function to see if it's called with the extra arguments we pass?
I found https://github.com/theKashey/rewiremock, which might be useful for 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.
I tried using testdouble.js since we already depend on that, but I can't get it to work.. I just want to spy on the ember
function that's used inside emberNew
but it doesn't work as expected. I assume I'm doing something wrong here but I'm not sure if I want to keep spending time on this either..
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 got something to work but it's not the prettiest. testdouble doesn't make it easy to do what I want (by design) but I think it's the best option we have without installing new dependencies.
This makes it possible to pass any extra arguments to ember-cli, which makes it possible to test more blueprint scenarios.
7aad077
to
f4ff8d5
Compare
return emberNew({ extraCliArgs: ['--typescript', '--no-welcome'] }) | ||
.then(() => { | ||
// If we get here that means our testdouble matcher worked and things were called as expected. | ||
expect(true).to.be.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.
testdouble has a td.verify
feature, but using that here will also run the thenDo
callback again, which causes issues. There doesn't seem to be a way to simply check the times it was called and with which arguments.
I'm not sure we need the expect either, maybe it's good enough if the test doesn't throw an error?
This uses testdouble.js to spy on the `ember` call that is done by `emberNew`.
756c051
to
dccf643
Compare
This makes it possible to pass any extra arguments to ember-cli.
Closes #391 and unblocks emberjs/ember.js#20771