Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"swizzle": "docusaurus swizzle",
"test": "pnpm run \"/^test:.*/\"",
"test:empty": ":",
"typecheck": "tsc",
"__typecheck": "tsc --noEmit",
"write-heading-ids": "docusaurus write-heading-ids",
"write-translations": "docusaurus write-translations"
},
Expand Down
3 changes: 2 additions & 1 deletion apps/website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"compilerOptions": {
"baseUrl": ".",
"resolveJsonModule": true,
"strict": true
"strict": true,
"ignoreDeprecations": "6.0"
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"spellcheck": "turbo run spellcheck",
"spellcheck:root": "cspell --no-progress '**' --exclude='apps/*/**' --exclude='packages/*/**'",
"test": "turbo run test",
"validate": "turbo run build lint test spellcheck size-limit"
"typecheck": "turbo run typecheck",
"validate": "turbo run build lint test spellcheck typecheck size-limit"
},
"commitlint": {
"extends": [
Expand Down
10 changes: 6 additions & 4 deletions packages/application/example/usage.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Application } from '@w5s/application';
import { useConfiguration } from '@w5s/application';

const app = Application('my-app', {
const meta = { name: 'my-app' };

const configuration = useConfiguration(meta, {
myVar: 1,
});
app.configure({
configuration.update({
myVar: 2,
});
app.get('myVar'); // 2
configuration.get('myVar'); // 2
1 change: 1 addition & 0 deletions packages/application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"spellcheck": "cspell --no-progress '**'",
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/async/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/bigdecimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/byte-size/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/console/src/Console/isWeb.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function isWeb(): boolean {
const consoleWithStreams = console as Partial<{
_stdout: NodeJS.WriteStream;
_stderr: NodeJS.WriteStream;
_stdout: WritableStream;
_stderr: WritableStream;
}>;
const { _stdout: stdout, _stderr: stderr } = consoleWithStreams;
return stderr == null || stdout == null;
Expand Down
1 change: 1 addition & 0 deletions packages/core-type/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "tsc -b tsconfig.test.json",
"tsc": "tsc",
"__typecheck": "tsc --noEmit -b tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
5 changes: 2 additions & 3 deletions packages/database/src/driver/mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, it, expect, vi } from 'vitest';
import { Ref } from '@w5s/core';
import { sql } from '../sql.js';
import { DatabaseDriver } from '../driver.js';
import { Mock } from './mock.js';

describe('Mock', () => {
const anyCanceler = { cancel() {} };
const anyStatement = sql`SELECT author FROM books WHERE name=${'Toto'}`;
it('should be registered as driver', () => {
expect(DatabaseDriver.get('mock')).toBe(Mock);
Expand All @@ -21,8 +21,7 @@ describe('Mock', () => {
databaseType: 'mock' as const,
mockExecuteQuery,
};
const cancelerRef = Ref(vi.fn());
await expect(Mock.execute(mockClient, anyStatement, cancelerRef)).resolves.toEqual('returnValue');
await expect(Mock.execute(mockClient, anyStatement, anyCanceler)).resolves.toEqual('returnValue');
expect(mockExecuteQuery).toHaveBeenCalledWith(anyStatement);
});
});
Expand Down
17 changes: 5 additions & 12 deletions packages/database/src/driver/mysql.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type * as mysql from 'mysql';
import { describe, it, expect, vi, type Mocked } from 'vitest';
import { Ref } from '@w5s/core';
import { sql } from '../sql.js';
import { DatabaseDriver } from '../driver.js';
import { MySQL } from './mysql.js';

describe('MySQL', () => {
const anyCanceler = { cancel() {} };
const anyStatement = sql`SELECT author FROM books WHERE name=${'Toto'}`;
const mockConnection = (connectionProperties?: any): Mocked<mysql.Connection> => {
const connection: Mocked<mysql.Connection> = {
Expand Down Expand Up @@ -46,8 +46,7 @@ describe('MySQL', () => {
databaseType: 'mysql',
host: 'foo.com',
} as const;
const cancelerRef = Ref(() => {});
await MySQL.execute(client, anyStatement, cancelerRef);
await MySQL.execute(client, anyStatement, anyCanceler);

expect(MySQL.createConnection).toHaveBeenLastCalledWith(client);
});
Expand All @@ -59,9 +58,7 @@ describe('MySQL', () => {
mockConnection({
query,
});
const cancelerRef = Ref(() => {});

await MySQL.execute(anyClient, anyStatement, cancelerRef);
await MySQL.execute(anyClient, anyStatement, anyCanceler);

expect(query).toHaveBeenLastCalledWith('SELECT author FROM books WHERE name=?', ['Toto'], expect.any(Function));
});
Expand All @@ -71,9 +68,7 @@ describe('MySQL', () => {
mockConnection({
end,
});
const cancelerRef = Ref(() => {});

await MySQL.execute(anyClient, anyStatement, cancelerRef);
await MySQL.execute(anyClient, anyStatement, anyCanceler);
expect(end).toHaveBeenCalledTimes(1);
});

Expand All @@ -87,9 +82,7 @@ describe('MySQL', () => {
end,
query,
});
const cancelerRef = Ref(() => {});

await expect(MySQL.execute(anyClient, anyStatement, cancelerRef)).rejects.toThrow();
await expect(MySQL.execute(anyClient, anyStatement, anyCanceler)).rejects.toThrow();
expect(end).toHaveBeenCalledTimes(1);
});
});
Expand Down
11 changes: 4 additions & 7 deletions packages/database/src/driver/sqlite3.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { describe, it, expect, vi, type Mocked } from 'vitest';
import { Ref } from '@w5s/core';
import type { Database } from 'sqlite3';
import { sql } from '../sql.js';
import { DatabaseDriver } from '../driver.js';
Expand All @@ -20,6 +19,7 @@ const mockDatabase = (): Mocked<Database> => {
};

describe('SQLite3', () => {
const anyCanceler = { cancel() {} };
const anyStatement = sql`SELECT ${'42'}`;
const anyClient = {
databaseType: 'sqlite3' as const,
Expand All @@ -38,18 +38,16 @@ describe('SQLite3', () => {
describe('.execute', () => {
it('should send query to Database', async () => {
const { all } = mockDatabase();
const cancelerRef = Ref(() => {});

await SQLite3.execute(anyClient, anyStatement, cancelerRef);
await SQLite3.execute(anyClient, anyStatement, anyCanceler);

expect(all).toHaveBeenLastCalledWith('SELECT ?', ['42'], expect.any(Function));
});

it('should close connection', async () => {
const { close } = mockDatabase();
const cancelerRef = Ref(() => {});

await SQLite3.execute(anyClient, anyStatement, cancelerRef);
await SQLite3.execute(anyClient, anyStatement, anyCanceler);
expect(close).toHaveBeenCalled();
});

Expand All @@ -59,10 +57,9 @@ describe('SQLite3', () => {
// @ts-ignore mock partial signature
(_sqlObject, _values, callback) => callback(new Error('MockSQLite3Error'), null),
);
const cancelerRef = Ref(() => {});

await expect(
SQLite3.execute(anyClient, sql`SELECT error FROM unknown_wrong_table;`, cancelerRef),
SQLite3.execute(anyClient, sql`SELECT error FROM unknown_wrong_table;`, anyCanceler),
).rejects.toThrow();
expect(close).toHaveBeenCalled();
});
Expand Down
1 change: 1 addition & 0 deletions packages/env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/error/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/global-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/iterable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/log/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/money/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/num/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/object-id/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/random/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/task-timeout/example/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function sayHelloWorld(delay: TimeDuration) {
console.log('Hello World!');
resolve(undefined);
}, delay);
canceler.current = () => clearTimeout(timerId);
canceler.onCancel = () => clearTimeout(timerId);
});
}

Expand Down
1 change: 1 addition & 0 deletions packages/task-timeout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/task/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/task/src/Task/tryCall.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ describe(tryCall, () => {

class TestError extends Error {
override name = 'TestError';
public innerError: unknown;

constructor(public innerError: unknown = undefined) {
constructor(innerError: unknown = undefined) {
super('TestMessage');
this.innerError = innerError;
}
}
it('should resolve(block()) when nothing is thrown', async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/time/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "pnpm run \"/^test:.*/\"",
"test:src": "vitest run",
"tsc": "tsc",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"validate": "npm run lint && npm run build && npm run test"
},
"dependencies": {
Expand Down
Loading