mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-11 19:04:30 +00:00
implement --launcher
This commit is contained in:
7
test/app/start.js
Normal file
7
test/app/start.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// generated by sapper build at 2018-05-04T03:03:00.914Z
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
||||
process.env.SAPPER_DEST = require('path').resolve(__dirname, 'build');
|
||||
process.env.PORT = process.env.PORT || 3000;
|
||||
|
||||
console.log('Starting server on port ' + process.env.PORT);
|
||||
require('./build/server.js');
|
||||
@@ -1,3 +1,4 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const assert = require('assert');
|
||||
const Nightmare = require('nightmare');
|
||||
@@ -38,6 +39,7 @@ describe('sapper', function() {
|
||||
rimraf.sync('export');
|
||||
rimraf.sync('build');
|
||||
rimraf.sync('.sapper');
|
||||
rimraf.sync('start.js');
|
||||
|
||||
this.timeout(process.env.CI ? 30000 : 10000);
|
||||
|
||||
@@ -148,7 +150,7 @@ function run({ mode, basepath = '' }) {
|
||||
|
||||
before(() => {
|
||||
const promise = mode === 'production'
|
||||
? exec(`node ${cli} build`).then(() => ports.find(3000))
|
||||
? exec(`node ${cli} build -l`).then(() => ports.find(3000))
|
||||
: ports.find(3000).then(port => {
|
||||
exec(`node ${cli} dev`);
|
||||
return ports.wait(port).then(() => port);
|
||||
@@ -160,6 +162,10 @@ function run({ mode, basepath = '' }) {
|
||||
|
||||
const dir = mode === 'production' ? 'build' : '.sapper';
|
||||
|
||||
if (mode === 'production') {
|
||||
assert.ok(fs.existsSync('start.js'));
|
||||
}
|
||||
|
||||
proc = require('child_process').fork(`${dir}/server.js`, {
|
||||
cwd: process.cwd(),
|
||||
env: {
|
||||
|
||||
Reference in New Issue
Block a user