diff --git a/package.json b/package.json index d268a2977..10ed906fe 100644 --- a/package.json +++ b/package.json @@ -19,13 +19,14 @@ "lint:fix": "npm run lint -- --fix", "prepublish": "npm run build && npm run test:unit:only", "publish": "lerna publish --conventional-commits -m \"chore(release): publish %s\"", - "test": "npm run lint && npm run lint:docs && npm run flow && npm run test:types && npm run test:unit && npm run test:unit:karma npm run test:unit:node", + "test": "npm run lint && npm run lint:docs && npm run flow && npm run test:types && npm run test:unit && npm run test:unit:karma && npm run test:unit:node", "test:compat": "scripts/test-compat.sh", "test:unit": "npm run build:test && npm run test:unit:only", "test:unit:only": "mocha-webpack --webpack-config test/setup/webpack.test.config.js test/specs --recursive --require test/setup/mocha.setup.js", "test:unit:debug": "npm run build:test && node --inspect-brk node_modules/.bin/mocha-webpack --webpack-config test/setup/webpack.test.config.js test/specs --recursive --require test/setup/mocha.setup.js", - "test:unit:karma": "npm run build:test TARGET=browser karma start test/setup/karma.conf.js --single-run", + "test:unit:karma": "npm run build:test && TARGET=browser karma start test/setup/karma.conf.js --single-run", "test:unit:node": "npm run build:test && npm run test:unit:node:only", + "test:unit:node:only": "TEST_ENV=node mocha-webpack --webpack-config test/setup/webpack.test.config.js test/specs --recursive --require test/setup/mocha.setup.js", "test:types": "tsc -p packages/test-utils/types && tsc -p packages/server-test-utils/types" }, "devDependencies": { @@ -54,6 +55,7 @@ "karma": "^1.7.0", "karma-chrome-launcher": "^2.2.0", "karma-mocha": "^1.3.0", + "karma-phantomjs-launcher": "^1.0.4", "karma-sinon-chai": "^1.3.1", "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "^0.0.31", diff --git a/packages/test-utils/src/mount.js b/packages/test-utils/src/mount.js index f4bf6edb0..b1891195f 100644 --- a/packages/test-utils/src/mount.js +++ b/packages/test-utils/src/mount.js @@ -29,11 +29,10 @@ export default function mount (component: Component, options: Options = {}): Vue } else { vm.$mount() } + const componentsWithError = findAllVueComponentsFromVm(vm).filter(c => c._error) - const componentWithError = findAllVueComponentsFromVm(vm).find(c => c._error) - - if (componentWithError) { - throw (componentWithError._error) + if (componentsWithError.length > 0) { + throw (componentsWithError[0]._error) } const wrapperOptions = { diff --git a/test/resources/utils.js b/test/resources/utils.js index 87ae7b78d..58e062eb1 100644 --- a/test/resources/utils.js +++ b/test/resources/utils.js @@ -11,6 +11,11 @@ export const isRunningJSDOM = navigator.userAgent.includes && navigator.userAgent.includes('jsdom') +export const isRunningPhantomJS = + typeof navigator !== 'undefined' && + navigator.userAgent.includes && + navigator.userAgent.match(/PhantomJS/i) + export function injectSupported () { return vueVersion > 2.2 } diff --git a/test/setup/karma.conf.js b/test/setup/karma.conf.js index 17a9c0e7f..418ce8c06 100644 --- a/test/setup/karma.conf.js +++ b/test/setup/karma.conf.js @@ -2,7 +2,7 @@ const webpackConfig = require('./webpack.test.config.js') module.exports = function (config) { config.set({ - browsers: ['ChromeHeadless'], + browsers: ['PhantomJS', 'ChromeHeadless'], frameworks: ['mocha', 'sinon-chai'], reporters: ['spec'], files: [ diff --git a/test/specs/mounting-options/attrs.spec.js b/test/specs/mounting-options/attrs.spec.js index 300ce0bf5..b9982c3ff 100644 --- a/test/specs/mounting-options/attrs.spec.js +++ b/test/specs/mounting-options/attrs.spec.js @@ -2,11 +2,13 @@ import { compileToFunctions } from 'vue-template-compiler' import { attrsSupported } from '~resources/utils' import { describeWithMountingMethods, - itSkipIf + itSkipIf, + isRunningPhantomJS } from '~resources/utils' describeWithMountingMethods('options.attrs', (mountingMethod) => { - itSkipIf(mountingMethod.name === 'renderToString', + itSkipIf( + mountingMethod.name === 'renderToString' || isRunningPhantomJS, 'handles inherit attrs', () => { if (!attrsSupported()) return const wrapper = mountingMethod(compileToFunctions('

'), { diff --git a/test/specs/mounting-options/listeners.spec.js b/test/specs/mounting-options/listeners.spec.js index c5f1a4896..0f3364851 100644 --- a/test/specs/mounting-options/listeners.spec.js +++ b/test/specs/mounting-options/listeners.spec.js @@ -1,20 +1,25 @@ import { compileToFunctions } from 'vue-template-compiler' import { listenersSupported } from '~resources/utils' -import { describeWithShallowAndMount } from '~resources/utils' +import { + describeWithShallowAndMount, + itSkipIf, + isRunningPhantomJS +} from '~resources/utils' describeWithShallowAndMount('options.listeners', (mountingMethod) => { - it('handles inherit listeners', () => { - if (!listenersSupported()) return - const aListener = () => {} - const wrapper = mountingMethod(compileToFunctions('

'), { - listeners: { - aListener - } - }) + itSkipIf(isRunningPhantomJS, + 'handles inherit listeners', () => { + if (!listenersSupported()) return + const aListener = () => {} + const wrapper = mountingMethod(compileToFunctions('

'), { + listeners: { + aListener + } + }) - expect(wrapper.vm.$listeners.aListener).to.equal(aListener) - expect(wrapper.vm.$listeners.aListener).to.equal(aListener) - }) + expect(wrapper.vm.$listeners.aListener).to.equal(aListener) + expect(wrapper.vm.$listeners.aListener).to.equal(aListener) + }) it('defines listeners as empty object even when not passed', () => { const wrapper = mountingMethod(compileToFunctions('

')) diff --git a/test/specs/mounting-options/localVue.spec.js b/test/specs/mounting-options/localVue.spec.js index 4a1fcf8b9..bfce95116 100644 --- a/test/specs/mounting-options/localVue.spec.js +++ b/test/specs/mounting-options/localVue.spec.js @@ -1,27 +1,33 @@ import Vue from 'vue' -import { describeWithMountingMethods } from '~resources/utils' +import { + describeWithMountingMethods, + itSkipIf, + isRunningPhantomJS +} from '~resources/utils' describeWithMountingMethods('options.localVue', (mountingMethod) => { - it('mounts component using passed localVue as base Vue', () => { - const TestComponent = { - template: ` + itSkipIf( + isRunningPhantomJS, + 'mounts component using passed localVue as base Vue', () => { + const TestComponent = { + template: `

{{test}}
` - } - const localVue = Vue.extend() - localVue.version = '2.3' - const wrapper = mountingMethod(TestComponent, { - localVue: localVue, - mocks: { test: 'some value' } + } + const localVue = Vue.extend() + localVue.version = '2.3' + const wrapper = mountingMethod(TestComponent, { + localVue: localVue, + mocks: { test: 'some value' } + }) + const HTML = mountingMethod.name === 'renderToString' + ? wrapper + : wrapper.html() + expect(HTML).to.contain('some value') + const freshWrapper = mountingMethod(TestComponent) + const freshHTML = mountingMethod.name === 'renderToString' + ? freshWrapper + : freshWrapper.html() + expect(freshHTML).to.not.contain('some value') }) - const HTML = mountingMethod.name === 'renderToString' - ? wrapper - : wrapper.html() - expect(HTML).to.contain('some value') - const freshWrapper = mountingMethod(TestComponent) - const freshHTML = mountingMethod.name === 'renderToString' - ? freshWrapper - : freshWrapper.html() - expect(freshHTML).to.not.contain('some value') - }) }) diff --git a/test/specs/mounting-options/scopedSlots.spec.js b/test/specs/mounting-options/scopedSlots.spec.js index de808feae..846a1724e 100644 --- a/test/specs/mounting-options/scopedSlots.spec.js +++ b/test/specs/mounting-options/scopedSlots.spec.js @@ -1,4 +1,9 @@ -import { describeWithShallowAndMount, vueVersion, itDoNotRunIf } from '~resources/utils' +import { + describeWithShallowAndMount, + vueVersion, + itDoNotRunIf, + isRunningPhantomJS +} from '~resources/utils' import ComponentWithScopedSlots from '~resources/components/component-with-scoped-slots.vue' describeWithShallowAndMount('scopedSlots', (mountingMethod) => { @@ -14,7 +19,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => { } }) - itDoNotRunIf(vueVersion < 2.5, + itDoNotRunIf(vueVersion < 2.5 || isRunningPhantomJS, 'mounts component scoped slots', () => { const wrapper = mountingMethod(ComponentWithScopedSlots, { slots: { default: '123' }, @@ -41,7 +46,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => { } ) - itDoNotRunIf(vueVersion < 2.5, + itDoNotRunIf(vueVersion < 2.5 || isRunningPhantomJS, 'throws exception when it is seted to a template tag at top', () => { const fn = () => { mountingMethod(ComponentWithScopedSlots, { @@ -55,7 +60,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => { } ) - itDoNotRunIf(vueVersion >= 2.5, + itDoNotRunIf(vueVersion >= 2.5 || isRunningPhantomJS, 'throws exception when vue version < 2.5', () => { const fn = () => { mountingMethod(ComponentWithScopedSlots, { diff --git a/test/specs/mounting-options/slots.spec.js b/test/specs/mounting-options/slots.spec.js index ce87e3ff3..9b4803395 100644 --- a/test/specs/mounting-options/slots.spec.js +++ b/test/specs/mounting-options/slots.spec.js @@ -6,7 +6,8 @@ import { describeWithMountingMethods, vueVersion, itSkipIf, - itDoNotRunIf + itDoNotRunIf, + isRunningPhantomJS } from '~resources/utils' describeWithMountingMethods('options.slots', (mountingMethod) => { @@ -53,7 +54,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node', + process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with default slot if passed string in slot object', () => { const wrapper = mountingMethod(ComponentWithSlots, { slots: { default: '' }}) if (mountingMethod.name === 'renderToString') { @@ -64,7 +65,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node' || vueVersion < 2.3, + process.env.TEST_ENV === 'node' || vueVersion < 2.3 || isRunningPhantomJS, 'works correctly with class component', () => { const wrapper = mountingMethod(ComponentAsAClass, { slots: { default: '' }}) if (mountingMethod.name === 'renderToString') { @@ -91,26 +92,28 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { expect(fn).to.throw().with.property('message', message) }) - it('mounts component with default slot if passed string in slot object', () => { - if (mountingMethod.name === 'renderToString') { - return - } - const wrapper1 = mountingMethod(ComponentWithSlots, { slots: { default: 'foo123{{ foo }}' }}) - expect(wrapper1.find('main').html()).to.equal('
foo123bar
') - const wrapper2 = mountingMethod(ComponentWithSlots, { slots: { default: '

1

{{ foo }}2' }}) - expect(wrapper2.find('main').html()).to.equal('

1

bar2
') - const wrapper3 = mountingMethod(ComponentWithSlots, { slots: { default: '

1

{{ foo }}

2

' }}) - expect(wrapper3.find('main').html()).to.equal('

1

bar

2

') - const wrapper4 = mountingMethod(ComponentWithSlots, { slots: { default: '123' }}) - expect(wrapper4.find('main').html()).to.equal('
123
') - const wrapper5 = mountingMethod(ComponentWithSlots, { slots: { default: '1{{ foo }}2' }}) - expect(wrapper5.find('main').html()).to.equal('
1bar2
') - wrapper5.trigger('keydown') - const wrapper6 = mountingMethod(ComponentWithSlots, { slots: { default: '

1

2

' }}) - expect(wrapper6.find('main').html()).to.equal('

1

2

') - const wrapper7 = mountingMethod(ComponentWithSlots, { slots: { default: '1

2

3' }}) - expect(wrapper7.find('main').html()).to.equal('
1

2

3
') - }) + itDoNotRunIf( + isRunningPhantomJS, + 'mounts component with default slot if passed string in slot object', () => { + if (mountingMethod.name === 'renderToString') { + return + } + const wrapper1 = mountingMethod(ComponentWithSlots, { slots: { default: 'foo123{{ foo }}' }}) + expect(wrapper1.find('main').html()).to.equal('
foo123bar
') + const wrapper2 = mountingMethod(ComponentWithSlots, { slots: { default: '

1

{{ foo }}2' }}) + expect(wrapper2.find('main').html()).to.equal('

1

bar2
') + const wrapper3 = mountingMethod(ComponentWithSlots, { slots: { default: '

1

{{ foo }}

2

' }}) + expect(wrapper3.find('main').html()).to.equal('

1

bar

2

') + const wrapper4 = mountingMethod(ComponentWithSlots, { slots: { default: '123' }}) + expect(wrapper4.find('main').html()).to.equal('
123
') + const wrapper5 = mountingMethod(ComponentWithSlots, { slots: { default: '1{{ foo }}2' }}) + expect(wrapper5.find('main').html()).to.equal('
1bar2
') + wrapper5.trigger('keydown') + const wrapper6 = mountingMethod(ComponentWithSlots, { slots: { default: '

1

2

' }}) + expect(wrapper6.find('main').html()).to.equal('

1

2

') + const wrapper7 = mountingMethod(ComponentWithSlots, { slots: { default: '1

2

3' }}) + expect(wrapper7.find('main').html()).to.equal('
1

2

3
') + }) itSkipIf(mountingMethod.name === 'renderToString', 'throws error if passed string in default slot object and vue-template-compiler is undefined', () => { @@ -130,7 +133,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node', + process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with default slot if passed string in slot array object', () => { const wrapper = mountingMethod(ComponentWithSlots, { slots: { default: [''] }}) if (mountingMethod.name === 'renderToString') { @@ -141,7 +144,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node', + process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with default slot if passed string in slot text array object', () => { const wrapper = mountingMethod(ComponentWithSlots, { slots: { default: ['{{ foo }}1', 'bar'] }}) if (mountingMethod.name === 'renderToString') { @@ -241,7 +244,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { } }) - itDoNotRunIf(process.env.TEST_ENV === 'node', + itDoNotRunIf(process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with default slot if passed string in slot object', () => { const TestComponent = { name: 'component-with-slots', @@ -257,7 +260,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node', + process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with named slot if passed string in slot object', () => { const TestComponent = { functional: true, @@ -272,7 +275,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node', + process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with named slot if passed string in slot object in array', () => { const TestComponent = { functional: true, @@ -287,7 +290,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node', + process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with named slot if passed string in slot object in array', () => { const TestComponent = { functional: true, @@ -302,7 +305,7 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { }) itDoNotRunIf( - process.env.TEST_ENV === 'node', + process.env.TEST_ENV === 'node' || isRunningPhantomJS, 'mounts component with named slot if passed string in slot object in array', () => { const TestComponent = { functional: true, @@ -382,8 +385,9 @@ describeWithMountingMethods('options.slots', (mountingMethod) => { require.cache[require.resolve('vue-template-compiler')].exports.compileToFunctions = compilerSave }) - itDoNotRunIf(mountingMethod.name === 'renderToString', - 'afd', () => { + itDoNotRunIf( + mountingMethod.name === 'renderToString' || isRunningPhantomJS, + 'does not error when triggering a click in a slot', () => { const Parent = { name: 'Parent', template: ` diff --git a/test/specs/wrapper/contains.spec.js b/test/specs/wrapper/contains.spec.js index d76574616..9d292e1be 100644 --- a/test/specs/wrapper/contains.spec.js +++ b/test/specs/wrapper/contains.spec.js @@ -5,7 +5,9 @@ import FunctionalComponent from '~resources/components/functional-component.vue' import ComponentAsAClass from '~resources/components/component-as-a-class.vue' import { functionalSFCsSupported, - describeWithShallowAndMount + describeWithShallowAndMount, + isRunningPhantomJS, + itSkipIf } from '~resources/utils' import ComponentWithoutName from '~resources/components/component-without-name.vue' @@ -40,20 +42,22 @@ describeWithShallowAndMount('contains', (mountingMethod) => { expect(wrapper.contains(FunctionalComponent)).to.equal(true) }) - it('returns true if wrapper contains Vue class component', () => { - const TestComponent = { - template: ` + itSkipIf( + isRunningPhantomJS, + 'returns true if wrapper contains Vue class component', () => { + const TestComponent = { + template: `
`, - components: { - ComponentAsAClass + components: { + ComponentAsAClass + } } - } - const wrapper = mountingMethod(TestComponent) - expect(wrapper.contains(ComponentAsAClass)).to.equal(true) - }) + const wrapper = mountingMethod(TestComponent) + expect(wrapper.contains(ComponentAsAClass)).to.equal(true) + }) it('returns true if wrapper contains element specified by ref selector', () => { const compiled = compileToFunctions('
') diff --git a/test/specs/wrapper/find.spec.js b/test/specs/wrapper/find.spec.js index 891596366..c4685d58e 100644 --- a/test/specs/wrapper/find.spec.js +++ b/test/specs/wrapper/find.spec.js @@ -10,7 +10,10 @@ import ComponentAsAClass from '~resources/components/component-as-a-class.vue' import { functionalSFCsSupported, vueVersion, - describeWithShallowAndMount + describeWithShallowAndMount, + isRunningPhantomJS, + itDoNotRunIf, + itSkipIf } from '~resources/utils' describeWithShallowAndMount('find', (mountingMethod) => { @@ -32,14 +35,16 @@ describeWithShallowAndMount('find', (mountingMethod) => { expect(wrapper.find('div').vnode).to.be.an('object') }) - it('returns an array of Wrapper of elements matching class selector passed if they are declared inside a slot', () => { - const wrapper = mountingMethod(ComponentWithSlots, { - slots: { - default: '
' - } + itDoNotRunIf( + isRunningPhantomJS, + 'returns an array of Wrapper of elements matching class selector passed if they are declared inside a slot', () => { + const wrapper = mountingMethod(ComponentWithSlots, { + slots: { + default: '
' + } + }) + expect(wrapper.find('.foo').vnode).to.be.an('object') }) - expect(wrapper.find('.foo').vnode).to.be.an('object') - }) it('returns Wrapper matching class selector passed if they are declared inside a functional component', () => { const Component = { @@ -108,21 +113,23 @@ describeWithShallowAndMount('find', (mountingMethod) => { expect(wrapper.find(Component).vnode).to.be.an('object') }) - it('returns Wrapper of class component', () => { - const TestComponent = { - template: ` + itSkipIf( + isRunningPhantomJS, + 'returns Wrapper of class component', () => { + const TestComponent = { + template: `
`, - components: { - ComponentAsAClass + components: { + ComponentAsAClass + } } - } - const wrapper = mountingMethod(TestComponent) - expect(wrapper.find(ComponentAsAClass).vnode).to.be.an('object') - }) + const wrapper = mountingMethod(TestComponent) + expect(wrapper.find(ComponentAsAClass).vnode).to.be.an('object') + }) it('returns Wrapper of Vue Component matching functional component', () => { if (!functionalSFCsSupported()) { diff --git a/test/specs/wrapper/findAll.spec.js b/test/specs/wrapper/findAll.spec.js index 9b452740b..78584cdc4 100644 --- a/test/specs/wrapper/findAll.spec.js +++ b/test/specs/wrapper/findAll.spec.js @@ -8,7 +8,10 @@ import FunctionalComponent from '~resources/components/functional-component.vue' import ComponentAsAClass from '~resources/components/component-as-a-class.vue' import { functionalSFCsSupported, - describeWithShallowAndMount + describeWithShallowAndMount, + itDoNotRunIf, + itSkipIf, + isRunningPhantomJS } from '~resources/utils' describeWithShallowAndMount('findAll', (mountingMethod) => { @@ -33,15 +36,17 @@ describeWithShallowAndMount('findAll', (mountingMethod) => { expect(divArr.length).to.equal(1) }) - it('returns an array of Wrapper of elements matching class selector passed if they are declared inside a slot', () => { - const wrapper = mountingMethod(ComponentWithSlots, { - slots: { - default: '
' - } + itDoNotRunIf( + isRunningPhantomJS, + 'returns an array of Wrapper of elements matching class selector passed if they are declared inside a slot', () => { + const wrapper = mountingMethod(ComponentWithSlots, { + slots: { + default: '
' + } + }) + const fooArr = wrapper.findAll('.foo') + expect(fooArr.length).to.equal(2) }) - const fooArr = wrapper.findAll('.foo') - expect(fooArr.length).to.equal(2) - }) it('returns an array of Wrapper of elements matching class selector passed if they are declared inside a functional component', () => { const Component = { @@ -194,21 +199,23 @@ describeWithShallowAndMount('findAll', (mountingMethod) => { expect(wrapper.findAll(ComponentWithoutName).length).to.equal(3) }) - it('returns Wrapper of class component', () => { - const TestComponent = { - template: ` + itSkipIf( + isRunningPhantomJS, + 'returns Wrapper of class component', () => { + const TestComponent = { + template: `
`, - components: { - ComponentAsAClass + components: { + ComponentAsAClass + } } - } - const wrapper = mountingMethod(TestComponent) - expect(wrapper.findAll(ComponentAsAClass).length).to.equal(1) - }) + const wrapper = mountingMethod(TestComponent) + expect(wrapper.findAll(ComponentAsAClass).length).to.equal(1) + }) it('returns Wrapper of Vue Component matching functional component', () => { if (!functionalSFCsSupported()) { diff --git a/test/specs/wrapper/isEmpty.spec.js b/test/specs/wrapper/isEmpty.spec.js index 69c9b838f..3216456b4 100644 --- a/test/specs/wrapper/isEmpty.spec.js +++ b/test/specs/wrapper/isEmpty.spec.js @@ -1,5 +1,9 @@ import { compileToFunctions } from 'vue-template-compiler' -import { describeWithShallowAndMount } from '~resources/utils' +import { + describeWithShallowAndMount, + itSkipIf, + isRunningPhantomJS +} from '~resources/utils' describeWithShallowAndMount('isEmpty', (mountingMethod) => { it('returns true if node is empty', () => { @@ -15,19 +19,21 @@ describeWithShallowAndMount('isEmpty', (mountingMethod) => { expect(wrapper.isEmpty()).to.equal(true) }) - it('returns true if innerHTML is empty', () => { - const TestComponent = { - render (createElement) { - return createElement('div', { - domProps: { - innerHTML: '' - } - }) + itSkipIf( + isRunningPhantomJS, + 'returns true if innerHTML is empty', () => { + const TestComponent = { + render (createElement) { + return createElement('div', { + domProps: { + innerHTML: '' + } + }) + } } - } - const wrapper = mountingMethod(TestComponent) - expect(wrapper.find('svg').isEmpty()).to.equal(true) - }) + const wrapper = mountingMethod(TestComponent) + expect(wrapper.find('svg').isEmpty()).to.equal(true) + }) it.skip('returns false if innerHTML is not empty', () => { const TestComponent = { diff --git a/yarn.lock b/yarn.lock index ee46f584c..5d9e55d3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1745,7 +1745,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.10, concat-stream@^1.5.0, concat-stream@^1.5.2, concat-stream@^1.6.0: +concat-stream@1.6.0, concat-stream@^1.4.10, concat-stream@^1.5.0, concat-stream@^1.5.2, concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -3024,6 +3024,15 @@ extglob@^0.3.1: dependencies: is-extglob "^1.0.0" +extract-zip@^1.6.5: + version "1.6.6" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c" + dependencies: + concat-stream "1.6.0" + debug "2.6.9" + mkdirp "0.5.0" + yauzl "2.4.1" + extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -3048,6 +3057,12 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" +fd-slicer@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.0.1.tgz#8b5bcbd9ec327c5041bf9ab023fd6750f1177e65" + dependencies: + pend "~1.2.0" + figures@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" @@ -3211,6 +3226,14 @@ fs-extra@3.0.1: jsonfile "^3.0.0" universalify "^0.1.0" +fs-extra@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950" + dependencies: + graceful-fs "^4.1.2" + jsonfile "^2.1.0" + klaw "^1.0.0" + fs-extra@^4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94" @@ -3554,7 +3577,7 @@ got@^6.7.1: unzip-response "^2.0.1" url-parse-lax "^1.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@~4.1.11, graceful-fs@~4.1.6: +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@~4.1.11, graceful-fs@~4.1.6: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -3673,6 +3696,13 @@ hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.0" +hasha@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/hasha/-/hasha-2.2.0.tgz#78d7cbfc1e6d66303fe79837365984517b2f6ee1" + dependencies: + is-stream "^1.0.1" + pinkie-promise "^2.0.0" + hawk@3.1.3, hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" @@ -4144,7 +4174,7 @@ is-retry-allowed@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" -is-stream@^1.0.0, is-stream@^1.1.0: +is-stream@^1.0.0, is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -4321,6 +4351,12 @@ json5@^0.5.0, json5@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" +jsonfile@^2.1.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" + optionalDependencies: + graceful-fs "^4.1.6" + jsonfile@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.1.tgz#a5ecc6f65f53f662c4415c7675a0331d0992ec66" @@ -4367,6 +4403,13 @@ karma-mocha@^1.3.0: dependencies: minimist "1.2.0" +karma-phantomjs-launcher@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.4.tgz#d23ca34801bda9863ad318e3bb4bd4062b13acd2" + dependencies: + lodash "^4.0.1" + phantomjs-prebuilt "^2.1.7" + karma-sinon-chai@^1.3.1: version "1.3.3" resolved "https://registry.yarnpkg.com/karma-sinon-chai/-/karma-sinon-chai-1.3.3.tgz#a597e5b4a1369fe7b3d7d76c09ed2061a38e747f" @@ -4427,6 +4470,10 @@ karma@^1.7.0: tmp "0.0.31" useragent "^2.1.12" +kew@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b" + kind-of@^3.0.2: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" @@ -4439,6 +4486,12 @@ kind-of@^4.0.0: dependencies: is-buffer "^1.1.5" +klaw@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" + optionalDependencies: + graceful-fs "^4.1.9" + latest-version@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" @@ -4709,6 +4762,10 @@ lodash@^3.8.0: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" +lodash@^4.0.1: + version "4.17.10" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" + lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.5.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" @@ -4976,6 +5033,12 @@ mississippi@^2.0.0: stream-each "^1.1.0" through2 "^2.0.0" +mkdirp@0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" + dependencies: + minimist "0.0.8" + mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -5845,6 +5908,10 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" +pend@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" @@ -5853,6 +5920,20 @@ performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" +phantomjs-prebuilt@^2.1.7: + version "2.1.16" + resolved "https://registry.yarnpkg.com/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.16.tgz#efd212a4a3966d3647684ea8ba788549be2aefef" + dependencies: + es6-promise "^4.0.3" + extract-zip "^1.6.5" + fs-extra "^1.0.0" + hasha "^2.2.0" + kew "^0.7.0" + progress "^1.1.8" + request "^2.81.0" + request-progress "^2.0.1" + which "^1.2.10" + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -6701,6 +6782,12 @@ replace-ext@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" +request-progress@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/request-progress/-/request-progress-2.0.1.tgz#5d36bb57961c673aa5b788dbc8141fdf23b44e08" + dependencies: + throttleit "^1.0.0" + request-promise-core@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.1.tgz#3eee00b2c5aa83239cfb04c5700da36f81cd08b6" @@ -6769,6 +6856,33 @@ request@2.81.0, request@~2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" +request@^2.81.0: + version "2.85.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa" + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.6.0" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.1" + forever-agent "~0.6.1" + form-data "~2.3.1" + har-validator "~5.0.3" + hawk "~6.0.2" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.17" + oauth-sign "~0.8.2" + performance-now "^2.1.0" + qs "~6.5.1" + safe-buffer "^5.1.1" + stringstream "~0.0.5" + tough-cookie "~2.3.3" + tunnel-agent "^0.6.0" + uuid "^3.1.0" + request@~2.74.0: version "2.74.0" resolved "https://registry.yarnpkg.com/request/-/request-2.74.0.tgz#7693ca768bbb0ea5c8ce08c084a45efa05b892ab" @@ -7532,6 +7646,10 @@ text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" +throttleit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.0.tgz#9e785836daf46743145a5984b6268d828528ac6c" + through2@^2.0.0, through2@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" @@ -8100,7 +8218,7 @@ which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which@1, which@^1.2.1, which@^1.2.12, which@^1.2.9: +which@1, which@^1.2.1, which@^1.2.10, which@^1.2.12, which@^1.2.9: version "1.3.0" resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" dependencies: @@ -8323,6 +8441,12 @@ yargs@~3.10.0: decamelize "^1.0.0" window-size "0.1.0" +yauzl@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.4.1.tgz#9528f442dab1b2284e58b4379bb194e22e0c4005" + dependencies: + fd-slicer "~1.0.1" + yeast@0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"