Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Stop clearing console when testing #731

Merged
merged 1 commit into from
Sep 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/slate-analytics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ async function init() {
event('slate-analytics:renew-consent-true', config);
}

clearConsole();
if (
process.env.NODE_ENV !== 'test' && // eslint-disable-line no-process-env
process.env.NODE_ENV !== 'test-slate-analytics' // eslint-disable-line no-process-env
) {
clearConsole();
}
console.log(`Thanks for helping improve the Slate development experience!`);
}

Expand Down
6 changes: 5 additions & 1 deletion packages/slate-analytics/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const question = {
};

function forNewConsent() {
clearConsole();
// eslint-disable-next-line no-process-env
if (process.env.NODE_ENV !== 'test') {
clearConsole();
}

console.log(
wrap(
'👋 Welcome to Slate! During the alpha, we would like to gather usage analytics, such as interactions with Slate commands, performance reports, and error occurances. The data does not include any sensitive information. The detailed list of data we gather can be found at:',
Expand Down
11 changes: 9 additions & 2 deletions packages/slate-tools/cli/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,22 @@ Promise.all([
});

function onCompilerCompile() {
clearConsole();
// eslint-disable-next-line no-process-env
if (process.env.NODE_ENV !== 'test') {
clearConsole();
}
spinner.start();
}

function onCompilerDone(stats) {
const statsJson = stats.toJson({}, true);

spinner.stop();
clearConsole();

// eslint-disable-next-line no-process-env
if (process.env.NODE_ENV !== 'test') {
clearConsole();
}

if (statsJson.errors.length) {
event('slate-tools:start:compile-errors', {
Expand Down