fix obsolete browser tests, add some polyfills

This commit is contained in:
Bart Butler 2018-02-05 22:17:41 -08:00
parent 1d82046bb8
commit 89f86d83d5
5 changed files with 174 additions and 21 deletions

View File

@ -98,7 +98,18 @@ module.exports = function(grunt) {
'test/lib/unittests-bundle.js': ['./test/unittests.js']
},
options: {
external: ['buffer', 'openpgp', '../../dist/openpgp', '../../../dist/openpgp']
external: ['buffer', 'openpgp', '../../dist/openpgp', '../../../dist/openpgp'],
transform: [
["babelify", {
global: true,
plugins: ["transform-async-to-generator",
"syntax-async-functions",
"transform-regenerator",
"transform-remove-strict-mode"],
ignore: ['*.min.js'],
presets: ["env"]
}]
]
}
}
},
@ -195,7 +206,7 @@ module.exports = function(grunt) {
expand: true,
flatten: true,
cwd: 'node_modules/',
src: ['mocha/mocha.css', 'mocha/mocha.js', 'chai/chai.js', 'whatwg-fetch/fetch.js'],
src: ['mocha/mocha.css', 'mocha/mocha.js'],
dest: 'test/lib/'
},
zlib: {

162
npm-shrinkwrap.json generated
View File

@ -270,9 +270,9 @@
"dev": true
},
"assertion-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz",
"integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
"dev": true
},
"ast-types-flow": {
@ -801,6 +801,24 @@
"regexpu-core": "2.0.0"
}
},
"babel-plugin-transform-es3-member-expression-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es3-member-expression-literals/-/babel-plugin-transform-es3-member-expression-literals-6.22.0.tgz",
"integrity": "sha1-cz00RPPsxBvvjtGmpOCWV7iWnrs=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-es3-property-literals": {
"version": "6.22.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es3-property-literals/-/babel-plugin-transform-es3-property-literals-6.22.0.tgz",
"integrity": "sha1-sgeNWELiKr9A9z6M3pzTcRq9V1g=",
"dev": true,
"requires": {
"babel-runtime": "6.26.0"
}
},
"babel-plugin-transform-exponentiation-operator": {
"version": "6.24.1",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz",
@ -821,6 +839,11 @@
"regenerator-transform": "0.10.1"
}
},
"babel-plugin-transform-remove-strict-mode": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-strict-mode/-/babel-plugin-transform-remove-strict-mode-0.0.2.tgz",
"integrity": "sha1-kTaFqrlUOfOg7YjliPvV6ZeJBXk="
},
"babel-plugin-transform-runtime": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz",
@ -847,7 +870,7 @@
"dev": true,
"requires": {
"babel-runtime": "6.26.0",
"core-js": "2.5.1",
"core-js": "2.5.3",
"regenerator-runtime": "0.10.5"
},
"dependencies": {
@ -897,6 +920,103 @@
"semver": "5.4.1"
}
},
"babel-preset-es2015": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.6.0.tgz",
"integrity": "sha1-iLM+WP7JTG695Y3GXs5dFODsJWg=",
"dev": true,
"requires": {
"babel-plugin-check-es2015-constants": "6.22.0",
"babel-plugin-transform-es2015-arrow-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "6.22.0",
"babel-plugin-transform-es2015-block-scoping": "6.26.0",
"babel-plugin-transform-es2015-classes": "6.24.1",
"babel-plugin-transform-es2015-computed-properties": "6.24.1",
"babel-plugin-transform-es2015-destructuring": "6.23.0",
"babel-plugin-transform-es2015-duplicate-keys": "6.24.1",
"babel-plugin-transform-es2015-for-of": "6.23.0",
"babel-plugin-transform-es2015-function-name": "6.24.1",
"babel-plugin-transform-es2015-literals": "6.22.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
"babel-plugin-transform-es2015-object-super": "6.24.1",
"babel-plugin-transform-es2015-parameters": "6.24.1",
"babel-plugin-transform-es2015-shorthand-properties": "6.24.1",
"babel-plugin-transform-es2015-spread": "6.22.0",
"babel-plugin-transform-es2015-sticky-regex": "6.24.1",
"babel-plugin-transform-es2015-template-literals": "6.22.0",
"babel-plugin-transform-es2015-typeof-symbol": "6.23.0",
"babel-plugin-transform-es2015-unicode-regex": "6.24.1",
"babel-plugin-transform-regenerator": "6.26.0"
}
},
"babel-preset-es2015-mod": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/babel-preset-es2015-mod/-/babel-preset-es2015-mod-6.6.0.tgz",
"integrity": "sha1-4QW2LrfBABCQq4YiUpiQTPkMHo4=",
"dev": true,
"requires": {
"babel-plugin-transform-es2015-modules-commonjs": "6.7.7",
"babel-plugin-transform-regenerator": "6.6.5",
"babel-preset-es2015": "6.6.0",
"modify-babel-preset": "2.0.2"
},
"dependencies": {
"babel-plugin-transform-es2015-modules-commonjs": {
"version": "6.7.7",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.7.7.tgz",
"integrity": "sha1-+lyiAWYXxNcSEj2M/BV4f8qoPzM=",
"dev": true,
"requires": {
"babel-plugin-transform-strict-mode": "6.24.1",
"babel-runtime": "5.8.38",
"babel-template": "6.26.0",
"babel-types": "6.26.0"
}
},
"babel-plugin-transform-regenerator": {
"version": "6.6.5",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.6.5.tgz",
"integrity": "sha1-B5qYK9VuIjXjHuOxetVK66iY1Oc=",
"dev": true,
"requires": {
"babel-core": "6.26.0",
"babel-plugin-syntax-async-functions": "6.13.0",
"babel-plugin-transform-es2015-block-scoping": "6.26.0",
"babel-plugin-transform-es2015-for-of": "6.23.0",
"babel-runtime": "5.8.38",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"private": "0.1.8"
}
},
"babel-runtime": {
"version": "5.8.38",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-5.8.38.tgz",
"integrity": "sha1-HAsC62MxL18If/IEUIJ7QlydTBk=",
"dev": true,
"requires": {
"core-js": "1.2.7"
}
},
"core-js": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz",
"integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=",
"dev": true
}
}
},
"babel-preset-es3": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/babel-preset-es3/-/babel-preset-es3-1.0.1.tgz",
"integrity": "sha1-4I3ZUKFnDauLUKvOqpuT09mszR4=",
"dev": true,
"requires": {
"babel-plugin-transform-es3-member-expression-literals": "6.22.0",
"babel-plugin-transform-es3-property-literals": "6.22.0"
}
},
"babel-register": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz",
@ -905,7 +1025,7 @@
"requires": {
"babel-core": "6.26.0",
"babel-runtime": "6.26.0",
"core-js": "2.5.1",
"core-js": "2.5.3",
"home-or-tmp": "2.0.0",
"lodash": "4.17.4",
"mkdirp": "0.5.1",
@ -918,7 +1038,7 @@
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"dev": true,
"requires": {
"core-js": "2.5.1",
"core-js": "2.5.3",
"regenerator-runtime": "0.11.0"
}
},
@ -1544,7 +1664,7 @@
"integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=",
"dev": true,
"requires": {
"assertion-error": "1.0.2",
"assertion-error": "1.1.0",
"check-error": "1.0.2",
"deep-eql": "3.0.1",
"get-func-name": "2.0.0",
@ -1798,10 +1918,9 @@
"dev": true
},
"core-js": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
"integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=",
"dev": true
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz",
"integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4="
},
"core-util-is": {
"version": "1.0.2",
@ -5849,9 +5968,9 @@
}
},
"mocha": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz",
"integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz",
"integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==",
"dev": true,
"requires": {
"browser-stdout": "1.3.0",
@ -5912,6 +6031,15 @@
}
}
},
"modify-babel-preset": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/modify-babel-preset/-/modify-babel-preset-2.0.2.tgz",
"integrity": "sha1-v6UJZp/kn0IiwM4XG6RO0OgVUec=",
"dev": true,
"requires": {
"require-relative": "0.8.7"
}
},
"module-deps": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz",
@ -6932,6 +7060,12 @@
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true
},
"require-relative": {
"version": "0.8.7",
"resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz",
"integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=",
"dev": true
},
"require-uncached": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",

