ソースを参照

Merge pull request #880 from transloadit/npm-pack

run integration tests with installed uppy
Ifedapo .A. Olarewaju 7 年 前
コミット
2d75d14112
2 ファイル変更23 行追加8 行削除
  1. 17 2
      bin/endtoend-build
  2. 6 6
      test/endtoend/src/main.js

+ 17 - 2
bin/endtoend-build

@@ -2,6 +2,21 @@
 
 echo "Preparing for end to end test: copying static HTML and CSS, building JS"
 rm -rf ./test/endtoend/dist && mkdir ./test/endtoend/dist
-cp ./dist/uppy.min.css ./test/endtoend/dist 
-cp ./test/endtoend/src/index.html ./test/endtoend/dist 
+rm -rf ./test/endtoend/node_modules
+
+npm run prepublishOnly
+# archive the uppy package
+echo "Creating archive for Uppy package"
+npm pack
+
+UPPY_VERSION=$(node -e 'console.log(require("./package.json").version)')
+# install from the archived uppy package
+echo "Installing Uppy from archived file uppy-${UPPY_VERSION}.tgz"
+npm install --prefix ./test/endtoend uppy-${UPPY_VERSION}.tgz
+
+# removing package-lock.json because we do not need it.
+rm ./test/endtoend/package-lock.json
+
+cp ./test/endtoend/node_modules/uppy/dist/uppy.min.css ./test/endtoend/dist
+cp ./test/endtoend/src/index.html ./test/endtoend/dist
 browserify ./test/endtoend/src/main.js -o ./test/endtoend/dist/bundle.js -t babelify

+ 6 - 6
test/endtoend/src/main.js

@@ -1,9 +1,9 @@
-const Uppy = require('../../../src/core')
-const DragDrop = require('../../../src/plugins/DragDrop')
-const Dashboard = require('../../../src/plugins/Dashboard')
-const Tus = require('../../../src/plugins/Tus')
-const XHRUpload = require('../../../src/plugins/XHRUpload')
-const ProgressBar = require('../../../src/plugins/ProgressBar')
+const Uppy = require('uppy/lib/core')
+const DragDrop = require('uppy/lib/plugins/DragDrop')
+const Dashboard = require('uppy/lib/plugins/Dashboard')
+const Tus = require('uppy/lib/plugins/Tus')
+const XHRUpload = require('uppy/lib/plugins/XHRUpload')
+const ProgressBar = require('uppy/lib/plugins/ProgressBar')
 
 // Initialise Uppy with Drag & Drop
 const uppyDragDrop = Uppy({