Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/vue-jest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.0
Choose a base ref
...
head repository: vuejs/vue-jest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.4.0
Choose a head ref
  • 3 commits
  • 9 files changed
  • 1 contributor

Commits on Sep 3, 2017

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d5dcb6b View commit details
  2. docs: update CHANGELOG

    eddyerburgh committed Sep 3, 2017
    Copy the full SHA
    c910e6f View commit details
  3. release: 0.4.0

    eddyerburgh committed Sep 3, 2017
    Copy the full SHA
    411b6cb View commit details
Showing with 25 additions and 7 deletions.
  1. +8 −0 CHANGELOG.md
  2. +2 −1 lib/compilers/babel-compiler.js
  3. +2 −1 lib/compilers/coffee-compiler.js
  4. +2 −1 lib/compilers/jade-compiler.js
  5. +2 −1 lib/compilers/pug-compiler.js
  6. +3 −1 lib/ensure-require.js
  7. +2 −1 lib/template-compiler.js
  8. +3 −0 lib/throw-error.js
  9. +1 −1 package.json
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<a name="0.4.0"></a>
# [0.4.0](https://github.com/eddyerburgh/vue-jest/compare/v0.3.0...v0.4.0) (2017-09-03)


### Features

* **errors:** throw errors with standard format ([d5dcb6b](https://github.com/eddyerburgh/vue-jest/commit/d5dcb6b))

<a name="0.3.0"></a>
# [0.3.0](https://github.com/eddyerburgh/vue-jest/compare/v0.2.0...v0.3.0) (2017-09-03)

3 changes: 2 additions & 1 deletion lib/compilers/babel-compiler.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const babel = require('babel-core')
const path = require('path')
const fs = require('fs')
const throwError = require('../throw-error')

var defaultBabelOptions = {
presets: ['es2015'],
@@ -12,7 +13,7 @@ function getBabelRc (path) {
try {
rc = JSON.parse(fs.readFileSync(path, 'utf-8'))
} catch (e) {
throw new Error('[vue-jest] Your .babelrc seems to be incorrectly formatted.')
throwError('[Your .babelrc seems to be incorrectly formatted.')
}
return rc
}
3 changes: 2 additions & 1 deletion lib/compilers/coffee-compiler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var ensureRequire = require('../ensure-require.js')
const throwError = require('../throw-error')

module.exports = function (raw, cb, compiler) {
ensureRequire('coffee', ['coffee-script'])
@@ -10,7 +11,7 @@ module.exports = function (raw, cb, compiler) {
sourceMap: true
})
} catch (err) {
throw new Error(err)
throwError(err)
}
return {
code: compiled.js,
3 changes: 2 additions & 1 deletion lib/compilers/jade-compiler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var ensureRequire = require('../ensure-require.js')
const throwError = require('../throw-error')

module.exports = function (raw) {
var html;
@@ -7,7 +8,7 @@ module.exports = function (raw) {
try {
var html = jade.compile(raw)()
} catch (err) {
throw Error(err)
throwError(err)
}
return html
}
3 changes: 2 additions & 1 deletion lib/compilers/pug-compiler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var ensureRequire = require('../ensure-require.js')
const throwError = require('../throw-error')

module.exports = function (raw) {
var html;
@@ -7,7 +8,7 @@ module.exports = function (raw) {
try {
var html = jade.compile(raw)()
} catch (err) {
throw Error(err)
throwError(err)
}
return html
}
4 changes: 3 additions & 1 deletion lib/ensure-require.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const throwError = require('./throw-error')

module.exports = function (name, deps) {
var i, len
var missing = []
@@ -33,6 +35,6 @@ module.exports = function (name, deps) {
message += missing[0] + ' is '
}
message += 'missing.\n\nTo install run:\n' + npmInstall
throw new Error(message)
throwError(message)
}
}
3 changes: 2 additions & 1 deletion lib/template-compiler.js
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ var vueCompiler = require('vue-template-compiler')
var transpile = require('vue-template-es2015-compiler')
var compilePug = require('./compilers/pug-compiler')
var compileJade = require('./compilers/jade-compiler')
const throwError = require('./throw-error')

function getTemplateContent(templatePart) {
if(templatePart.lang === 'pug') {
@@ -22,7 +23,7 @@ module.exports = function compileTemplate (templatePart, compiler) {
compiled.errors.forEach(function (msg) {
console.error('\n' + chalk.red(msg) + '\n')
})
throw new Error('Vue template compilation failed')
throwError('Vue template compilation failed')
} else {
return {
render: toFunction(compiled.render),
3 changes: 3 additions & 0 deletions lib/throw-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function error (msg){
throw new Error('\n[jest-vue] Error: ' + (msg) + '\n')
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jest-vue",
"version": "0.3.0",
"version": "0.4.0",
"description": "Jest Vue transform",
"main": "jest-vue.js",
"keywords": [