async-test-util
Advanced tools
| # This is a basic workflow to help you get started with Actions | ||
| name: CI | ||
| on: | ||
| push: | ||
| branches: [ master ] | ||
| pull_request: | ||
| branches: [ master ] | ||
| workflow_dispatch: | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-18.04 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Setup Node.js environment | ||
| uses: actions/setup-node@v2.4.1 | ||
| with: | ||
| node-version: 16.5.0 | ||
| - name: Reuse npm cache folder | ||
| uses: actions/cache@v2 | ||
| env: | ||
| cache-name: cache-node-modules | ||
| with: | ||
| path: | | ||
| ~/.npm | ||
| ./node_modules | ||
| # invalidate cache when any package-lock.json changes | ||
| key: ${{ runner.os }}-npm-test-x1-${{ hashFiles('**/package.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-npm-test-x1- | ||
| - name: install npm dependencies | ||
| # TODO remove legace peer deps once everything is up to date | ||
| run: npm install --legacy-peer-deps | ||
| - name: build | ||
| run: npm run build | ||
| - name: test:node | ||
| run: npm run test:node | ||
| - name: test:browser | ||
| uses: GabrielBB/xvfb-action@v1 | ||
| with: | ||
| run: npm run test:browser | ||
| - name: lint | ||
| run: npm run lint |
| { | ||
| "extends": [ | ||
| "config:base" | ||
| ], | ||
| "statusCheckVerify": true, | ||
| "ignoreDeps": [], | ||
| "automerge": true, | ||
| "major": { | ||
| "automerge": true | ||
| }, | ||
| "ignorePaths": [], | ||
| "rebaseStalePrs": true, | ||
| "prHourlyLimit": 2, | ||
| "prCreation": "not-pending", | ||
| "dependencyDashboard": false | ||
| } |
+28
-17
@@ -16,26 +16,37 @@ import wait from './wait'; | ||
| if (timeout !== 0) wait(timeout).then(function () { | ||
| return timedOut = true; | ||
| }); | ||
| if (timeout !== 0) { | ||
| wait(timeout).then(function () { | ||
| return timedOut = true; | ||
| }); | ||
| } | ||
| return new Promise(function (resolve, reject) { | ||
| var runLoop = function runLoop() { | ||
| /** | ||
| * @recursive | ||
| * @return {Promise<void>} | ||
| */ | ||
| function runLoopOnce() { | ||
| if (ok) { | ||
| resolve(); | ||
| return; | ||
| } | ||
| if (timedOut) { | ||
| } else if (timedOut) { | ||
| reject(new Error('AsyncTestUtil.waitUntil(): reached timeout of ' + timeout + 'ms')); | ||
| return; | ||
| } else { | ||
| return wait(interval).then(function () { | ||
| return promisify(fun()); | ||
| }) | ||
| /** | ||
| * Propagate errors of the fun function | ||
| * upwards. | ||
| */ | ||
| ['catch'](function (err) { | ||
| return reject(err); | ||
| }).then(function (value) { | ||
| ok = value; | ||
| return runLoopOnce(); | ||
| }); | ||
| } | ||
| wait(interval).then(function () { | ||
| var value = promisify(fun()); | ||
| value.then(function (val) { | ||
| ok = val; | ||
| runLoop(); | ||
| }); | ||
| }); | ||
| }; | ||
| runLoop(); | ||
| } | ||
| runLoopOnce(); | ||
| }); | ||
| } |
+28
-17
@@ -30,26 +30,37 @@ 'use strict'; | ||
| if (timeout !== 0) (0, _wait2['default'])(timeout).then(function () { | ||
| return timedOut = true; | ||
| }); | ||
| if (timeout !== 0) { | ||
| (0, _wait2['default'])(timeout).then(function () { | ||
| return timedOut = true; | ||
| }); | ||
| } | ||
| return new Promise(function (resolve, reject) { | ||
| var runLoop = function runLoop() { | ||
| /** | ||
| * @recursive | ||
| * @return {Promise<void>} | ||
| */ | ||
| function runLoopOnce() { | ||
| if (ok) { | ||
| resolve(); | ||
| return; | ||
| } | ||
| if (timedOut) { | ||
| } else if (timedOut) { | ||
| reject(new Error('AsyncTestUtil.waitUntil(): reached timeout of ' + timeout + 'ms')); | ||
| return; | ||
| } else { | ||
| return (0, _wait2['default'])(interval).then(function () { | ||
| return (0, _promisify2['default'])(fun()); | ||
| }) | ||
| /** | ||
| * Propagate errors of the fun function | ||
| * upwards. | ||
| */ | ||
| ['catch'](function (err) { | ||
| return reject(err); | ||
| }).then(function (value) { | ||
| ok = value; | ||
| return runLoopOnce(); | ||
| }); | ||
| } | ||
| (0, _wait2['default'])(interval).then(function () { | ||
| var value = (0, _promisify2['default'])(fun()); | ||
| value.then(function (val) { | ||
| ok = val; | ||
| runLoop(); | ||
| }); | ||
| }); | ||
| }; | ||
| runLoop(); | ||
| } | ||
| runLoopOnce(); | ||
| }); | ||
| } |
+1
-1
| { | ||
| "name": "async-test-util", | ||
| "version": "1.7.3", | ||
| "version": "2.0.0", | ||
| "description": "Util-functions that are be useful in async tests", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
+1
-1
@@ -117,3 +117,3 @@ # async-test-util | ||
| Async-Form of [assert.throws](https://nodejs.org/api/assert.html#assert_assert_throws_block_error_message). Asserts that the given function throws with the defined error, throws if not. | ||
| Async-Form of [assert.throws](https://nodejs.org/api/assert.html#assert_assert_throws_fn_error_message). Asserts that the given function throws with the defined error, throws if not. | ||
@@ -120,0 +120,0 @@ ```javascript |
+24
-15
@@ -13,25 +13,34 @@ import wait from './wait'; | ||
| if (timeout !== 0) | ||
| if (timeout !== 0) { | ||
| wait(timeout).then(() => timedOut = true); | ||
| } | ||
| return new Promise((resolve, reject) => { | ||
| const runLoop = () => { | ||
| /** | ||
| * @recursive | ||
| * @return {Promise<void>} | ||
| */ | ||
| function runLoopOnce() { | ||
| if (ok) { | ||
| resolve(); | ||
| return; | ||
| } | ||
| if (timedOut) { | ||
| } else if (timedOut) { | ||
| reject(new Error('AsyncTestUtil.waitUntil(): reached timeout of ' + timeout + 'ms')); | ||
| return; | ||
| } else { | ||
| return wait(interval) | ||
| .then(() => promisify(fun())) | ||
| /** | ||
| * Propagate errors of the fun function | ||
| * upwards. | ||
| */ | ||
| .catch(err => reject(err)) | ||
| .then(value => { | ||
| ok = value; | ||
| return runLoopOnce(); | ||
| }); | ||
| } | ||
| wait(interval).then(() => { | ||
| const value = promisify(fun()); | ||
| value.then(val => { | ||
| ok = val; | ||
| runLoop(); | ||
| }); | ||
| }); | ||
| }; | ||
| runLoop(); | ||
| } | ||
| runLoopOnce(); | ||
| }); | ||
| } |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
62416
3.93%61
3.39%1199
3.72%