From e4acf7bec25a1f230ad7d6e52c2988a7bb78c174 Mon Sep 17 00:00:00 2001 From: Ralfs Date: Mon, 24 May 2021 21:49:48 +0300 Subject: [PATCH 1/4] Separate tsconfig for tests and prod --- package.json | 2 +- tsconfig.production.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tsconfig.production.js diff --git a/package.json b/package.json index f1f05f5..99c3b0b 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "node": ">=10" }, "scripts": { - "build": "tsc", + "build": "tsc --project tsconfig.production.json", "start": "ts-node src/tests.ts", "clean": "rm -rf lib", "prepare": "run-s clean build", diff --git a/tsconfig.production.js b/tsconfig.production.js new file mode 100644 index 0000000..8083ad6 --- /dev/null +++ b/tsconfig.production.js @@ -0,0 +1,17 @@ +{ + "extends": "@tsconfig/node10/tsconfig.json", + + "compilerOptions": { + "outDir": "./lib", + "allowJs": true, + "checkJs": true, + "declaration": true, + "declarationMap": true, + "noImplicitAny": false, + "resolveJsonModule": true, + "sourceMap": true, + "jsx": "react" + }, + "include": ["./src/**/*"], + "exclude": ["./src/**/*.test.js", "node_modules", "**/node_modules"] +} From 80f7e5c8262e5359500e0823d7ab0c4645a1298d Mon Sep 17 00:00:00 2001 From: Ralfs Date: Mon, 24 May 2021 21:54:37 +0300 Subject: [PATCH 2/4] tsconfig path fix --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99c3b0b..9a8ad11 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "node": ">=10" }, "scripts": { - "build": "tsc --project tsconfig.production.json", + "build": "tsc --project ./tsconfig.production.json", "start": "ts-node src/tests.ts", "clean": "rm -rf lib", "prepare": "run-s clean build", From 68be4694a99597cf983ab4179252f59553847dd8 Mon Sep 17 00:00:00 2001 From: Ralfs Date: Mon, 24 May 2021 23:15:46 +0300 Subject: [PATCH 3/4] tsconfig path fix #2 --- package.json | 17 ++++++++--------- tests/test_utils.ts | 2 +- ...ig.production.js => tsconfig.production.json | 0 3 files changed, 9 insertions(+), 10 deletions(-) rename tsconfig.production.js => tsconfig.production.json (100%) diff --git a/package.json b/package.json index 9a8ad11..7302369 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,12 @@ "node": ">=10" }, "scripts": { - "build": "tsc --project ./tsconfig.production.json", - "start": "ts-node src/tests.ts", + "build": "tsc", + "start": "ts-node src/index.ts", "clean": "rm -rf lib", "prepare": "run-s clean build", "shell": "node -e \"$(< shell)\" -i --experimental-repl-await", - "test": "mocha -r ts-node/register tests/Stateless.test.ts --timeout 0", + "test": "mocha -r ts-node/register tests/**/*.test.ts --timeout 100000 --project tsconfig.production.json", "test:build": "run-s build", "test:lint": "eslint src", "test:unit": "jest", @@ -30,17 +30,18 @@ "devDependencies": { "@tsconfig/node10": "^1.0.0", "@types/bn.js": "^4.11.6", - "@types/chai": "^4.2.14", + "@types/chai": "^4.2.17", "@types/jest": "^26.0.9", "@types/mocha": "^8.2.2", "@typescript-eslint/eslint-plugin": "^4.6.0", "@typescript-eslint/parser": "^4.6.0", "babel-eslint": "^10.0.3", - "chai": "^4.2.0", + "chai": "^4.3.4", "cross-env": "^7.0.2", "eslint": "^7.6.0", "eslint-config-prettier": "^6.11.0", "jest": "^26.6.3", + "mocha": "^8.3.2", "npm-run-all": "^4.1.5", "prettier": "^2.0.5", "ts-jest": "^26.2.0", @@ -59,12 +60,10 @@ "@project-serum/serum": "^0.13.20", "@project-serum/sol-wallet-adapter": "^0.1.4", "@solana/spl-token": "0.0.13", - "@solana/web3.js": "^0.95.0", + "@solana/web3.js": "^0.90.0", "bn.js": "^5.1.2", "borsh": "https://github.com/defactojob/borsh-js#field-mapper", - "buffer-layout": "^1.2.0", - "dotenv": "^10.0.0", - "mocha": "^8.4.0" + "buffer-layout": "^1.2.0" }, "browserslist": [ ">0.2%", diff --git a/tests/test_utils.ts b/tests/test_utils.ts index 74b3922..638dcfb 100644 --- a/tests/test_utils.ts +++ b/tests/test_utils.ts @@ -4,7 +4,7 @@ import { Market, TokenInstructions, OpenOrders, Orderbook } from '@project-serum import { token } from '@project-serum/common'; import { u64, NATIVE_MINT } from "@solana/spl-token"; import { sleep } from '../src/utils'; -import fs from 'fs'; + console.log = function () {}; // NOTE: Disable all unnecessary logging const FAUCET_PROGRAM_ID = new PublicKey( diff --git a/tsconfig.production.js b/tsconfig.production.json similarity index 100% rename from tsconfig.production.js rename to tsconfig.production.json From c1503e9b1ded278e31a4269822e35317020b7c3e Mon Sep 17 00:00:00 2001 From: Ralfs Date: Mon, 24 May 2021 23:19:12 +0300 Subject: [PATCH 4/4] tsconfig path fix #3 --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 7302369..e353a92 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,12 @@ "node": ">=10" }, "scripts": { - "build": "tsc", - "start": "ts-node src/index.ts", + "build": "tsc --project ./tsconfig.production.json", + "start": "ts-node src/tests.ts", "clean": "rm -rf lib", "prepare": "run-s clean build", "shell": "node -e \"$(< shell)\" -i --experimental-repl-await", - "test": "mocha -r ts-node/register tests/**/*.test.ts --timeout 100000 --project tsconfig.production.json", + "test": "mocha -r ts-node/register tests/Stateless.test.ts --timeout 0", "test:build": "run-s build", "test:lint": "eslint src", "test:unit": "jest",