Browse Source

feat(cli): add build script and unify tests (#3369)

oddlama 2 years ago
parent
commit
f700f3427b
5 changed files with 23 additions and 15 deletions
  1. 0 0
      cli/asdf
  2. 0 8
      cli/jest.config.ts
  3. 19 0
      cli/package.json
  4. 0 7
      cli/test/tsconfig.json
  5. 4 0
      cli/tsconfig.build.json

+ 0 - 0
cli/asdf


+ 0 - 8
cli/jest.config.ts

@@ -1,8 +0,0 @@
-import type { Config } from 'jest';
-
-const config: Config = {
-  preset: 'ts-jest',
-  setupFilesAfterEnv: ['jest-extended/all'],
-};
-
-export default config;

+ 19 - 0
cli/package.json

@@ -40,10 +40,29 @@
     "yaml": "^2.3.1"
   },
   "scripts": {
+    "build": "tsc --project tsconfig.build.json",
     "lint": "eslint \"src/**/*.ts\" --max-warnings 0",
     "prepack": "yarn build ",
     "test": "jest",
     "test:cov": "jest --coverage",
     "format": "prettier --check ."
+  },
+  "jest": {
+    "clearMocks": true,
+    "moduleFileExtensions": [
+      "js",
+      "json",
+      "ts"
+    ],
+    "rootDir": ".",
+    "testRegex": ".*\\.spec\\.ts$",
+    "transform": {
+      "^.+\\.ts$": "ts-jest"
+    },
+    "collectCoverageFrom": [
+      "<rootDir>/src/**/*.(t|j)s"
+    ],
+    "coverageDirectory": "./coverage",
+    "testEnvironment": "node"
   }
 }

+ 0 - 7
cli/test/tsconfig.json

@@ -1,7 +0,0 @@
-{
-  "extends": "../tsconfig",
-  "compilerOptions": {
-    "noEmit": true
-  },
-  "references": [{ "path": ".." }]
-}

+ 4 - 0
cli/tsconfig.build.json

@@ -0,0 +1,4 @@
+{
+  "extends": "./tsconfig.json",
+  "exclude": ["dist", "node_modules", "upload", "test", "**/*spec.ts"]
+}