Vue Box
Grabs your vue file, turns it into standing JS and gives you back the object to run your tests against
Please report any issues as soon as you can, I am one man and cannot test every need, or situation thank you! Please Feel free to leave suggestions on improvements/methods you'd want to see added. OR feel free to send a PR!
Changelog
You can find the changelog here: https://github.com/dhershman1/vue-box/blob/master/changelog.md
Params
options
:Object
- An object of options to help Vue Box
Options
const defaults = props: {} // Props used in any of your components vuePath: '/' // The path to the vue file your currently testing componentPath: '/' // the path to where your components live testName: 'default' // Name of the current test (optional) outputDir: 'tests' // Specify where you want the ouput dir to be external: // Array of external modules E.G underscore globals: {} // An object of globals E.G { underscore: '_' };
How It Works
So obviously Vue-Box
isn't using a browser environment the whole purpose of this is to give you a unit testing environment to run your javascript tests.
Well the cons to doing this is we don't exactly use Vue
itself since it would yell at us for not having a browser, what Vue-Box
is doing is eliminating the this scope from vue by applying your props
and data
values to your computed
, and method
objects. It even creates a fake event catcher for $emit
How To
Pass in a set of options to vueBox and go from there
For single vue files (not importing other vue components)
const vueBox = ;;
For a vue file that is importing other vue components
const vueBox = ;;
Checking Changes In Data
You can watch for changes in data based on the area you are in, methods will change data in the method scope for instance
// If we have a method like this inside our .vue file { thisdataValue = 'new value';} // While in our test file we will have something like:const vueBox = ;;