Skip to content
Open
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
9 changes: 7 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/es6"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
Expand All @@ -13,6 +13,11 @@
"jest/globals": true
},
"rules": {
"no-console": "off"
"no-console": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"camelcase": "off"
}
}
34 changes: 17 additions & 17 deletions src/SizeLimit.spec.ts → __tests__/SizeLimit.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import SizeLimit from "./SizeLimit";
import SizeLimitParser from "../src/SizeLimitParser";

describe("SizeLimit", () => {
test("should parse size-limit output", () => {
const limit = new SizeLimit();
const parser = new SizeLimitParser();
const output = JSON.stringify([
{
name: "dist/index.js",
Expand All @@ -13,7 +13,7 @@ describe("SizeLimit", () => {
}
]);

expect(limit.parseResults(output)).toEqual({
expect(parser.parse(output)).toEqual({
"dist/index.js": {
name: "dist/index.js",
loading: 2.1658984375,
Expand All @@ -25,7 +25,7 @@ describe("SizeLimit", () => {
});

test("should parse size-limit without times output", () => {
const limit = new SizeLimit();
const parser = new SizeLimitParser();
const output = JSON.stringify([
{
name: "dist/index.js",
Expand All @@ -34,7 +34,7 @@ describe("SizeLimit", () => {
}
]);

expect(limit.parseResults(output)).toEqual({
expect(parser.parse(output)).toEqual({
"dist/index.js": {
name: "dist/index.js",
size: 110894
Expand All @@ -43,7 +43,7 @@ describe("SizeLimit", () => {
});

test("should format size-limit results", () => {
const limit = new SizeLimit();
const parser = new SizeLimitParser();
const base = {
"dist/index.js": {
name: "dist/index.js",
Expand All @@ -63,8 +63,8 @@ describe("SizeLimit", () => {
}
};

expect(limit.formatResults(base, current)).toEqual([
SizeLimit.TIME_RESULTS_HEADER,
expect(parser.diff(base, current)).toEqual([
SizeLimitParser.TIME_RESULTS_HEADER,
[
"dist/index.js",
"98.53 KB (-9.92% 🔽)",
Expand All @@ -76,7 +76,7 @@ describe("SizeLimit", () => {
});

test("should format size-limit without times results", () => {
const limit = new SizeLimit();
const parser = new SizeLimitParser();
const base = {
"dist/index.js": {
name: "dist/index.js",
Expand All @@ -90,14 +90,14 @@ describe("SizeLimit", () => {
}
};

expect(limit.formatResults(base, current)).toEqual([
SizeLimit.SIZE_RESULTS_HEADER,
expect(parser.diff(base, current)).toEqual([
SizeLimitParser.SIZE_RESULTS_HEADER,
["dist/index.js", "98.53 KB (-9.92% 🔽)"]
]);
});

test("should format size-limit with new section", () => {
const limit = new SizeLimit();
const parser = new SizeLimitParser();
const base = {
"dist/index.js": {
name: "dist/index.js",
Expand All @@ -115,15 +115,15 @@ describe("SizeLimit", () => {
}
};

expect(limit.formatResults(base, current)).toEqual([
SizeLimit.SIZE_RESULTS_HEADER,
expect(parser.diff(base, current)).toEqual([
SizeLimitParser.SIZE_RESULTS_HEADER,
["dist/index.js", "98.53 KB (-9.92% 🔽)"],
["dist/new.js", "98.53 KB (+100% 🔺)"]
]);
});

test("should format size-limit with deleted section", () => {
const limit = new SizeLimit();
const parser = new SizeLimitParser();
const base = {
"dist/index.js": {
name: "dist/index.js",
Expand All @@ -137,8 +137,8 @@ describe("SizeLimit", () => {
}
};

expect(limit.formatResults(base, current)).toEqual([
SizeLimit.SIZE_RESULTS_HEADER,
expect(parser.diff(base, current)).toEqual([
SizeLimitParser.SIZE_RESULTS_HEADER,
["dist/index.js", "0 B (-100%)"],
["dist/new.js", "98.53 KB (+100% 🔺)"]
]);
Expand Down
Loading