Skip to content

unit tests in single file (fixes #223) #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

paulpflug
Copy link

related: #241

adds the possibility to add unit tests to the vue file - to keep together what belongs together

  • moved source map test to use coffee-loader instead of babel-loader (fixes strange side effect in tests #246)
  • moved mocha tests to karma where possible to show of the new feature

missing: documentation - I'm willing to provide these if this gets accepted.

<script>
module.exports = {
  data () {
    return {
      msg: 'Hello from Component A!'
    }
  }
}
</script>
<script test>
// module is also bound to this, but this isn't supported by babel
var module = window.vueTestComp
describe("vue-loader", function () {
  it('basic', function () {
    expect(module.data().msg).to.contain('Hello from Component A!')
  })
})
</script>

@kazupon
Copy link
Member

kazupon commented Jan 17, 2017

Close (custom block with #499)

@kazupon kazupon closed this Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

strange side effect in tests
2 participants