Skip to content

Commit

Permalink
chore(deps): use monocart-coverage-reports (#610)
Browse files Browse the repository at this point in the history
* chore: use monocart-coverage-reports

* ci: ignore invalid sintax fixture

* ci: debug

* ci: fix tests
  • Loading branch information
wellwelwel committed Jul 26, 2024
1 parent e3bc2cf commit 1df2608
Show file tree
Hide file tree
Showing 60 changed files with 504 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"src/parsers/get-runtime.ts",
"src/services/pid.ts"
],
"reporter": ["text", "lcov", "cobertura"],
"reporter": ["v8", "codecov", "console-details"],
"branches": 95,
"statements": 95,
"lines": 95,
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/ci
/CHANGELOG.md
/website
/fixtures/sintax
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"coverage",
"website",
"fixtures",
"benchmark"
"benchmark",
"fixtures/sintax"
]
},
"organizeImports": {
Expand Down
6 changes: 6 additions & 0 deletions fixtures/fail-fast/parallel/.pokurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://poku.io/schemas/configs.json",
"failFast": true,
"parallel": true,
"concurrency": 0
}
4 changes: 4 additions & 0 deletions fixtures/fail-fast/parallel/test/a.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import process from 'node:process';

console.log('Failure Fixture');
process.exit(0);
4 changes: 4 additions & 0 deletions fixtures/fail-fast/parallel/test/b.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import process from 'node:process';

console.log('Failure Fixture');
process.exit(1);
4 changes: 4 additions & 0 deletions fixtures/fail-fast/parallel/test/c.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import process from 'node:process';

console.log('Failure Fixture');
process.exit(0);
4 changes: 4 additions & 0 deletions fixtures/fail-fast/parallel/test/d.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import process from 'node:process';

console.log('Failure Fixture');
process.exit(1);
4 changes: 4 additions & 0 deletions fixtures/fail-fast/sequential/.pokurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://poku.io/schemas/configs.json",
"failFast": true
}
4 changes: 4 additions & 0 deletions fixtures/fail-fast/sequential/test/a.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import process from 'node:process';

console.log('Failure Fixture');
process.exit(0);
4 changes: 4 additions & 0 deletions fixtures/fail-fast/sequential/test/b.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import process from 'node:process';

console.log('Failure Fixture');
process.exit(1);
3 changes: 3 additions & 0 deletions fixtures/fail/assert-fail-message.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../src/modules/index.js';

assert.fail('Should fail');
3 changes: 3 additions & 0 deletions fixtures/fail/assert-fail.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../src/modules/index.js';

assert.fail();
3 changes: 3 additions & 0 deletions fixtures/fail/assert-if-error.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../src/modules/index.js';

assert.ifError(true, new Error('If error test'));
3 changes: 3 additions & 0 deletions fixtures/fail/assert.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../src/modules/index.js';

assert(false);
1 change: 1 addition & 0 deletions fixtures/sintax/invalid-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const: 123 = teste;
4 changes: 4 additions & 0 deletions fixtures/watch/.pokurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://poku.io/schemas/configs.json",
"parallel": true
}
3 changes: 3 additions & 0 deletions fixtures/watch/test/a.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../../src/modules/index.js';

assert(true, 'target: a');
3 changes: 3 additions & 0 deletions fixtures/watch/test/b.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../../src/modules/index.js';

assert(true, 'target: b');
3 changes: 3 additions & 0 deletions fixtures/watch/test/sub/a.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../../../src/modules/index.js';

assert(true, 'sub: a');
3 changes: 3 additions & 0 deletions fixtures/watch/test/sub/b.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { assert } from '../../../../src/modules/index.js';

