emit a basepath event on first run

This commit is contained in:
Rich Harris
2018-06-14 17:20:46 -04:00
parent 9c4a3592ff
commit 9eeeaa24c1
4 changed files with 35 additions and 3 deletions

View File

@@ -133,6 +133,7 @@ function run({ mode, basepath = '' }) {
let capture;
let base;
let captured_basepath;
const nightmare = new Nightmare();
@@ -179,7 +180,13 @@ function run({ mode, basepath = '' }) {
let handler;
proc.on('message', message => {
if (message.__sapper__) return;
if (message.__sapper__) {
if (message.event === 'basepath') {
captured_basepath = basepath;
}
return;
}
if (handler) handler(message);
});
@@ -597,6 +604,10 @@ function run({ mode, basepath = '' }) {
assert.ok(!hasProgressIndicator);
});
});
it('emits a basepath', () => {
assert.equal(captured_basepath, basepath);
});
});
describe('headers', () => {