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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'node:assert'
import { NotAcceptable, NotFound } from '../../src/errors'
import { NotAcceptable, NotFound } from '../src/errors'

const clone = (data: any) => JSON.parse(JSON.stringify(data))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { createServerAdapter } from '@whatwg-node/server'
import { createServer } from 'node:http'
import { TestService } from './fixture.js'

import { feathers, Application, Params } from '../../src/index.js'
import { createHandler } from '../../src/http/index.js'
import { feathers, Application, Params } from '../src/index.js'
import { createHandler } from '../src/http/index.js'

export * from './client.js'
export * from './rest.js'
Expand Down
4 changes: 1 addition & 3 deletions packages/feathers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@
"LICENSE",
"README.md",
"src/**",
"lib/**",
"*.d.ts",
"*.js"
"lib/**"
],
"scripts": {
"write-version": "node -e \"console.log('export default \\'' + require('./package.json').version + '\\'')\" > src/version.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, it, beforeEach } from 'vitest'
import assert from 'assert'
import { feathers, Application, RealTimeConnection } from '../../src/index.js'
import { channels, keys } from '../../src/channels/index.js'
import { Channel } from '../../src/channels/channel/base.js'
import { CombinedChannel } from '../../src/channels/channel/combined.js'
import { feathers, Application, RealTimeConnection } from '../index.js'
import { channels, keys } from './index.js'
import { Channel } from './channel/base.js'
import { CombinedChannel } from './channel/combined.js'

const { CHANNELS } = keys

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, it, beforeEach } from 'vitest'
import assert from 'assert'
import { feathers, Application, HookContext } from '../../src/index.js'
import { channels } from '../../src/channels/index.js'
import { Channel } from '../../src/channels/channel/base.js'
import { CombinedChannel } from '../../src/channels/channel/combined.js'
import { feathers, Application, HookContext } from '../index.js'
import { channels } from './index.js'
import { Channel } from './channel/base.js'
import { CombinedChannel } from './channel/combined.js'

