Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!fs.existsSync(filePath) || !fs.statSync(filePath).isFile()) {
// N.B., `baseURL` will end with a slash as it went through `cleanBaseURL`
let newURL = `${baseURL}tests/index.html`;
logger.info(
'url: %s resolved to path: %s which is not a file. Assuming %s instead',
req.path,
filePath,
newURL
);
req.url = newURL;
}
}
});
promiseFinally(promiseFinally(Promise.resolve(results), next), () => {
if (config.finally) {
config.finally();
}
});
});
}
_quit() {
logger.debug('quitStart');
this.emit('quitStart');
this._quittingPromise = promiseFinally(
promiseFinally(Promise.resolve().then(() => this.watcherAdapter.quit()), () => {
// Wait for current build, and ignore build failure
return Promise.resolve(this.currentBuild).catch(() => {});
}),
() => {
logger.debug('quitEnd');
this.emit('quitEnd');
}
);
return this._quittingPromise;
}
};
promise = promise.then(() => {
let needsEndNode = false;
// We use a nested .then/.catch so that the .catch can only catch errors
// from this node, but not from previous nodes.
return promiseFinally(
Promise.resolve()
.then(() => this._cancelationRequest.throwIfRequested())
.then(() => {
this.emit('beginNode', nw);
needsEndNode = true;
})
.then(() => nw.build()),
() => {
if (needsEndNode) {
this.emit('endNode', nw);
}
}
)
.then(() => this._cancelationRequest.throwIfRequested())
.catch(err => {
if (Cancelation.isCancelationError(err)) {
it('ember build generates instrumentation files when viz is enabled', co.wrap(function *() {
process.env.BROCCOLI_VIZ = '1';
yield promiseFinally(runCommand(path.join('.', 'node_modules', 'ember-cli', 'bin', 'ember'), 'build', {
env: {
BROCCOLI_VIZ: '1',
},
}), () => delete process.env.BROCCOLI_VIZ);
[
'instrumentation.build.0.json',
'instrumentation.command.json',
'instrumentation.init.json',
'instrumentation.shutdown.json',
].forEach(instrumentationFile => {
expect(fs.existsSync(instrumentationFile)).to.equal(true);
let json = fs.readJsonSync(instrumentationFile);
expect(Object.keys(json)).to.eql([
'summary', 'nodes',
watcher.quit();
}
});
watcher.on('buildFailure', (err: any) => {
ui.writeLine('build failure', 'ERROR');
ui.writeError(err);
});
function cleanupAndExit() {
return watcher.quit();
}
process.on('SIGINT', cleanupAndExit);
process.on('SIGTERM', cleanupAndExit);
actionPromise = promiseFinally(watcher.start().catch((err: any) => ui.writeError(err)), () => {
builder.cleanup();
process.exit(0);
}).catch((err: any) => {
ui.writeLine('Cleanup error:', 'ERROR');
ui.writeError(err);
process.exit(1);
});
});
_runItem(idx) {
promiseFinally(this.list[idx](), () => {
this._onComplete();
});
}
/**
let ui = this.ui;
let startMessage = this.formatStartMessage(options.packages);
let completeMessage = this.formatCompleteMessage(options.packages);
ui.startProgress(chalk.green(startMessage));
let promise;
if (this.useYarn) {
let args = this.toYarnArgs(this.command, options);
promise = this.yarn(args);
} else {
let args = this.toNpmArgs(this.command, options);
promise = this.npm(args);
}
return promiseFinally(promise, () => ui.stopProgress())
.then(() => ui.writeLine(chalk.green(completeMessage)));
});
}
this.hasPathToken = hasPathToken(this.files());
ui.writeLine(`installing ${this.name}`);
if (dryRun) {
ui.writeLine(chalk.yellow('You specified the dry-run flag, so no' +
' changes will be written.'));
}
this._normalizeEntityName(options.entity);
this._checkForPod(options.verbose);
this._checkInRepoAddonExists(options.inRepoAddon);
logger.info('START: processing blueprint: `%s`', this.name);
let start = new Date();
return promiseFinally(this._process(options, this.beforeInstall, this.processFiles, this.afterInstall),
() => logger.info('END: processing blueprint: `%s` in (%dms)', this.name, new Date() - start));
},
cleanup() {
return promiseFinally(this.cancel(), () => this.builderTmpDirCleanup());
}