Skip to content

Commit

Permalink
chore: improve type imports
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel committed May 29, 2024
1 parent 719bae8 commit f3443ad
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/configs/files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* c8 ignore start */

import { FileResults } from '../@types/list-files.js';
import type { FileResults } from '../@types/list-files.js';

export const fileResults: FileResults = {
success: [],
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/logs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* c8 ignore start */
import { Configs } from '../@types/poku.js';
import type { Configs } from '../@types/poku.js';

export const isQuiet = (configs?: Configs): boolean =>
typeof configs?.quiet === 'boolean' && Boolean(configs?.quiet);
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/parse-assertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { hr } from './hr.js';
import { findFile } from './find-file.js';
import { each } from '../configs/each.js';
import { fromEntries, entries } from '../polyfills/object.js';
/* c8 ignore next */
import { ParseAssertionOptions } from '../@types/assert.js';
import { nodeVersion } from './get-runtime.js';
/* c8 ignore next */
import type { ParseAssertionOptions } from '../@types/assert.js';

export const parseResultType = (type?: unknown): string => {
const recurse = (value: unknown): unknown => {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import process from 'node:process';
import path from 'node:path';
import { getRuntime } from './get-runtime.js';
import { Configs } from '../@types/poku.js';
import { Runner } from '../@types/runner.js';
import type { Configs } from '../@types/poku.js';
import type { Runner } from '../@types/runner.js';

export const isWindows = process.platform === 'win32';

Expand Down
2 changes: 1 addition & 1 deletion src/modules/assert-promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as nodeAssert from 'node:assert';
import { parseAssertion } from '../helpers/parse-assertion.js';
import { nodeVersion } from '../helpers/get-runtime.js';
/* c8 ignore next */
import { ParseAssertionOptions } from '../@types/assert.js';
import type { ParseAssertionOptions } from '../@types/assert.js';

const ok = async (
value: unknown,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as nodeAssert from 'node:assert';
import { parseAssertion } from '../helpers/parse-assertion.js';
import { nodeVersion } from '../helpers/get-runtime.js';
/* c8 ignore next */
import { ParseAssertionOptions } from '../@types/assert.js';
import type { ParseAssertionOptions } from '../@types/assert.js';

const ok = (
value: unknown,
Expand Down
7 changes: 4 additions & 3 deletions src/modules/create-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import process from 'node:process';
import { spawn } from 'node:child_process';
import { isWindows, runner, scriptRunner } from '../helpers/runner.js';
import path from 'node:path';
import {
import { sanitizePath } from './list-files.js';
import { kill } from './processes.js';
/* c8 ignore next */
import type {
End,
StartScriptOptions,
StartServiceOptions,
} from '../@types/background-process.js';
import { sanitizePath } from './list-files.js';
import { kill } from './processes.js';

const runningProcesses: Map<number, { end: End; port?: number | number[] }> =
new Map();
Expand Down
2 changes: 1 addition & 1 deletion src/modules/exit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import process from 'node:process';
import { hr } from '../helpers/hr.js';
import { Code } from '../@types/code.js';
import { results } from '../services/run-tests.js';
import { format } from '../helpers/format.js';
import type { Code } from '../@types/code.js';

export const exit = (code: Code, quiet?: boolean) => {
const isPoku = results.success > 0 || results.fail > 0;
Expand Down
1 change: 1 addition & 0 deletions src/modules/list-files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import process from 'node:process';
import fs from 'node:fs';
import path from 'node:path';
/* c8 ignore next */
import type { Configs } from '../@types/list-files.js';

export const sanitizePath = (input: string, ensureTarget?: boolean): string => {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/poku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import process, { stdout } from 'node:process';
import { EOL } from 'node:os';
import { Code } from '../@types/code.js';
import { Configs } from '../@types/poku.js';
import { forceArray } from '../helpers/force-array.js';
import { runTests, runTestsParallel } from '../services/run-tests.js';
import { exit } from './exit.js';
Expand All @@ -16,6 +14,8 @@ import { isQuiet } from '../helpers/logs.js';
import { hr } from '../helpers/hr.js';
import { fileResults } from '../configs/files.js';
import { indentation } from '../configs/indentation.js';
import type { Code } from '../@types/code.js';
import type { Configs } from '../@types/poku.js';

process.once('SIGINT', () => {
stdout.write('\u001B[?25h');
Expand Down
3 changes: 2 additions & 1 deletion src/services/each.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EOL } from 'node:os';
import { Configs } from '../@types/poku.js';
import { format } from '../helpers/format.js';
/* c8 ignore next */
import type { Configs } from '../@types/poku.js';

const eachCore = async (
type: keyof Required<Pick<Configs, 'beforeEach' | 'afterEach'>>,
Expand Down
7 changes: 4 additions & 3 deletions src/services/run-test-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import process from 'node:process';
import path from 'node:path';
import { EOL } from 'node:os';
import { spawn } from 'node:child_process';
import { isWindows, runner } from '../helpers/runner.js';
import { indentation } from '../configs/indentation.js';
import { fileResults } from '../configs/files.js';
import { isWindows, runner } from '../helpers/runner.js';
import { format } from '../helpers/format.js';
import { Configs } from '../@types/poku.js';
import { isDebug, isQuiet } from '../helpers/logs.js';
import { removeConsecutiveRepeats } from '../helpers/remove-repeats.js';
import { beforeEach, afterEach } from './each.js';
import { fileResults } from '../configs/files.js';
/* c8 ignore next */
import type { Configs } from '../@types/poku.js';

export const runTestFile = (
filePath: string,
Expand Down
3 changes: 2 additions & 1 deletion src/services/run-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {
import { hr } from '../helpers/hr.js';
import { format } from '../helpers/format.js';
import { runTestFile } from './run-test-file.js';
import { Configs } from '../@types/poku.js';
import { isQuiet } from '../helpers/logs.js';
/* c8 ignore next */
import type { Configs } from '../@types/poku.js';

/* c8 ignore start */
export const results = {
Expand Down

0 comments on commit f3443ad

Please sign in to comment.