Skip to content
This repository was archived by the owner on Nov 4, 2021. It is now read-only.
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 jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = {
clearMocks: true,
coverageProvider: 'v8',
setupFilesAfterEnv: ['./jest.setup.pg-mock.js', './jest.setup.redis-mock.js', './jest.setup.fetch-mock.js'],
testMatch: ['<rootDir>/src/**/__tests__/**/*.test.ts'],
testMatch: ['<rootDir>/tests/**/*.test.ts'],
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Plugin, PluginAttachmentDB, PluginConfig } from '../../types'
import { Plugin, PluginAttachmentDB, PluginConfig } from '../../src/types'
import fs from 'fs'
import path from 'path'
import os from 'os'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as s from '../../sql'
import * as s from '../../src/sql'

// mock functions that get data from postgres and give them the right types
type UnPromisify<F> = F extends (...args: infer A) => Promise<infer T> ? (...args: A) => T : never
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { defaultConfig } from '../../server'
import { makePiscina } from '../piscina'
import { defaultConfig } from '../src/server'
import { makePiscina } from '../src/worker/piscina'
import { PluginEvent } from 'posthog-plugins/src/types'
import { performance } from 'perf_hooks'
import { mockJestWithIndex } from '../../__tests__/helpers/plugins'
import { mockJestWithIndex } from './helpers/plugins'
import * as os from 'os'

jest.mock('../../sql')
jest.mock('../src/sql')
jest.setTimeout(300000) // 300 sec timeout

function processOneEvent(processEvent: (event: PluginEvent) => Promise<PluginEvent>): Promise<PluginEvent> {
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/plugins.test.ts → tests/plugins.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { runPlugins, setupPlugins } from '../plugins'
import { createServer } from '../server'
import { PluginsServer } from '../types'
import { runPlugins, setupPlugins } from '../src/plugins'
import { createServer } from '../src/server'
import { PluginsServer } from '../src/types'
import { PluginEvent } from 'posthog-plugins/src/types'
import {
mockPluginTempFolder,
Expand All @@ -10,7 +10,7 @@ import {
pluginConfig39,
} from './helpers/plugins'
import { getPluginAttachmentRows, getPluginConfigRows, getPluginRows, setError } from './helpers/sqlMock'
jest.mock('../sql')
jest.mock('../src/sql')

let mockServer: PluginsServer
beforeEach(async () => {
Expand Down
10 changes: 5 additions & 5 deletions src/worker/__tests__/queue.test.ts → tests/queue.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { startQueue } from '../queue'
import { createServer, defaultConfig } from '../../server'
import { PluginsServer } from '../../types'
import Client from '../../celery/client'
import { runPlugins } from '../../plugins'
import { startQueue } from '../src/worker/queue'
import { createServer, defaultConfig } from '../src/server'
import { PluginsServer } from '../src/types'
import Client from '../src/celery/client'
import { runPlugins } from '../src/plugins'

function advanceOneTick() {
return new Promise((resolve) => process.nextTick(resolve))
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/sql.test.ts → tests/sql.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getPluginAttachmentRows, getPluginConfigRows, getPluginRows, setError } from '../sql'
import { Plugin, PluginAttachmentDB, PluginConfig, PluginError, PluginsServer } from '../types'
import { createServer } from '../server'
import { getPluginAttachmentRows, getPluginConfigRows, getPluginRows, setError } from '../src/sql'
import { Plugin, PluginAttachmentDB, PluginConfig, PluginError, PluginsServer } from '../src/types'
import { createServer } from '../src/server'

let mockServer: PluginsServer
beforeEach(async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/utils.test.ts → tests/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getFileFromTGZ, getFileFromZip, getFileFromArchive, bufferToStream } from '../utils'
import { getFileFromTGZ, getFileFromZip, getFileFromArchive, bufferToStream } from '../src/utils'

// .zip in Base64: github repo posthog/helloworldplugin
const zip =
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/vm.test.ts → tests/vm.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createPluginConfigVM, prepareForRun } from '../vm'
import { PluginConfig, PluginsServer, Plugin } from '../types'
import { createPluginConfigVM, prepareForRun } from '../src/vm'
import { PluginConfig, PluginsServer, Plugin } from '../src/types'
import { PluginEvent } from 'posthog-plugins'
import { createServer, defaultConfig } from '../server'
import { createServer, defaultConfig } from '../src/server'
import * as fetch from 'node-fetch'

const defaultEvent = {
Expand Down