vue-test-loader

Extract custom test blocks from Vue components

  • 所有者: eddyerburgh/vue-test-loader
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

vue-test-loader

Extract custom test blocks into .spec files

Usage

Install the loader:

npm install --save-dev vue-test-loader

Setup vue-loader to pass the test block to the loader:

module.exports = {
  // The rest of the config
  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          loaders: {
            'test': 'vue-test-loader'
          },
        }
      }
    ]
  }
}

Write tests inside a custom block:

<template>
  <div />
</template>

<script>
export default {
  name: 'example-component'
}
</script>

<test>
import { shallow } from 'vue-test-utils'
import ExampleComponent from './ExampleComponent'

describe('ExampleComponent', () => {
    test('is div', () => {
      expect(shallow(ExampleComponent).is('div')).toBe(true)
    })
})
</test>

vue-test-loader will create a .spec.js file in a __tests__ directory inside the component directory.

This works best with Jest.

Options, Name, Description, Default, -------------, -------------, -----, extension, string of file extension, '.spec.js', ```

{
test: /.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'test': [{
loader: path.resolve(__dirname,'../index.js'),
options: {
extension: '.test.js'
}
}]
},
}
}


## Examples

You can see an example project using Jest [here](https://github.com/eddyerburgh/vue-test-loader-example)

主要指標

概覽
名稱與所有者eddyerburgh/vue-test-loader
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2017-11-07 18:30:41
推送於2018-03-05 19:40:53
最后一次提交2018-03-05 19:40:47
發布數4
最新版本名稱v0.4.1 (發布於 2018-03-05 19:37:18)
第一版名稱v0.2.0 (發布於 2017-11-07 18:34:19)
用户参与
星數132
關注者數3
派生數6
提交數24
已啟用問題?
問題數4
打開的問題數2
拉請求數1
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?