Skip to content

Commit

Permalink
refactor: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyerburgh committed Sep 2, 2017
1 parent b3d6a03 commit d6a0c3b
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 57 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
40 changes: 19 additions & 21 deletions jest-vue.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const vueCompiler = require('vue-template-compiler')
const babel = require('babel-core')
const vueNextCompiler = require('vue-template-es2015-compiler')
var assign = require('object-assign')
var sourceMap = require('source-map')
const sourceMap = require('source-map')
const path = require('path')
const compileTemplate = require('./template-compiler')
var convert = require('convert-source-map')
const splitRE = /\r?\n/g;
const convert = require('convert-source-map')

const splitRE = /\r?\n/g

function generateSourceMap (script, output, filePath, content, inputMap) {
var hashedFilename = path.basename(filePath)
Expand Down Expand Up @@ -66,29 +65,28 @@ module.exports = {
plugins: ['transform-runtime']
})

const script = result.code;
const template = parts.template;
const script = result.code

const inputMap = result.map;
const map = generateSourceMap(script, '', path, src, inputMap);
const inputMap = result.map
const map = generateSourceMap(script, '', path, src, inputMap)
let output = ';(function(){\n' + script + '\n})()\n' +
'if (module.exports.__esModule) module.exports = module.exports.default\n' +
'var __vue__options__ = (typeof module.exports === "function"' +
'? module.exports.options' +
': module.exports)\n';
var beforeLines
if (map) {
beforeLines = output.split(splitRE).length
}
output += '__vue__options__.render = ' + renderFunctions.render + '\n' +
': module.exports)\n'
var beforeLines
if (map) {
beforeLines = output.split(splitRE).length
}
output += '__vue__options__.render = ' + renderFunctions.render + '\n' +
'__vue__options__.staticRenderFns = ' + renderFunctions.staticRenderFns + '\n'
if (map) {
addTemplateMapping(script, parts, output, map, beforeLines)
}
if (map) {
addTemplateMapping(script, parts, output, map, beforeLines)
}

if (map) {
output += '\n' + convert.fromJSON(map.toString()).toComment()
}
if (map) {
output += '\n' + convert.fromJSON(map.toString()).toComment()
}

return {
code: output,
Expand Down
36 changes: 18 additions & 18 deletions test/HelloJs.spec.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Vue from 'vue';
import HelloComponent from './resources/Hello.vue';
import Vue from 'vue'
import HelloComponent from './resources/Hello.vue'

describe('Test suite for HelloComponent', () => {
it('Test data msg', () => {
const ClonedComponent = Vue.extend(HelloComponent);
const NewComponent = new ClonedComponent({
data() {
return {
msg: 'I am a cool message',
};
},
}).$mount();
expect(HelloComponent.data().msg).toBe('Welcome to Your Vue.js App');
expect(NewComponent.msg).toBe('I am a cool message');
expect(NewComponent.headingClasses).toBeDefined();
NewComponent.toggleClass();
expect(NewComponent.isCrazy).toBeTruthy();
});
});
it('Test data msg', () => {
const ClonedComponent = Vue.extend(HelloComponent)
const NewComponent = new ClonedComponent({
data () {
return {
msg: 'I am a cool message'
}
}
}).$mount()
expect(HelloComponent.data().msg).toBe('Welcome to Your Vue.js App')
expect(NewComponent.msg).toBe('I am a cool message')
expect(NewComponent.headingClasses).toBeDefined()
NewComponent.toggleClass()
expect(NewComponent.isCrazy).toBeTruthy()
})
})
36 changes: 18 additions & 18 deletions test/HelloVue.spec.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Vue from 'vue';
import HelloComponent from './resources/Hello.vue';
import Vue from 'vue'
import HelloComponent from './resources/Hello.vue'

describe('Test suite for HelloComponent', () => {
it('Test data msg', () => {
const ClonedComponent = Vue.extend(HelloComponent);
const NewComponent = new ClonedComponent({
data() {
return {
msg: 'I am a cool message',
};
},
}).$mount();
expect(HelloComponent.data().msg).toBe('Welcome to Your Vue.js App');
expect(NewComponent.msg).toBe('I am a cool message');
expect(NewComponent.headingClasses).toBeDefined();
NewComponent.toggleClass();
expect(NewComponent.isCrazy).toBeTruthy();
});
});
it('Test data msg', () => {
const ClonedComponent = Vue.extend(HelloComponent)
const NewComponent = new ClonedComponent({
data () {
return {
msg: 'I am a cool message'
}
}
}).$mount()
expect(HelloComponent.data().msg).toBe('Welcome to Your Vue.js App')
expect(NewComponent.msg).toBe('I am a cool message')
expect(NewComponent.headingClasses).toBeDefined()
NewComponent.toggleClass()
expect(NewComponent.isCrazy).toBeTruthy()
})
})

0 comments on commit d6a0c3b

Please sign in to comment.