assert(true, 'sub: b');
Empty file.
147 changes: 147 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"test:bun:parallel": "bun src/bin/index.ts --bun -p test/unit test/integration test/e2e",
"test:deno:sequential": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs ci/test/unit ci/test/integration ci/test/e2e",
"test:deno:parallel": "tsx src/bin/index.ts --deno --deno-allow=all --deno-cjs -p ci/test/unit ci/test/integration ci/test/e2e",
"test:c8": "c8 tsx test/c8.test.ts",
"test:c8": "c8 --experimental-monocart tsx test/c8.test.ts",
"test:ci": "tsx test/ci.test.ts",
"test:ci:node": "FILTER='node-' npm run test:ci",
"test:ci:bun": "FILTER='bun-' npm run test:ci",
Expand All @@ -49,7 +49,7 @@
"clear": "rm -rf lib ci coverage .temp test-src test-tests",
"prebuild": "npm run clear",
"build": "tsc && tsc -p tsconfig.test.json",
"postbuild": "tsx tools/compatibility/node.ts && cp fixtures/server/package.json ci/fixtures/server/package.json && npm run build:deno && chmod +x lib/bin/index.js",
"postbuild": "tsx tools/compatibility/node.ts && cp fixtures/server/package.json ci/fixtures/server/package.json && rm -f ./lib/@types/*.js ./lib/bin/*.ts && npm run build:deno && chmod +x lib/bin/index.js",
"build:deno": "tsc -p tsconfig.mjs.json",
"postbuild:deno": "tsx tools/build/check-deno-polyfill.ts",
"lint": "npx @biomejs/biome lint && prettier --check .",
Expand All @@ -62,6 +62,7 @@
"@biomejs/biome": "1.8.3",
"@types/node": "^20.14.12",
"c8": "^10.1.2",
"monocart-coverage-reports": "^2.9.3",
"packages-update": "^2.0.0",
"prettier": "^3.3.3",
"tsx": "4.16.2",
Expand Down
2 changes: 0 additions & 2 deletions src/modules/essentials/assert.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* c8 ignore next */ // ?
import nodeAssert from 'node:assert';
import { createAssert } from '../../services/assert.js';

/* c8 ignore next */ // ?
export const assert = createAssert(nodeAssert);
1 change: 0 additions & 1 deletion src/modules/essentials/poku.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* c8 ignore next 2 */ // Types
import type { Code } from '../../@types/code.js';
import type { Configs } from '../../@types/poku.js';
import process from 'node:process';
Expand Down
2 changes: 0 additions & 2 deletions src/modules/essentials/strict.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* c8 ignore next */ // ?
import nodeAssert from 'node:assert/strict';
import { createAssert } from '../../services/assert.js';

/* c8 ignore next */ // ?
export const strict = createAssert(nodeAssert);
2 changes: 0 additions & 2 deletions src/modules/helpers/container.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* c8 ignore next */ // Types
import type {
DockerComposeConfigs,
DockerfileConfigs,
Expand All @@ -11,5 +10,4 @@ const dockerfile = (configs: DockerfileConfigs) => new DockerContainer(configs);
/** A minimal API to assist tests that require containers or tests that run inside containers using a **docker-compose.yml**. */
const compose = (configs: DockerComposeConfigs) => new DockerCompose(configs);

/* c8 ignore next */ // ?
export const docker = { dockerfile, compose };
5 changes: 1 addition & 4 deletions src/modules/helpers/describe.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* c8 ignore next */ // Types
import type { DescribeOptions } from '../../@types/describe.js';
import { hrtime, env } from 'node:process';
import { format } from '../../services/format.js';
import { Write } from '../../services/write.js';
import { indentation } from '../../configs/indentation.js';

/** On **Poku**, `describe` also can be used just as a pretty `console.log` to title your test suites in the terminal */
export async function describe(
title: string,
cb: () => Promise<unknown>
Expand All @@ -14,7 +12,6 @@ export function describe(title: string, cb: () => unknown): void;
export async function describe(cb: () => Promise<unknown>): Promise<void>;
export function describe(cb: () => unknown): unknown;
export function describe(title: string, options?: DescribeOptions): void;
/* c8 ignore next */ // ?
export async function describe(
arg1: string | (() => unknown | Promise<unknown>),
arg2?: (() => unknown | Promise<unknown>) | DescribeOptions
Expand Down Expand Up @@ -43,7 +40,7 @@ export async function describe(
indentation.hasDescribe = true;

const { background, icon } = options || {};
const message = `${cb ? format('◌').dim() : icon || '☰'} ${cb ? format(isPoku ? `${title}${format(`${FILE}`).italic().gray()}` : title).dim() : format(title).bold() || ''}`;
const message = `${cb ? format('◌').dim() : icon || '☰'} ${cb ? format(isPoku ? `${title}${format(`${FILE}`).italic().gray()}` : title).dim() : format(title).bold()}`;
const noBackground = !background;

if (noBackground) {
Expand Down
Loading

0 comments on commit 1df2608

Please sign in to comment.