diff --git a/packages/v-protocol/package.json b/packages/v-protocol/package.json index 9e675a24..a921e49e 100644 --- a/packages/v-protocol/package.json +++ b/packages/v-protocol/package.json @@ -16,11 +16,12 @@ "typescript": "^4.0.3" }, "scripts": { - "test": "node_modules/.bin/mocha dist/**/*.test.js", + "test": "tsc -p ./test/tsconfig.json; node_modules/.bin/mocha test/dist/test/*.test.js", "build": "tsc", "build:watch": "tsc --watch", "prepublish": "yarn build", - "pretest": "yarn build" + "pretest": "yarn build", + "clean": "rm -rf dist; rm -rf test/dist" }, "repository": { "type": "git", diff --git a/packages/v-protocol/src/testing/buffer-list.ts b/packages/v-protocol/test/buffer-list.ts similarity index 100% rename from packages/v-protocol/src/testing/buffer-list.ts rename to packages/v-protocol/test/buffer-list.ts diff --git a/packages/v-protocol/src/inbound-parser.test.ts b/packages/v-protocol/test/inbound-parser.test.ts similarity index 98% rename from packages/v-protocol/src/inbound-parser.test.ts rename to packages/v-protocol/test/inbound-parser.test.ts index 8feff442..6ef9bc93 100644 --- a/packages/v-protocol/src/inbound-parser.test.ts +++ b/packages/v-protocol/test/inbound-parser.test.ts @@ -16,12 +16,12 @@ * ============================================================================= */ -import buffers from './testing/test-buffers' -import BufferList from './testing/buffer-list' -import { parse } from '.' +import buffers from './test-buffers' +import BufferList from './buffer-list' +import { parse } from '../src' import assert from 'assert' import { PassThrough } from 'stream' -import { BackendMessage } from './backend-messages' +import { BackendMessage } from '../src/backend-messages' var authOkBuffer = buffers.authenticationOk() var paramStatusBuffer = buffers.parameterStatus('client_encoding', 'UTF8') diff --git a/packages/v-protocol/src/outbound-serializer.test.ts b/packages/v-protocol/test/outbound-serializer.test.ts similarity index 98% rename from packages/v-protocol/src/outbound-serializer.test.ts rename to packages/v-protocol/test/outbound-serializer.test.ts index 6caa5f56..279ccf28 100644 --- a/packages/v-protocol/src/outbound-serializer.test.ts +++ b/packages/v-protocol/test/outbound-serializer.test.ts @@ -17,8 +17,8 @@ */ import assert from 'assert' -import { serialize } from './serializer' -import BufferList from './testing/buffer-list' +import { serialize } from '../src/serializer' +import BufferList from './buffer-list' describe('serializer', () => { /*it('builds startup message', function () { diff --git a/packages/v-protocol/src/testing/test-buffers.ts b/packages/v-protocol/test/test-buffers.ts similarity index 100% rename from packages/v-protocol/src/testing/test-buffers.ts rename to packages/v-protocol/test/test-buffers.ts diff --git a/packages/v-protocol/test/tsconfig.json b/packages/v-protocol/test/tsconfig.json new file mode 100644 index 00000000..38d958ad --- /dev/null +++ b/packages/v-protocol/test/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "target": "es6", + "noImplicitAny": true, + "moduleResolution": "node", + "sourceMap": true, + "outDir": "dist", + "incremental": true, + "baseUrl": ".", + "declaration": true, + "paths": { + "*": [ + "node_modules/*", + "src/types/*" + ] + } + }, + "include": [ + "outbound-serializer.test.ts", + "inbound-parser.test.ts" + ] + } + \ No newline at end of file diff --git a/packages/vertica-nodejs/Makefile b/packages/vertica-nodejs/Makefile index 9a2c5346..be66a2bb 100644 --- a/packages/vertica-nodejs/Makefile +++ b/packages/vertica-nodejs/Makefile @@ -21,7 +21,7 @@ update-npm: @npm i npm --global bench: - @find benchmark -name "*-bench.js" | $(node-command) + @find test/benchmark -name "*bench.js" | $(node-command) test-unit: @printf "\n***TESTING VERTICA-NODEJS UNIT TESTS***\n\n" diff --git a/packages/vertica-nodejs/bench.js b/packages/vertica-nodejs/test/benchmark/bench.js similarity index 92% rename from packages/vertica-nodejs/bench.js rename to packages/vertica-nodejs/test/benchmark/bench.js index b2543ecf..1118552d 100644 --- a/packages/vertica-nodejs/bench.js +++ b/packages/vertica-nodejs/test/benchmark/bench.js @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -const vertica = require('./lib') +const vertica = require('../../lib') const params = { text: @@ -50,6 +50,9 @@ const bench = async (client, q, time) => { } const run = async () => { + console.log("Benchmarking currently does not work for vertica-nodejs and has not worked since being ported from node-postgres.") + console.log("In the future, consider fixing, or removing.") + /* const client = new vertica.Client() await client.connect() console.log('start') @@ -96,6 +99,7 @@ const run = async () => { await client.end() await client.end() + */ } run().catch((e) => console.error(e) || process.exit(-1))