From 21d6aaa3d52a31743c0ed62ebbc3aa65b95a31d8 Mon Sep 17 00:00:00 2001 From: daffl Date: Tue, 13 Sep 2022 12:01:06 +0200 Subject: [PATCH] chore(tests): Fix test running setup --- package.json | 2 +- packages/schema/test/fixture.ts | 48 ++++++++++++++------------ packages/schema/test/schema.test.ts | 52 ++++++++++++++++------------- packages/tests/package.json | 2 ++ 4 files changed, 59 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index deb6d1ab51..c87511b5e3 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "update-dependencies": "ncu -u && lerna exec -- ncu -u -x node-fetch -x chalk", "clean": "find . -name node_modules -exec rm -rf '{}' + && find . -name package-lock.json -exec rm -rf '{}' +", "test:deno": "deno test --config deno/tsconfig.json deno/test.ts", - "test": "npm run lint && npm run compile && c8 lerna run test --ignore @feathersjs/tests --ignore @feathersjs/adapter-commons" + "test": "npm run lint && npm run compile && c8 lerna run test" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^5.37.0", diff --git a/packages/schema/test/fixture.ts b/packages/schema/test/fixture.ts index 5b01bc7d2e..72437ae04a 100644 --- a/packages/schema/test/fixture.ts +++ b/packages/schema/test/fixture.ts @@ -35,16 +35,19 @@ export const userSchema = schema({ } } as const) -export const userResultSchema = schema({ - $id: 'UserResult', - type: 'object', - additionalProperties: false, - required: ['id', ...userSchema.required], - properties: { - ...userSchema.properties, - id: { type: 'number' } - } -} as const, fixtureAjv) +export const userResultSchema = schema( + { + $id: 'UserResult', + type: 'object', + additionalProperties: false, + required: ['id', ...userSchema.required], + properties: { + ...userSchema.properties, + id: { type: 'number' } + } + } as const, + fixtureAjv +) export type User = Infer export type UserResult = Infer & { name: string } @@ -92,17 +95,20 @@ export const messageSchema = schema({ } } as const) -export const messageResultSchema = schema({ - $id: 'MessageResult', - type: 'object', - additionalProperties: false, - required: ['id', ...messageSchema.required], - properties: { - ...messageSchema.properties, - id: { type: 'number' }, - user: { $ref: 'UserResult' } - } -} as const, fixtureAjv) +export const messageResultSchema = schema( + { + $id: 'MessageResult', + type: 'object', + additionalProperties: false, + required: ['id', ...messageSchema.required], + properties: { + ...messageSchema.properties, + id: { type: 'number' }, + user: { $ref: 'UserResult' } + } + } as const, + fixtureAjv +) export type Message = Infer export type MessageResult = Combine< diff --git a/packages/schema/test/schema.test.ts b/packages/schema/test/schema.test.ts index 01f5789c55..413393db5a 100644 --- a/packages/schema/test/schema.test.ts +++ b/packages/schema/test/schema.test.ts @@ -186,30 +186,36 @@ describe('@feathersjs/schema/schema', () => { }) it('with references', async () => { - const userSchema = schema({ - $id: 'ref-user', - type: 'object', - required: ['email'], - additionalProperties: false, - properties: { - email: { type: 'string' }, - age: { type: 'number' } - } - } as const, customAjv) - const messageSchema = schema({ - $id: 'ref-message', - type: 'object', - required: ['text', 'user'], - additionalProperties: false, - properties: { - text: { - type: 'string' - }, - user: { - $ref: 'ref-user' + const userSchema = schema( + { + $id: 'ref-user', + type: 'object', + required: ['email'], + additionalProperties: false, + properties: { + email: { type: 'string' }, + age: { type: 'number' } } - } - } as const, customAjv) + } as const, + customAjv + ) + const messageSchema = schema( + { + $id: 'ref-message', + type: 'object', + required: ['text', 'user'], + additionalProperties: false, + properties: { + text: { + type: 'string' + }, + user: { + $ref: 'ref-user' + } + } + } as const, + customAjv + ) type User = Infer type Message = Infer & { diff --git a/packages/tests/package.json b/packages/tests/package.json index dc529a309a..ff795a307f 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -33,6 +33,8 @@ }, "scripts": { "prepublish": "npm run compile", + "pack": "echo \"not necessary\"", + "test": "echo \"not necessary\"", "compile": "shx rm -rf lib/ && tsc" }, "directories": {