https://github.com/embermap/ember-cli-fastboot-testing/issues/60 give us the ability to pass custom visit options to fastboot.visit. Since it's using JSON.stringify to prepare the body for calling /_fastboot-testing, any function will be dropped during this process.
Example Use Case
This is very critical to our Ember Fastboot apps since we are using a number of heavily customized addons in our use case. In order to use this addon to test our SSR content, we need to have the way to pass functions in the options to fastboot.visit.
In this case, the actual option in fastboot.visit will be:
{
metadata: {}
}
Proposal
Although json is not designed to store any function in general, it's good to give users the ability to pass anything to fastboot. In the proposed changes below, we are using a simple helper library json-fn, to stringify and parse the options.
Feature Request
This is the follow up feature request for https://github.com/embermap/ember-cli-fastboot-testing/issues/60.
https://github.com/embermap/ember-cli-fastboot-testing/issues/60 give us the ability to pass custom visit options to
fastboot.visit
. Since it's usingJSON.stringify
to prepare the body for calling/_fastboot-testing
, any function will be dropped during this process.Example Use Case
This is very critical to our Ember Fastboot apps since we are using a number of heavily customized addons in our use case. In order to use this addon to test our SSR content, we need to have the way to pass functions in the options to
fastboot.visit
.Sample test file:
In this case, the actual option in
fastboot.visit
will be:Proposal
Although
json
is not designed to store any function in general, it's good to give users the ability to pass anything tofastboot
. In the proposed changes below, we are using a simple helper library json-fn, tostringify
andparse
the options.In
addon-test-support/index.js
:In
index.js
:Please let me know if that makes sense, I will have a PR for this soon 😄 . Thanks!