Selaa lähdekoodia

Improve companion unit testing DX (#2827)

Mikael Finstad 4 vuotta sitten
vanhempi
commit
2e0065a2e1

+ 3 - 2
packages/@uppy/companion/package.json

@@ -80,7 +80,8 @@
     "automock": false,
     "automock": false,
     "collectCoverage": true,
     "collectCoverage": true,
     "collectCoverageFrom": [
     "collectCoverageFrom": [
-      "src/**"
+      "src/**",
+      "!src/**/*.d.ts"
     ]
     ]
   },
   },
   "scripts": {
   "scripts": {
@@ -88,7 +89,7 @@
     "deploy": "kubectl apply -f infra/kube/companion-kube.yml",
     "deploy": "kubectl apply -f infra/kube/companion-kube.yml",
     "prepublishOnly": "npm run build",
     "prepublishOnly": "npm run build",
     "start": "node ./lib/standalone/start-server.js",
     "start": "node ./lib/standalone/start-server.js",
-    "test": "node test/run",
+    "test": "bash -c 'source env.test.sh && ../../../node_modules/jest/bin/jest.js'",
     "test:watch": "npm test -- --watch"
     "test:watch": "npm test -- --watch"
   },
   },
   "engines": {
   "engines": {

+ 0 - 14
packages/@uppy/companion/test/run.js

@@ -1,14 +0,0 @@
-#!/usr/bin/env node
-const { execSync } = require('child_process')
-const path = require('path')
-
-process.chdir(path.join(__dirname, '..'))
-try {
-  execSync('jest --version', { shell: 'bash' })
-} catch (err) {
-  console.error('could not start jest, make sure this script is ran using `npm test`')
-  process.exit(1)
-}
-
-execSync('npm run build', { stdio: 'inherit' })
-execSync('source env.test.sh && jest', { shell: 'bash', stdio: 'inherit' })