Skip to content
Merged
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
19 changes: 14 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:

- name: Install dependencies
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: 0

- name: Lint
run: yarn lint
Expand Down Expand Up @@ -77,6 +79,8 @@ jobs:

- name: Install dependencies
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: 0

- name: Build packages
run: yarn build
Expand Down Expand Up @@ -153,13 +157,16 @@ jobs:
let baseline = null;
try { baseline = parseAllFiles(fs.readFileSync('/tmp/baseline/coverage-summary.txt', 'utf8')); } catch {}

const stripAnsi = s => s.replace(/\x1b\[[0-9;]*m/g, '');

const fmt = (val, baseVal) => {
const str = `**${val.toFixed(2)}%**`;
if (baseline === null || isNaN(baseVal)) return str;
const d = (val - baseVal).toFixed(2);
const sign = d >= 0 ? '+' : '';
const color = d > 0 ? '▲' : d < 0 ? '▼' : '●';
return `${str} ${color}${sign}${d}%`;
const d = val - baseVal;
if (Math.abs(d) < 0.005) return str;
const sign = d > 0 ? '+' : '';
const arrow = d > 0 ? '▲' : '▼';
return `${str} ${arrow}${sign}${d.toFixed(2)}%`;
};

let coverageLine = '_Coverage data not found_';
Expand All @@ -173,7 +180,7 @@ jobs:
].join(' | ');
}

const testLine = lines.find(l => l.includes('Test Files')) || '';
const testLine = lines.map(stripAnsi).find(l => l.includes('Test Files')) || '';
const body = [
'## Coverage',
coverageLine,
Expand Down Expand Up @@ -231,6 +238,8 @@ jobs:

- name: Install dependencies
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: 0

- name: Build packages
run: yarn build
Expand Down
Loading