mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
63 lines
1.4 KiB
JavaScript
Executable File
63 lines
1.4 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
process.env.NODE_ENV = 'test'
|
|
|
|
const { resolve } = require('path')
|
|
const { cpus } = require('os')
|
|
|
|
const spawnAsync = require('@expo/spawn-async')
|
|
const Listr = require('listr')
|
|
|
|
const fixtures = [
|
|
'children',
|
|
'custom-dirs',
|
|
'debug',
|
|
'deprecate',
|
|
'dynamic-routes',
|
|
'empty',
|
|
'error',
|
|
'module',
|
|
'ssr',
|
|
'with-config',
|
|
|
|
// csr,
|
|
// dev,
|
|
// generate,
|
|
// fail generate,
|
|
// fallback generate,
|
|
// ssr,
|
|
// ssr csp,
|
|
// spa
|
|
'basic'
|
|
]
|
|
|
|
const nuxtBuild = resolve(__dirname, '../bin/nuxt-build')
|
|
|
|
function buildFixture(name) {
|
|
const rootDir = resolve(__dirname, '../test/fixtures', name)
|
|
return spawnAsync('node', [nuxtBuild, rootDir])
|
|
}
|
|
|
|
const tasks = []
|
|
for (let fixture of fixtures) {
|
|
tasks.push({
|
|
title: 'Building fixtures ' + fixture,
|
|
task: (ctx, task) => buildFixture(fixture)
|
|
.then(() => {
|
|
task.title = task.title.replace(/^Building/, 'Built') + ' Successfully'
|
|
})
|
|
})
|
|
}
|
|
|
|
const options = {
|
|
renderer: process.env.CI === true ? 'silent' : 'default',
|
|
nonTTYRenderer: 'silent',
|
|
concurrent: Math.min(4, cpus().length)
|
|
}
|
|
new Listr([{
|
|
title: `Build ${fixtures.length} fixtures with concurrency of ${options.concurrent}`,
|
|
task: () => new Listr(tasks, {concurrent: options.concurrent})
|
|
}], options)
|
|
.run()
|
|
.catch(console.error) // eslint-disable-line no-console
|
|
.then(() => process.exit(0))
|