Skip to content

Commit

Permalink
tests(fix): fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored and evenstensberg committed Feb 5, 2019
1 parent 7cb531b commit 5669311
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 27 deletions.
52 changes: 26 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
sudo: false
notifications:
email: false
email: false
language: node_js
node_js:
- "10"
- "8"
- "6"
- "10"
- "8"
- "6"
cache:
directories:
- ~/.npm
directories:
- ~/.npm
matrix:
include:
- os: linux
node_js: "stable"
env: JOB_PART=lint
- os: linux
node_js: "stable"
env: JOB_PART=integration
- os: linux
node_js: "10"
env: JOB_PART=integration
- os: linux
node_js: "8"
env: JOB_PART=integration
- os: linux
node_js: "6"
env: JOB_PART=integration
include:
- os: linux
node_js: "stable"
env: JOB_PART=lint
- os: linux
node_js: "stable"
env: JOB_PART=integration
- os: linux
node_js: "10"
env: JOB_PART=integration
- os: linux
node_js: "8"
env: JOB_PART=integration
- os: linux
node_js: "6"
env: JOB_PART=integration

before_install:
- '[[ $(node -v) =~ ^v9.*$ ]] || npm install -g npm@latest' # skipped when using node 9
- "[[ $(node -v) =~ ^v9.*$ ]] || npm install -g npm@latest" # skipped when using node 9

install:
- travis_wait npm ci
Expand All @@ -37,6 +37,6 @@ install:
- npm install -g eslint

jobs:
include:
- stage: commit lint
script: commitlint-travis
include:
- stage: commit lint
script: commitlint-travis
1 change: 0 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports = {
"body-leading-blank": [1, "always"],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 80],
lang: [0, "always", "eng"],
"scope-case": [2, "always", "lowerCase"],
"scope-empty": [0, "never"],
"subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
Expand Down
81 changes: 81 additions & 0 deletions packages/log/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = require("chalk");
const log = (message) => process.stdout.write(message);
const logError = (message) => process.stderr.write(message);
class Logger {
constructor(input) {
if (input) {
if (typeof input === "string") {
this.name = input;
}
else {
if (!input.name || input.name === "") {
throw new Error("Name of the task was not passed");
}
this.name = input.name;
if (input.start) {
this.start();
}
}
}
else {
throw new Error("Name of the task was not passed");
}
}
log(message) {
message = this.build(message);
message = ` ${chalk_1.default.bold("•")} ${message}`;
log(message);
}
success(message) {
message = this.build(message);
message = chalk_1.default.green(` ${chalk_1.default.bold("\u2713")} ${message}`);
log(message);
}
error(message) {
message = this.build(message);
message = chalk_1.default.red(` ${chalk_1.default.bold("\u2717")} ${message}`);
logError(message);
}
warn(message) {
message = this.build(message);
message = chalk_1.default.yellowBright(` ${chalk_1.default.bold("⚠")} ${message}`);
log(message);
}
info(message) {
message = this.build(message);
message = chalk_1.default.cyan(` ${chalk_1.default.bold("i")} ${message}`);
log(message);
}
clrscr() {
log("\x1Bc");
this.start();
}
custom(symbol, message) {
if (symbol.length !== 1) {
throw new Error("Only single character can be passed as symbol to custom");
}
else {
message = this.build(message);
message = ` ${chalk_1.default.bold(symbol)} ${message}`;
log(message);
}
}
build(message) {
const lines = message.split("\n");
if (lines.length === 1) {
return lines[0] + "\n";
}
message = lines[0] + "\n";
for (let i = 1; i < lines.length; i++) {
message += ` ${lines[i]}\n`;
}
return message;
}
start() {
const message = `${chalk_1.default.bold(this.name)} - ${chalk_1.default.cyan("webpack-cli")}` + "\n";
log(message);
}
}
exports.Logger = Logger;

0 comments on commit 5669311

Please sign in to comment.