use nightmare for testing

This commit is contained in:
Rich Harris
2017-12-21 16:48:53 -05:00
committed by GitHub
parent 43a12a8331
commit 0bcb61650b
23 changed files with 1351 additions and 4461 deletions

View File

@@ -71,7 +71,8 @@ if (dev) {
route_manager.onchange(create_app);
const watcher = chokidar.watch(`templates/main.js`, {
ignoreInitial: true
ignoreInitial: true,
persistent: false
});
watcher.on('add', create_app);

View File

@@ -38,10 +38,6 @@ module.exports = function create_watcher() {
);
});
watcher = {
ready: invalidate()
};
function watch_compiler(type) {
const compiler = compilers[type];
@@ -55,7 +51,7 @@ module.exports = function create_watcher() {
deferreds[type].reject(err);
});
compiler.watch({}, (err, stats) => {
return compiler.watch({}, (err, stats) => {
if (stats.hasErrors()) {
deferreds[type].reject(stats.toJson().errors[0]);
} else {
@@ -64,8 +60,16 @@ module.exports = function create_watcher() {
});
}
watch_compiler('client');
watch_compiler('server');
watcher = {
ready: invalidate(),
client: watch_compiler('client'),
server: watch_compiler('server'),
close: () => {
watcher.client.close();
watcher.server.close();
}
};
return watcher;
};