Conversation
|
A couple of questions:
|
rwjblue
left a comment
There was a problem hiding this comment.
should the options passed to middlewares be transformed, be a subset? For example only pass {hasBuild: true} if original options contain path?
No, I don't think so. As mentioned in another comment the serverMiddleware hook already receives the unfettered options so this seems fine to me.
not sure what test would be appropriate, check addonMiddlewares receives options in tests/unit/tasks/test-test.js?
If possible, I'd setup a test that actually adds an addon that uses testemMiddleware and assert that it receives the options.
| addons.push(function () { | ||
| return addon.testemMiddleware.apply(addon, [].slice.call(arguments).concat([options])); | ||
| }); |
There was a problem hiding this comment.
I think this will work on all of our supported Node versions:
| addons.push(function () { | |
| return addon.testemMiddleware.apply(addon, [].slice.call(arguments).concat([options])); | |
| }); | |
| addons.push(function () { | |
| return addon.testemMiddleware(...arguments, options); | |
| }); |
There was a problem hiding this comment.
👍 have updated as suggested
5972bba to
880a89a
Compare
@rwjblue have added the suggested test. It configures a dummy test launcher for the test, so full stack is run, apart from the test apps tests. |
Useful if the middleware is expensive and should be optionally started depending on ember-cli options. For example `ember serve` and `ember test` use a `path` flag to specify an existing ember build to use, without rebuilding. `ember-cli-typescript` will add typechecking middleware regardless of ember using an existing build, the typechecking middleware is not required. This can slow down the initial request to express server significantly. Passing the ember options to middleware will allow middleware to optionally enable different features depending on options
880a89a to
bcd3346
Compare
|
I've updated the target of this PR and rebased against the |
Useful if the middleware is expensive and should be optionally started
depending on ember-cli options.
For example
ember serveandember testuse apathflag to specifyan existing ember build to use, without rebuilding.
ember-cli-typescriptwill add typechecking middleware regardless of ember using an existing
build, the typechecking middleware is not required. This can slow
down the initial request to express server significantly. Passing the
ember options to middleware will allow middleware to optionally enable
different features depending on options
See
ember-cli-typescriptmaking use of this here typed-ember/ember-cli-typescript#1148