mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix: build fixtures show logs and exit process when error occurred
This commit is contained in:
parent
992f18afab
commit
b70ff8710f
@ -518,9 +518,13 @@ export default class Builder {
|
||||
} else {
|
||||
// --- Production Build ---
|
||||
compiler.run((err, stats) => {
|
||||
/* istanbul ignore if */
|
||||
/* istanbul ignore next */
|
||||
if (err) {
|
||||
console.error(err) // eslint-disable-line no-console
|
||||
return reject(err)
|
||||
} else if (stats.hasErrors()) {
|
||||
if (this.options.test) {
|
||||
err = stats.toString({ colors: true })
|
||||
}
|
||||
return reject(err)
|
||||
}
|
||||
resolve()
|
||||
|
@ -21,8 +21,10 @@ export const printError = function () {
|
||||
}
|
||||
|
||||
export const fatalError = function () {
|
||||
/* eslint-disable no-console */
|
||||
console.error(renderError(...arguments))
|
||||
if (arguments[0]) {
|
||||
/* eslint-disable no-console */
|
||||
console.error(renderError(...arguments))
|
||||
}
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,6 @@
|
||||
"webpack-node-externals": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@expo/spawn-async": "^1.3.0",
|
||||
"babel-eslint": "^8.2.1",
|
||||
"codecov": "^3.0.0",
|
||||
"eslint": "^4.19.1",
|
||||
@ -135,6 +134,7 @@
|
||||
"eslint-plugin-react": "^7.6.1",
|
||||
"eslint-plugin-standard": "^3.0.1",
|
||||
"eslint-plugin-vue": "^4.4.0",
|
||||
"execa": "^0.10.0",
|
||||
"express": "^4.16.2",
|
||||
"finalhandler": "^1.1.1",
|
||||
"get-port": "^3.2.0",
|
||||
|
@ -4,7 +4,7 @@ process.env.NODE_ENV = 'test'
|
||||
const { resolve } = require('path')
|
||||
const { cpus } = require('os')
|
||||
|
||||
const spawnAsync = require('@expo/spawn-async')
|
||||
const execa = require('execa')
|
||||
const Listr = require('listr')
|
||||
const isCI = require('is-ci')
|
||||
|
||||
@ -35,7 +35,7 @@ const nuxtBuild = resolve(__dirname, '../bin/nuxt-build')
|
||||
|
||||
function buildFixture(name) {
|
||||
const rootDir = resolve(__dirname, '../test/fixtures', name)
|
||||
return spawnAsync('node', [nuxtBuild, rootDir])
|
||||
return execa(nuxtBuild, [rootDir])
|
||||
}
|
||||
|
||||
const tasks = []
|
||||
@ -61,6 +61,6 @@ new Listr([{
|
||||
.run()
|
||||
.then(() => process.exit(0))
|
||||
.catch((err) => {
|
||||
console.error(err) // eslint-disable-line no-console
|
||||
console.error(err.stderr) // eslint-disable-line no-console
|
||||
process.exit(1)
|
||||
})
|
||||
|
34
yarn.lock
34
yarn.lock
@ -78,12 +78,6 @@
|
||||
lodash "^4.2.0"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@expo/spawn-async@^1.3.0":
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@expo/spawn-async/-/spawn-async-1.3.0.tgz#01b8a4f6bba10b792663f9272df66c7e90166dad"
|
||||
dependencies:
|
||||
cross-spawn "^5.1.0"
|
||||
|
||||
"@nuxtjs/friendly-errors-webpack-plugin@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@nuxtjs/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-2.0.2.tgz#80fd4c4276e87c09a9157a6f433724235eaaaf6e"
|
||||
@ -1848,6 +1842,16 @@ cross-spawn@^5.0.1, cross-spawn@^5.1.0:
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
cross-spawn@^6.0.0:
|
||||
version "6.0.5"
|
||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
|
||||
dependencies:
|
||||
nice-try "^1.0.4"
|
||||
path-key "^2.0.1"
|
||||
semver "^5.5.0"
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
cryptiles@2.x.x:
|
||||
version "2.0.5"
|
||||
resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8"
|
||||
@ -2649,6 +2653,18 @@ exec-sh@^0.2.0:
|
||||
dependencies:
|
||||
merge "^1.1.3"
|
||||
|
||||
execa@^0.10.0:
|
||||
version "0.10.0"
|
||||
resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50"
|
||||
dependencies:
|
||||
cross-spawn "^6.0.0"
|
||||
get-stream "^3.0.0"
|
||||
is-stream "^1.1.0"
|
||||
npm-run-path "^2.0.0"
|
||||
p-finally "^1.0.0"
|
||||
signal-exit "^3.0.0"
|
||||
strip-eof "^1.0.0"
|
||||
|
||||
execa@^0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
|
||||
@ -4836,6 +4852,10 @@ neo-async@^2.5.0:
|
||||
version "2.5.0"
|
||||
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.0.tgz#76b1c823130cca26acfbaccc8fbaf0a2fa33b18f"
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4"
|
||||
|
||||
no-case@^2.2.0:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
|
||||
@ -5255,7 +5275,7 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
|
||||
|
||||
path-key@^2.0.0:
|
||||
path-key@^2.0.0, path-key@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user