Nuxt/test/fixtures/missing-pages-dir/missing-pages-dir.test.js
Felipe Lübe de Bragança 232bc0196f feat: missing pages directory warning (#4054)
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (a non-breaking change which fixes an issue)
- [x] New feature (a non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)


## Description
Resolves #3920 by adding a warning during the build process and a small disclaimer into the default page component.


## Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly. (PR: #)
- [x] I have added tests to cover my changes (if not applicable, please state why)
- [x] All new and existing tests are passing.
2018-10-05 13:37:55 +01:00

18 lines
550 B
JavaScript

import consola from 'consola'
import { buildFixture } from '../../utils/build'
describe('missing-pages-dir', () => {
buildFixture('missing-pages-dir', (builder) => {
const options = builder.nuxt.options
expect(consola.warn).toHaveBeenCalledTimes(1)
expect(consola.warn.mock.calls).toMatchObject([
[{
message: `No \`${options.dir.pages}\` directory found in ${options.srcDir}.`,
additional: 'Using the default built-in page.\n',
additionalStyle: 'yellowBright',
badge: true
}]
])
})
})