From 5ee04ef522612e27d6fef02154bf23e45076ceee Mon Sep 17 00:00:00 2001 From: Sukanya Pandey Date: Thu, 19 Mar 2020 10:23:23 +0530 Subject: Add mocha and chai test framework - Mocha/Chai/Sinon test frameowrk because it has 100% feature parity with vue-loader. - Code for making 'expect' function accessible globally. Signed-off-by: Sukanya Pandey Change-Id: Idf809cb08d8c1ef177ff92f0ee1be04ac74059a3 --- tests/setup.js | 11 +++++++++++ tests/unit/example.spec.js | 12 ------------ 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 tests/setup.js delete mode 100644 tests/unit/example.spec.js (limited to 'tests') diff --git a/tests/setup.js b/tests/setup.js new file mode 100644 index 00000000..e3c220a2 --- /dev/null +++ b/tests/setup.js @@ -0,0 +1,11 @@ +var chai = require('chai'); +var sinonChai = require('sinon-chai'); + +chai.use(sinonChai); + +require('jsdom-global')('', { + url: 'http://localhost' +}); + +global.expect = require('chai').expect; +global.sinon = require('sinon'); diff --git a/tests/unit/example.spec.js b/tests/unit/example.spec.js deleted file mode 100644 index cb7abba3..00000000 --- a/tests/unit/example.spec.js +++ /dev/null @@ -1,12 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import HelloWorld from '@/components/HelloWorld.vue'; - -describe('HelloWorld.vue', () => { - it('renders props.msg when passed', () => { - const msg = 'new message'; - const wrapper = shallowMount(HelloWorld, { - propsData: { msg } - }); - expect(wrapper.text()).toMatch(msg); - }); -}); -- cgit v1.2.3