diff --git a/package.json b/package.json index 9cad3ce00..8558c2992 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "dev": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=development webpack-dev-server --inline --progress --open --config webpack.docs.config.js ", "docs": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=production webpack --config=webpack.docs.config.js --progress --hide-modules", "build": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=production webpack --config=webpack.config.js --progress --hide-modules", - "watch-test": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=test BABEL_ENV=test ./node_modules/karma/bin/karma start test/unit/karma.config.js --delay", + "test:watch": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=test BABEL_ENV=test ./node_modules/karma/bin/karma start test/unit/karma.config.js --delay", "test": "node node_modules/cross-env/dist/bin/cross-env NODE_ENV=test BABEL_ENV=test ./node_modules/karma/bin/karma start test/unit/karma.config.js --single-run --delay" }, "repository": { diff --git a/test/unit/specs/plugin/behaviour-for-alert.spec.js b/test/unit/specs/plugin/behaviour-for-alert.spec.js index deacf07cb..65d66839c 100644 --- a/test/unit/specs/plugin/behaviour-for-alert.spec.js +++ b/test/unit/specs/plugin/behaviour-for-alert.spec.js @@ -4,43 +4,43 @@ import Vue from 'vue' import Promise from 'promise-polyfill' -import {assert, expect} from 'chai' +import { assert, expect } from 'chai' import * as HOOKS from '../../utilities/hooks' -import {nodeLength} from '../../utilities/helpers' +import { nodeLength } from '../../utilities/helpers' Vue.config.productionTip = false describe('Calling "alert()"', function () { - let dg + let dg - before(HOOKS.sanitizeAndPrepareWindow) - before(function (done) { - dg = window.vm.triggerAlert() - Vue.nextTick(done) // be sure done has updated before proceeding - }) + before(HOOKS.sanitizeAndPrepareWindow) + before(function (done) { + dg = window.vm.triggerAlert() + Vue.nextTick(done) // be sure done has updated before proceeding + }) - it('Should return a promise', function () { - expect(dg).to.be.instanceOf(Promise) - }) + it('Should return a promise', function () { + expect(dg).to.be.instanceOf(Promise) + }) - it('Should make the dialog visible', function () { - assert.strictEqual(nodeLength('.dg-container'), 1) - }) + it('Should make the dialog visible', function () { + assert.strictEqual(nodeLength('.dg-container'), 1) + }) - it('Should make the ok button visible', function () { - assert.strictEqual(nodeLength('.dg-btn--ok'), 1) - }) + it('Should make the ok button visible', function () { + assert.strictEqual(nodeLength('.dg-btn--ok'), 1) + }) - it('Should exclude the cancel button', function () { - assert.strictEqual(nodeLength('.dg-btn--cancel'), 0) - }) + it('Should exclude the cancel button', function () { + assert.strictEqual(nodeLength('.dg-btn--cancel'), 0) + }) }) describe('Clicking "ok" on #alert()', function () { - before(HOOKS.sanitizeAndPrepareWindow) + before(HOOKS.sanitizeAndPrepareWindow) - it('Should resolve the promise', function (done) { - window.vm.triggerAlert().then(() => {done()}) // expected - Vue.nextTick(() => window.vm.clickDialogBtn('ok')) - }) + it('Should resolve the promise', function (done) { + window.vm.triggerAlert().then(() => { done() }) // expected + Vue.nextTick(() => window.vm.clickDialogBtn('ok')) + }) }) diff --git a/test/unit/utilities/initializers.js b/test/unit/utilities/initializers.js index 1c3eed0f4..7879135ea 100644 --- a/test/unit/utilities/initializers.js +++ b/test/unit/utilities/initializers.js @@ -2,7 +2,7 @@ * Created by Emmy on 10/11/2017. */ -import Plugin from '../../../src/plugin/js/index' +import Plugin from '../../../src/plugin/js' import { clickNode } from '../../../src/plugin/js/utilities' import { getElem } from './helpers' import { createLocalVue } from '@vue/test-utils' diff --git a/webpack.test.config.js b/webpack.test.config.js index 9b7e6fe89..efae3d449 100644 --- a/webpack.test.config.js +++ b/webpack.test.config.js @@ -5,6 +5,15 @@ const baseConfig = require('./webpack.base.config') +baseConfig.module.rules = baseConfig.module.rules.map((rule) => { + if (rule.test.toString() === '/\\.vue$/') { + rule.options = rule.options || {} + rule.options.optimizeSSR = false + } + + return rule +}) + module.exports = Object.assign({}, baseConfig, { target: 'node', devtool: 'inline-cheap-module-source-map'