carbon-design-system / carbon-components-vue

Vue implementation of the Carbon Design System
http://vue.carbondesignsystem.com
Apache License 2.0
609 stars 179 forks source link

Introduce tests to the library - branch add-tests #63

Closed lee-chase closed 5 years ago

lee-chase commented 5 years ago

The library does not currently run any tests during compilation, introduce a testing system to the library.

NOTE: It is not expected that tests for the whole library are added. Testing as part of the build for one component and documentation as to how tests are added to components.

SEE: React and Angular test implemenations for possible patterns to follow.

lee-chase commented 5 years ago

A test Vue CLI project would indicate Jest with Vue-test-utils is the way to go.

This would give us a very similar setup to carbon-components-react and may allow us to copy some tests.

I believe it's also well worth using snapshot verification, as also demonstrated in https://github.com/vuejs/vue-test-utils-jest-example

lee-chase commented 5 years ago

See https://github.com/carbon-design-system/carbon-components-vue/tree/add-tests

Where it could be me, my machine or something fundamentally wrong with how tests have been added.

NOTE: Adding Jest unit tests through the Vue CLI usually installs babel-core@.0.0-bridge.0 but this seems to kill the storybook build which uses @babel/core.

Must be able to run yarn tasks; storybook-build, storybook, build and test:unit in order to merge into master.

lee-chase commented 5 years ago

The current problem when running the test. image

lee-chase commented 5 years ago

It would appear that downgrading to v10 of node (the current version) fixes this issue.

Credit to @sabov for spotting this