I get the following error when running tests in a brand new project using the Ava test framework:
✖ No tests found in test/specs/Logo.spec.js
1 uncaught exception
Uncaught exception in test/specs/Logo.spec.js
/usr/src/nuxt-app/node_modules/@vue/component-compiler-utils/node_modules/prettier/index.js:1957
TypeError: Super expression must either be null or a function
_inherits (node_modules/@vue/component-compiler-utils/node_modules/prettier/index.js:1957:11)
node_modules/@vue/component-compiler-utils/node_modules/prettier/index.js:40358:5
node_modules/@vue/component-compiler-utils/node_modules/prettier/index.js:40378:4
createCommonjsModule (node_modules/@vue/component-compiler-utils/node_modules/prettier/index.js:193:35)
Object.<anonymous> (node_modules/@vue/component-compiler-utils/node_modules/prettier/index.js:40350:18)
compile (node_modules/require-extension-hooks/src/hook.js:75:10)
hook (node_modules/require-extension-hooks/src/hook.js:32:3)
actuallyCompile (node_modules/@vue/component-compiler-utils/dist/compileTemplate.js:97:24)
compileTemplate (node_modules/@vue/component-compiler-utils/dist/compileTemplate.js:28:16)
getCompiledTemplate (node_modules/require-extension-hooks-vue/src/index.js:123:20)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c ava
Directory: /usr/src/nuxt-app
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/usr/src/nuxt-app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Steps
/usr/src # yarn create nuxt-app nuxt-app
yarn create v1.5.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@vue/cli > @vue/cli-ui > [email protected]" has unmet peer dependency "graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0".
warning "@vue/cli > @vue/cli-ui > [email protected]" has unmet peer dependency "graphql@>=0.8.0".
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-nuxt-app
> Generating Nuxt.js project in /usr/src/nuxt-app
? Project name nuxt-app
? Project description My wicked Nuxt.js project
? Use a custom server framework none
? Choose features to install Linter / Formatter, Prettier, Axios
? Use a custom UI framework bootstrap
? Use a custom test framework ava
? Choose rendering mode Universal
? Author name jason
? Choose a package manager yarn
/usr/src # cd nuxt-app/
/usr/src/nuxt-app # yarn test
It seems to be related to the importing of the Logo component into the test/spec/Logo.spec.js file.
If I replace the generated code in that file with something like the following it runs fine:
// import { mount } from '@vue/test-utils'
import test from 'ava'
// import Logo from '../../components/Logo.vue'
test('is a Vue instance', t => {
// const wrapper = mount(Logo)
// t.is(wrapper.isVueInstance(), true)
t.pass()
})
Has anyone else experienced this?
me else. should open issues in prettier or ava ?
i added the follow line at the end of test/helpers/setup.js, and it works fine.
window.Date = global.Date = Date;
i added the follow line at the end of
test/helpers/setup.js, and it works fine.window.Date = global.Date = Date;
Thanks, dude! This was driving me crazy :)
Spent almost 2 hours before I arrived here.
Should be fixed with #226
Resolved via #283
Most helpful comment
i added the follow line at the end of
test/helpers/setup.js, and it works fine.