Skip to content

Commit

Permalink
fix:test for node 8.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kamerk22 committed Mar 21, 2019
1 parent 04443df commit 9748ff1
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ node_js:
- node
- 8.0.0
sudo: false
cache:
directories:
- node_modules
install:
- npm install
after_script:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Create secured URLs with a limited lifetime in AdonisJs
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Build Status](https://www.travis-ci.org/kamerk22/adonis-url-signer.svg?branch=master)](https://www.travis-ci.org/kamerk22/adonis-url-signer)
<br/>

This library allows you to easily create "signed" URLs. These URLs have a "signature" hash appended as query string so we can easily verify that it's not manipulated.
Expand Down
29 changes: 29 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict'

/**
*
* adonis-url-signer
* Copyright(c) Kashyap Merai <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source co
*
*/

const semver = require('semver')
const { spawn } = require('child_process')
const spawnArgs = []

if (semver.lt(process.version, '8.0.0')) {
spawnArgs.push('--harmony-async-await')
}

function test () {
spawnArgs.push('japaFile.js')
const tests = spawn('node', spawnArgs)
tests.stdout.on('data', (data) => process.stdout.write(data))
tests.stderr.on('data', (data) => process.stderr.write(data))
tests.on('close', (code) => process.exit(code))
}

test()
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@
"lint": "standard",
"lint:fix": "standard --fix",
"lint-staged": "npm run test:win && lint-staged",
"test:local": "NO_ANSI=false FORCE_COLOR=true nyc node japaFile",
"test:win": "set NO_ANSI=false && set FORCE_COLOR=true && nyc node japaFile",
"test:local": "NO_ANSI=false FORCE_COLOR=true nyc node bin/index.js",
"test:win": "set NO_ANSI=false && set FORCE_COLOR=true && nyc node bin/index.js",
"test": "npm run test:local",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"devDependencies": {
"@adonisjs/fold": "^4.0.9",
"@adonisjs/framework": "^5.0.13",
"@adonisjs/sink": "^1.0.17",
"child_process": "^1.0.2",
"coveralls": "^3.0.3",
"husky": "^1.3.1",
"japa": "^2.0.7",
"lint-staged": "^8.1.5",
"nyc": "^13.3.0",
"semver": "^5.6.0",
"standard": "^12.0.1"
},
"nyc": {
Expand Down
1 change: 0 additions & 1 deletion src/UrlSigner.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class UrlSigner {
* The _sortObject method sort all query params
* and join them.
*
*
* @private
* @method _sortObject
* @param {Object} query - URL query string to sort
Expand Down
1 change: 0 additions & 1 deletion test/unit/urlSigner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ test.group('UrlSigner', group => {
test('should return valid expiry time', assert => {
const urlSigner = use('UrlSigner')
let u = Url.parse(urlSigner.temporarySign(URL, 1), true)
console.log(u.format())
let now = Math.round(Date.now() / 1000)
assert.isTrue(u.query[urlSignerConfig.options.expires] > now)
assert.isTrue(u.query[urlSignerConfig.options.expires] <= now + 60 * 60)
Expand Down

0 comments on commit 9748ff1

Please sign in to comment.