class TestService {
events = ['foo']
Expand Down Expand Up @@ -52,7 +52,7 @@

try {
await app.service('test').create({ message: 'something' })
} catch (error: any) {

Check warning on line 55 in packages/feathers/src/channels/dispatch.test.ts

View workflow job for this annotation

GitHub Actions / build (24.x)

'error' is defined but never used. Allowed unused caught errors must match /^_/u

Check warning on line 55 in packages/feathers/src/channels/dispatch.test.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'error' is defined but never used. Allowed unused caught errors must match /^_/u

Check warning on line 55 in packages/feathers/src/channels/dispatch.test.ts

View workflow job for this annotation

GitHub Actions / build (24.x)

'error' is defined but never used. Allowed unused caught errors must match /^_/u

Check warning on line 55 in packages/feathers/src/channels/dispatch.test.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'error' is defined but never used. Allowed unused caught errors must match /^_/u
assert.fail('Should never get here')
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { feathers } from '../../src/index.js'
import { channels, keys } from '../../src/channels/index.js'
import { feathers } from '../index.js'
import { channels, keys } from './index.js'

describe('feathers-channels', () => {
it('has app.channel', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { beforeAll, describe, it, expect } from 'vitest'
import { feathers } from '../../src/index.js'
import { clientTests } from '../fixtures/client.js'
import { NotAcceptable, NotFound, MethodNotAllowed } from '../../src/errors.js'
import { feathers } from '../index.js'
import { clientTests } from '../../fixtures/client.js'
import { NotAcceptable, NotFound, MethodNotAllowed } from '../errors.js'

import { createTestServer, TestServiceTypes, verify } from '../fixtures/index.js'
import { fetchClient } from '../../src/client/index.js'
import { createTestServer, TestServiceTypes, verify } from '../../fixtures/index.js'
import { fetchClient } from './index.js'

describe('fetch REST connector', function () {
const port = 8888
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { HookContext, hooks, middleware, NextFunction } from '../../src/hooks/index.js'
import { HookContext, hooks, middleware, NextFunction } from './index.js'

const CYCLES = 100000
const getRuntime = async (callback: () => Promise<any>) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { HookContext, hooks, middleware, NextFunction } from '../../src/hooks/index.js'
import { HookContext, hooks, middleware, NextFunction } from './index.js'

interface Dummy {
sayHi(name: string): Promise<string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest'
import assert from 'assert'
import { collect, HookContext, hooks, middleware, NextFunction } from '../../src/hooks/index.js'
import { collect, HookContext, hooks, middleware, NextFunction } from './index.js'

describe('feathers/hooks collect', () => {
it('collect: hooks run in order', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Adapted from koa-compose (https://github.com/koajs/compose)
import { describe, expect, it } from 'vitest'
import assert from 'assert'
import { compose, NextFunction } from '../../src/hooks/index.js'
import { compose, NextFunction } from './index.js'

function wait(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms || 1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import assert from 'assert'
import { HookContext, hooks, middleware, NextFunction } from '../../src/hooks/index.js'
import { HookContext, hooks, middleware, NextFunction } from './index.js'

describe('feathers/hooks decorator', () => {
it('hook decorator on method and classes with inheritance', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { feathers, Id } from '../../../src/index.js'
import { feathers, Id } from '../../index.js'

describe('`after` hooks', () => {
it('.after hooks can return a promise', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, beforeEach } from 'vitest'
import assert from 'assert'

import { feathers, Application, ApplicationHookMap, ServiceInterface, Params } from '../../../src/index.js'
import { feathers, Application, ApplicationHookMap, ServiceInterface, Params } from '../../index.js'

type Todo = {
id?: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { feathers, Params, ServiceInterface } from '../../../src/index.js'
import { feathers, Params, ServiceInterface } from '../../index.js'

describe('`around` hooks', () => {
it('around hooks can set hook.result which will skip service method', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { feathers, Params, ServiceInterface } from '../../../src/index.js'
import { feathers, Params, ServiceInterface } from '../../index.js'

describe('`before` hooks', () => {
it('.before hooks can return a promise', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, afterEach, beforeEach } from 'vitest'
import assert from 'assert'
import { feathers, Application, FeathersService } from '../../../src/index.js'
import { feathers, Application, FeathersService } from '../../index.js'

describe('`error` hooks', () => {
describe('on direct service method errors', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { hooks, NextFunction } from '../../../src/hooks/index.js'
import { HookContext, createContext, feathers, Id, Params, ServiceInterface } from '../../../src/index.js'
import { hooks, NextFunction } from '../index.js'
import { HookContext, createContext, feathers, Id, Params, ServiceInterface } from '../../index.js'

describe('hooks basics', () => {
it('mix @feathersjs/hooks and .hooks', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
middleware,
NextFunction,
setMiddleware
} from '../../src/hooks/index.js'
} from './index.js'

const hello = (name?: string, _params: any = {}) => {
return Promise.resolve(`Hello ${name}`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { it, describe } from 'vitest'
import assert from 'assert'
import { HookContext, hooks, middleware, NextFunction } from '../../src/hooks/index.js'
import { HookContext, hooks, middleware, NextFunction } from './index.js'

interface HookableObject {
test: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { beforeAll, describe, it, expect } from 'vitest'
import { restTests, verify, createTestServer } from '../fixtures/index.js'
import { CORS_HEADERS } from '../../src/http/index.js'
import { restTests, verify, createTestServer } from '../../fixtures/index.js'
import { CORS_HEADERS } from './index.js'

const TEST_PORT = 4444

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it } from 'vitest'
import assert from 'assert'
import { HookContext } from '../../src/index.js'
import * as http from '../../src/http/utils.js'
import { HookContext } from '../index.js'
import * as http from './utils.js'

describe('@feathersjs/transport-commons HTTP helpers', () => {
it('getResponse body', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { describe, it, beforeEach } from 'vitest'
import assert from 'assert'
import { feathers, Application } from '../../src/index.js'
import { feathers, Application } from '../index.js'

describe('app.routes', () => {
let app: Application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert'
import { describe, it } from 'vitest'
import { Router } from '../../src/router.js'
import { Router } from '../router.js'

describe('router', () => {
it('can lookup and insert a simple path and returns null for invalid path', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/feathers/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig",
"rootDir": "src",
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts", "src/**/test/**"],
"compilerOptions": {
"outDir": "lib"
}
Expand Down
4 changes: 2 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
include: ['packages/**/test/**/*.{test,spec}.{js,ts,tsx,jsx}'],
include: ['packages/**/src/**/*.{test,spec}.{js,ts,tsx,jsx}'],
coverage: {
provider: 'v8',
include: ['packages/*/src/**/*.{js,ts,tsx,jsx}'],
exclude: ['**/test/**', '**/node_modules/**', '**/lib/**', '**/dist/**', '**/*.d.ts', '**/fixtures/**'],
exclude: ['**/*.test.{js,ts,tsx,jsx}', '**/*.spec.{js,ts,tsx,jsx}', '**/node_modules/**', '**/lib/**', '**/dist/**', '**/*.d.ts', '**/fixtures/**'],
reporter: ['text', 'html', 'lcov']
}
}
Expand Down
Loading