1.6.3 • Published 4 years ago

@nuxtjs/module-test-utils v1.6.3

Weekly downloads
939
License
MIT
Repository
github
Last release
4 years ago

@nuxtjs/module-test-utils

npm version npm downloads Circle CI Codecov License

Test utilities for modules Nuxt.js

📖 Release Notes

Setup

Add @nuxtjs/module-test-utils dependency to your project

yarn add --dev @nuxtjs/module-test-utils # or npm install --save-dev @nuxtjs/module-test-utils

Usage

You can test the settings by following the example below:

const { setupTest } = require('@nuxtjs/module-test-utils')

describe('module', () => {
  const ctx = setupTest({
    __dirname,
    fixture: 'example',
    config: {
      myModule: {
        test: 123
      }
    }
  })

  test('should inject plugin', () => {
    expect(ctx).toNuxtPluginAdded({
      src: expect.stringContaining('templates/plugin.js'),
      fileName: 'myPlugin.js',
      options: ctx.config.myModule
    })
  })
})

Test in browser

import { setupTest, createPage } from '@nuxtjs/module-test-utils'

describe('browser', () => {
  const ctx = setupTest({
    __dirname,
    browser: true,
    fixture: 'example'
  })

  test('should render page', async () => {
    const page = await createPage('/')
    const html = await page.getHtml()
    expect(html).toContain('Works!')
  })
})

License

MIT License

Copyright (c) - Nuxt Community

2.0.0-3

4 years ago

2.0.0-2

4 years ago

2.0.0-1

4 years ago

2.0.0-0

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.1

5 years ago