Static GitHub Issues

[1075] Attempting to integrate Jest with Nuxt.js

prev: Does Nuxt have plan to support npx?
next: How to get vue-route instance in plugins/axios

Hi @Atinux and @eddyerburgh,

This is the first attempt to integrate Jest with Nuxt.js . I ran into couple of error related to nuxt library which I don't understand. It would be nice to have a look at the sample codebase here https://github.com/piyushchauhan2011/nuxt-with-jest .

Pros:

  • Was able to test store and sample .js files
  • I was also able to unit-test components
  • Snapshot testing

screen shot 2017-07-12 at 7 34 08 pm

Broken:

  • End to end testing
    ERROR in ./.nuxt/client.js
    Module build failed: Error: Cannot find module '../../package' from 'node.js'
        at Resolver.resolveModule (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:179:17)
        at Resolver._getVirtualMockPath (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:296:23)
        at Resolver._getAbsolutPath (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:279:10)
        at Resolver.getModuleID (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-resolve/build/index.js:252:31)
        at Runtime._shouldMock (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-runtime/build/index.js:574:37)
        at Runtime.requireModuleOrMock (/Users/piyushchauhan/Documents/jirnexu/nuxt-with-jest/node_modules/jest-runtime/build/index.js:402:14)
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c936">#c936</a>)</em></sub></div>