Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Oct 19, 2023
1 parent 458b1b1 commit 9edb89e
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 67 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,30 @@
"quick:test": "node --enable-source-maps --loader=ts-node/esm bin/test.ts"
},
"devDependencies": {
"@adonisjs/assembler": "^6.1.3-18",
"@adonisjs/core": "^6.1.5-24",
"@adonisjs/assembler": "^6.1.3-25",
"@adonisjs/core": "^6.1.5-28",
"@adonisjs/eslint-config": "^1.1.8",
"@adonisjs/prettier-config": "^1.1.8",
"@adonisjs/redis": "^8.0.0-10",
"@adonisjs/redis": "^8.0.0-11",
"@adonisjs/tsconfig": "^1.1.8",
"@japa/api-client": "^2.0.0-0",
"@japa/assert": "^2.0.0-1",
"@japa/browser-client": "^2.0.0-3",
"@japa/file-system": "^2.0.0-1",
"@japa/plugin-adonisjs": "^2.0.0-1",
"@japa/runner": "^3.0.0-6",
"@japa/snapshot": "^2.0.0-1",
"@japa/api-client": "^2.0.0",
"@japa/assert": "^2.0.0",
"@japa/browser-client": "^2.0.0",
"@japa/file-system": "^2.0.0",
"@japa/plugin-adonisjs": "^2.0.0-3",
"@japa/runner": "^3.0.3",
"@japa/snapshot": "^2.0.0",
"@swc/core": "1.3.82",
"@types/node": "^20.6.0",
"@types/set-cookie-parser": "^2.4.3",
"@types/supertest": "^2.0.12",
"@types/node": "^20.8.7",
"@types/set-cookie-parser": "^2.4.4",
"@types/supertest": "^2.0.14",
"@vinejs/vine": "^1.6.0",
"c8": "^8.0.0",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"del-cli": "^5.0.0",
"edge.js": "^6.0.0-8",
"eslint": "^8.49.0",
"eslint": "^8.51.0",
"get-port": "^7.0.0",
"github-label-sync": "^2.3.1",
"husky": "^8.0.3",
Expand All @@ -81,13 +81,13 @@
"typescript": "^5.1.6"
},
"dependencies": {
"@poppinss/utils": "^6.5.0-5"
"@poppinss/utils": "^6.5.0"
},
"peerDependencies": {
"@adonisjs/core": "^6.1.5-22",
"@adonisjs/redis": "^8.0.0-10",
"@japa/api-client": "^2.0.0-0",
"@japa/browser-client": "^2.0.0-3",
"@adonisjs/core": "^6.1.5-28",
"@adonisjs/redis": "^8.0.0-11",
"@japa/api-client": "^2.0.0",
"@japa/browser-client": "^2.0.0",
"edge.js": "^6.0.0-8"
},
"peerDependenciesMeta": {
Expand Down
8 changes: 4 additions & 4 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@

import lodash from '@poppinss/utils/lodash'
import { cuid } from '@adonisjs/core/helpers'
import { EmitterService } from '@adonisjs/core/types'
import type { HttpContext } from '@adonisjs/core/http'
import type { EmitterService } from '@adonisjs/core/types'
import type { HttpError } from '@adonisjs/core/types/http'

import { ReadOnlyStore, Store } from './store.js'
import debug from './debug.js'
import * as errors from './errors.js'
import { ReadOnlyStore, Store } from './store.js'
import type {
SessionData,
SessionConfig,
AllowedSessionValues,
SessionDriverContract,
} from './types/main.js'
import debug from './debug.js'
import { HttpError } from '@adonisjs/core/types/http'

/**
* The session class exposes the API to read and write values to
Expand Down
4 changes: 2 additions & 2 deletions src/session_middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import sessionDriversList from './drivers_collection.js'
/**
* HttpContext augmentations
*/
declare module '@adonisjs/http-server' {
interface HttpContext {
declare module '@adonisjs/core/http' {
export interface HttpContext {
session: Session
}
}
Expand Down
6 changes: 3 additions & 3 deletions stubs/config.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
to: {{ app.configPath('session.ts') }}
---
{{{
exports({ to: app.configPath('session.ts') })
}}}
import env from '#start/env'
import { defineConfig } from '@adonisjs/session'

Expand Down
41 changes: 7 additions & 34 deletions test_helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
* file that was distributed with this source code.
*/

import type { Test } from '@japa/runner/core'
import { getActiveTest } from '@japa/runner'
import { runner } from '@japa/runner/factories'
import { browserClient } from '@japa/browser-client'
import { pluginAdonisJS } from '@japa/plugin-adonisjs'
import { ApiClient, apiClient } from '@japa/api-client'
import { NamedReporterContract } from '@japa/runner/types'
import { runner, syncReporter } from '@japa/runner/factories'
import type { ApplicationService } from '@adonisjs/core/types'
import { IncomingMessage, ServerResponse, createServer } from 'node:http'
import { Suite, Emitter as JapaEmitter, Refiner, Test, TestContext } from '@japa/runner/core'

import { sessionApiClient } from '../src/plugins/japa/api_client.js'
import { sessionBrowserClient } from '../src/plugins/japa/browser_client.js'
Expand All @@ -39,48 +40,20 @@ export async function runJapaTest(app: ApplicationService, callback: Parameters<
ApiClient.clearTeardownHooks()
ApiClient.clearRequestHandlers()

const japaEmitter = new JapaEmitter()
const refiner = new Refiner()

const t = new Test('make api request', (self) => new TestContext(self), japaEmitter, refiner)
t.run(callback)

const unit = new Suite('unit', japaEmitter, refiner)

await runner()
.configure({
reporters: {
activated: ['sync'],
list: [
{
name: 'sync',
handler(r, emitter) {
emitter.on('runner:end', function () {
const summary = r.getSummary()
if (summary.hasError) {
throw summary.failureTree[0].children[0].errors[0].error
}
})
},
},
],
activated: [syncReporter.name],
list: [syncReporter as NamedReporterContract],
},
plugins: [
apiClient(),
browserClient({ runInSuites: ['unit'] }),
browserClient({}),
pluginAdonisJS(app),
sessionApiClient(app),
sessionBrowserClient(app),
({ runner: r }) => {
r.onSuite((suite) => {
suite.add(t)
})
},
],
files: [],
refiner: refiner,
})
.useEmitter(japaEmitter)
.withSuites([unit])
.run()
.runTest('testing japa integration', callback)
}
2 changes: 1 addition & 1 deletion tests/concurrent_session.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import setCookieParser from 'set-cookie-parser'
import { Emitter } from '@adonisjs/core/events'
import { setTimeout } from 'node:timers/promises'
import { EventsList } from '@adonisjs/core/types'
import { RedisService } from '@adonisjs/redis/types'
import { AppFactory } from '@adonisjs/core/factories/app'
import { IncomingMessage, ServerResponse } from 'node:http'
import { RedisManagerFactory } from '@adonisjs/redis/factories'
import { CookieClient, HttpContext } from '@adonisjs/core/http'
import { EncryptionFactory } from '@adonisjs/core/factories/encryption'
import { RedisService, InferConnections } from '@adonisjs/redis/types'
import { HttpContextFactory, RequestFactory, ResponseFactory } from '@adonisjs/core/factories/http'

import { Session } from '../src/session.js'
Expand Down
5 changes: 3 additions & 2 deletions tests/drivers/file_driver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import { join } from 'node:path'
import { test } from '@japa/runner'
import { stat } from 'node:fs/promises'
import { setTimeout } from 'node:timers/promises'

import { FileDriver } from '../../src/drivers/file.js'
Expand Down Expand Up @@ -134,15 +135,15 @@ test.group('File driver', () => {
* Making sure the original mTime of the file was smaller
* than the current time after wait
*/
const { mtimeMs } = await fs.adapter.stat(join(fs.basePath, '1234.txt'))
const { mtimeMs } = await stat(join(fs.basePath, '1234.txt'))
assert.isBelow(mtimeMs, Date.now())

await session.touch(sessionId)

/**
* Ensuring the new mTime is greater than the old mTime
*/
let { mtimeMs: newMtimeMs } = await fs.adapter.stat(join(fs.basePath, '1234.txt'))
let { mtimeMs: newMtimeMs } = await stat(join(fs.basePath, '1234.txt'))
assert.isAbove(newMtimeMs, mtimeMs)

await assert.fileEquals(
Expand Down
4 changes: 2 additions & 2 deletions tests/drivers/redis_driver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import { test } from '@japa/runner'
import { defineConfig } from '@adonisjs/redis'
import { setTimeout } from 'node:timers/promises'
import { RedisService } from '@adonisjs/redis/types'
import { RedisManagerFactory } from '@adonisjs/redis/factories'
import type { RedisService, InferConnections } from '@adonisjs/redis/types'

import { RedisDriver } from '../../src/drivers/redis.js'

Expand All @@ -27,7 +27,7 @@ const redisConfig = defineConfig({
})
const redis = new RedisManagerFactory(redisConfig).create() as RedisService
declare module '@adonisjs/redis/types' {
interface RedisConnections extends InferConnections<typeof redisConfig> {}
export interface RedisConnections extends InferConnections<typeof redisConfig> {}
}

test.group('Redis driver', (group) => {
Expand Down

0 comments on commit 9edb89e

Please sign in to comment.