diff --git a/test/custom.pages.dir.js b/test/custom-dirs.test.js similarity index 78% rename from test/custom.pages.dir.js rename to test/custom-dirs.test.js index 00400c21fa..cd311a6f1b 100644 --- a/test/custom.pages.dir.js +++ b/test/custom-dirs.test.js @@ -8,7 +8,7 @@ let builder = null // Init nuxt.js and create server listening on localhost:4000 test.before('Init Nuxt.js', async t => { - const rootDir = resolve(__dirname, 'fixtures/custom-pages-dir') + const rootDir = resolve(__dirname, 'fixtures/custom-dirs') let config = require(resolve(rootDir, 'nuxt.config.js')) config.rootDir = rootDir config.dev = false @@ -24,11 +24,16 @@ test.before('Init Nuxt.js', async t => { t.true(logSpy.calledWithMatch('OPEN')) }) -test('/', async t => { +test('/ (custom pages directory)', async t => { const { html } = await nuxt.renderRoute('/') t.true(html.includes('

I have custom pages directory

')) }) +test('/ (custom assets directory)', async t => { + const { html } = await nuxt.renderRoute('/') + t.true(html.includes('.global-css-selector')) +}) + // Close server and ask nuxt to stop listening to file changes test.after.always('Closing server and nuxt.js', async t => { await nuxt.close() diff --git a/test/fixtures/custom-dirs/custom-assets/app.css b/test/fixtures/custom-dirs/custom-assets/app.css new file mode 100644 index 0000000000..f69fcd8bbc --- /dev/null +++ b/test/fixtures/custom-dirs/custom-assets/app.css @@ -0,0 +1,3 @@ +.global-css-selector { + color: red; +} diff --git a/test/fixtures/custom-pages-dir/custom-pages/index.vue b/test/fixtures/custom-dirs/custom-pages/index.vue similarity index 100% rename from test/fixtures/custom-pages-dir/custom-pages/index.vue rename to test/fixtures/custom-dirs/custom-pages/index.vue diff --git a/test/fixtures/custom-dirs/nuxt.config.js b/test/fixtures/custom-dirs/nuxt.config.js new file mode 100644 index 0000000000..2ca07b3cb5 --- /dev/null +++ b/test/fixtures/custom-dirs/nuxt.config.js @@ -0,0 +1,5 @@ +module.exports = { + assetsDir: 'custom-assets', + pagesDir: 'custom-pages', + css: [{ src: '~/custom-assets/app.css' }] +} diff --git a/test/fixtures/custom-pages-dir/package.json b/test/fixtures/custom-dirs/package.json similarity index 61% rename from test/fixtures/custom-pages-dir/package.json rename to test/fixtures/custom-dirs/package.json index de28318ece..d3db7bec4d 100644 --- a/test/fixtures/custom-pages-dir/package.json +++ b/test/fixtures/custom-dirs/package.json @@ -1,5 +1,5 @@ { - "name": "custom-pages-dir", + "name": "custom-dirs", "version": "1.0.0", "dependencies": {} } diff --git a/test/fixtures/custom-pages-dir/nuxt.config.js b/test/fixtures/custom-pages-dir/nuxt.config.js deleted file mode 100644 index 0cf6019e1d..0000000000 --- a/test/fixtures/custom-pages-dir/nuxt.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - pagesDir: 'custom-pages' -}