View File

@ -39,9 +39,11 @@
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015-mod": "^6.6.0",
"babel-preset-es3": "^1.0.1",
"babelify": "^8.0.0",
"browserify-derequire": "^0.9.4",
"chai": "~4.1.2",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"eslint": "^4.16.0",
"eslint-config-airbnb": "^16.1.0",
@ -65,16 +67,18 @@
"grunt-text-replace": "~0.4.0",
"gruntify-eslint": "^4.0.0",
"istanbul": "^0.4.5",
"mocha": "^4.0.1",
"mocha": "^4.1.0",
"sinon": "^4.2.2",
"whatwg-fetch": "~2.0.3",
"whatwg-fetch": "^2.0.3",
"zlibjs": "~0.3.1"
},
"dependencies": {
"asmcrypto-lite": "git+https://github.com/openpgpjs/asmcrypto-lite.git",
"asn1.js": "^5.0.0",
"babel-plugin-transform-remove-strict-mode": "0.0.2",
"bn.js": "^4.11.8",
"buffer": "^5.0.8",
"core-js": "^2.5.3",
"elliptic": "git+https://github.com/openpgpjs/elliptic.git",
"es6-promise": "^4.2.4",
"jwk-to-pem": "^1.2.6",

View File

@ -41,6 +41,12 @@ import config from './config/config';
import util from './util';
import AsyncProxy from './worker/async_proxy';
// Polyfills
require('core-js/fn/array/fill');
require('core-js/fn/array/find');
require('core-js/fn/array/from');
require('core-js/fn/typed/uint8-array');
require('core-js/fn/symbol');
//////////////////////////
// //

View File

@ -11,9 +11,7 @@
<!-- libs -->
<script src="../dist/openpgp.js"></script>
<script src="lib/chai.js"></script>
<script src="lib/mocha.js"></script>
<script src="lib/fetch.js"></script>
<script>
mocha.setup('bdd');
mocha.timeout(240000);