From ba4a7c3e0b32b8455f05d06306d63f275338f618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 21 Dec 2016 19:27:36 +0100 Subject: [PATCH] More tests for build/index.js --- lib/build/index.js | 1 + package.json | 2 +- .../with-config/components/loading.vue | 36 +++++++++++++++++++ test/fixtures/with-config/layouts/app.vue | 5 +++ test/fixtures/with-config/layouts/error.vue | 3 ++ test/fixtures/with-config/nuxt.config.js | 4 ++- test/fixtures/with-config/plugins/test.js | 1 + 7 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/with-config/components/loading.vue create mode 100644 test/fixtures/with-config/layouts/app.vue create mode 100644 test/fixtures/with-config/layouts/error.vue create mode 100644 test/fixtures/with-config/plugins/test.js diff --git a/lib/build/index.js b/lib/build/index.js index 5d0d571c4d..c62ff33b6d 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -22,6 +22,7 @@ const reqSep = /\//g const sysSep = _.escapeRegExp(sep) const normalize = string => string.replace(reqSep, sysSep) const wp = function (p) { + /* istanbul ignore if */ if (/^win/.test(process.platform)) { p = p.replace(/\\/g, '\\\\') } diff --git a/package.json b/package.json index 16a747e1e1..ea85d6bd54 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "nuxt": "./bin/nuxt" }, "scripts": { - "test": "nyc ava --serial test/", + "test": "nyc ava test/", "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", "lint": "eslint --ext .js,.vue bin lib pages test/*.js --ignore-pattern lib/app", "build": "webpack", diff --git a/test/fixtures/with-config/components/loading.vue b/test/fixtures/with-config/components/loading.vue new file mode 100644 index 0000000000..9c28022726 --- /dev/null +++ b/test/fixtures/with-config/components/loading.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/test/fixtures/with-config/layouts/app.vue b/test/fixtures/with-config/layouts/app.vue new file mode 100644 index 0000000000..25fab4ce30 --- /dev/null +++ b/test/fixtures/with-config/layouts/app.vue @@ -0,0 +1,5 @@ + diff --git a/test/fixtures/with-config/layouts/error.vue b/test/fixtures/with-config/layouts/error.vue new file mode 100644 index 0000000000..7694d81b29 --- /dev/null +++ b/test/fixtures/with-config/layouts/error.vue @@ -0,0 +1,3 @@ + diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 426afb8d18..040ef75068 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -1,5 +1,7 @@ module.exports = { router: { base: '/test/' - } + }, + cache: true, + loading: '~components/loading' } diff --git a/test/fixtures/with-config/plugins/test.js b/test/fixtures/with-config/plugins/test.js new file mode 100644 index 0000000000..b538bacb75 --- /dev/null +++ b/test/fixtures/with-config/plugins/test.js @@ -0,0 +1 @@ +// Custom plugin