balena-request
Advanced tools
Comparing version 13.0.1-build-bump-balena-lint-8c4b0575e8c803072f4b9c9c61b5bc9e9d9ff3c3-1 to 13.0.1-build-bump-balena-lint-b61251c20b0e09ca8db76e18f426906d4f2e35c7-1
@@ -9,12 +9,4 @@ module.exports = { | ||
env: { | ||
jest: true | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["*.js"], | ||
rules: { | ||
"@typescript-eslint/no-var-requires": "off" | ||
} | ||
} | ||
] | ||
mocha: true | ||
} | ||
} |
@@ -7,3 +7,3 @@ # Change Log | ||
## 13.0.1 - 2023-10-17 | ||
## 13.0.1 - 2023-10-18 | ||
@@ -10,0 +10,0 @@ * Update @balena/lint to 7.2.0 Update @balena/lint from 5.4.1 to 7.2.0 [Otávio Jacobi] |
@@ -21,2 +21,11 @@ const getKarmaConfig = require('balena-config-karma'); | ||
}; | ||
karmaConfig.files = [ | ||
'tests/**/*.spec.js' | ||
]; | ||
karmaConfig.webpack.module.rules.push({ | ||
test: /\.m?js/, | ||
resolve: { | ||
fullySpecified: false, | ||
}, | ||
}); | ||
karmaConfig.webpack.plugins = [ | ||
@@ -23,0 +32,0 @@ new getKarmaConfig.webpack.ProvidePlugin({ |
{ | ||
"name": "balena-request", | ||
"version": "13.0.1-build-bump-balena-lint-8c4b0575e8c803072f4b9c9c61b5bc9e9d9ff3c3-1", | ||
"version": "13.0.1-build-bump-balena-lint-b61251c20b0e09ca8db76e18f426906d4f2e35c7-1", | ||
"description": "Balena HTTP client", | ||
@@ -24,8 +24,8 @@ "main": "build/request.js", | ||
"scripts": { | ||
"lint": "balena-lint -e ts --typescript -e js lib tests", | ||
"lint-fix": "balena-lint -e ts --typescript -e js --fix lib tests", | ||
"lint": "balena-lint -e js -e ts lib tests", | ||
"lint-fix": "balena-lint -e js -e ts --fix lib tests", | ||
"pretest": "npm run build", | ||
"test": "npm run test-node && npm run test-browser", | ||
"posttest": "npm run lint", | ||
"test-node": "mocha --reporter spec tests/**/*.spec.js", | ||
"test-node": "mocha -r ts-node/register/transpile-only --reporter spec tests/**/*.spec.js", | ||
"test-browser": "mockttp -c karma start", | ||
@@ -56,3 +56,3 @@ "build": "npx tsc", | ||
"jsdoc-to-markdown": "^6.0.1", | ||
"karma": "^5.0.9", | ||
"karma": "^6.3.17", | ||
"mocha": "^10.0.0", | ||
@@ -64,6 +64,7 @@ "mockttp": "^3.8.0", | ||
"rindle": "^1.3.6", | ||
"sinon": "^13.0.1", | ||
"sinon": "^15.0.1", | ||
"stream-browserify": "^3.0.0", | ||
"temp": "^0.8.4", | ||
"timekeeper": "^1.0.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6", | ||
@@ -86,4 +87,4 @@ "util": "^0.12.4" | ||
"versionist": { | ||
"publishedAt": "2023-10-17T23:38:23.423Z" | ||
"publishedAt": "2023-10-18T16:12:13.629Z" | ||
} | ||
} |
@@ -1,10 +0,13 @@ | ||
const { expect } = require('chai'); | ||
const rindle = require('rindle'); | ||
const sinon = require('sinon'); | ||
const johnDoeFixture = require('./tokens.json').johndoe; | ||
const utils = require('../build/utils'); | ||
import { expect } from 'chai'; | ||
import setup from './setup'; | ||
import * as rindle from 'rindle'; | ||
import * as sinon from 'sinon'; | ||
import * as mockhttp from 'mockttp'; | ||
import * as tokens from './tokens.json'; | ||
import * as utils from '../build/utils'; | ||
const mockServer = require('mockttp').getLocal(); | ||
const johnDoeFixture = tokens.johndoe; | ||
const mockServer = mockhttp.getLocal(); | ||
const { auth, request } = require('./setup')(); | ||
const { auth, request } = setup(); | ||
@@ -11,0 +14,0 @@ describe('Request (api key):', function () { |
@@ -1,10 +0,12 @@ | ||
const { expect } = require('chai'); | ||
const rindle = require('rindle'); | ||
const sinon = require('sinon'); | ||
const Bluebird = require('bluebird'); | ||
const mockServer = require('mockttp').getLocal(); | ||
import { expect } from 'chai'; | ||
import setup from './setup'; | ||
import * as Bluebird from 'bluebird'; | ||
import * as rindle from 'rindle'; | ||
import * as sinon from 'sinon'; | ||
import * as mockhttp from 'mockttp'; | ||
import * as utils from '../build/utils'; | ||
const utils = require('../build/utils'); | ||
const mockServer = mockhttp.getLocal(); | ||
const { auth, request } = require('./setup')(); | ||
const { auth, request } = setup(); | ||
@@ -11,0 +13,0 @@ describe('An interceptor', function () { |
@@ -1,7 +0,9 @@ | ||
const { expect } = require('chai'); | ||
const sinon = require('sinon'); | ||
import { expect } from 'chai'; | ||
import setup from './setup'; | ||
import * as sinon from 'sinon'; | ||
import * as mockhttp from 'mockttp'; | ||
const mockServer = require('mockttp').getLocal(); | ||
const mockServer = mockhttp.getLocal(); | ||
const { auth, request, getCustomRequest } = require('./setup')(); | ||
const { auth, request, getCustomRequest } = setup(); | ||
@@ -8,0 +10,0 @@ // Grab setTimeout before we replace it with a fake later, so |
@@ -1,7 +0,9 @@ | ||
const { expect } = require('chai'); | ||
const errors = require('balena-errors'); | ||
import { expect } from 'chai'; | ||
import setup from './setup'; | ||
import * as errors from 'balena-errors'; | ||
import * as mockhttp from 'mockttp'; | ||
const mockServer = require('mockttp').getLocal(); | ||
const mockServer = mockhttp.getLocal(); | ||
const { auth, request, IS_BROWSER } = require('./setup')(); | ||
const { auth, request, IS_BROWSER } = setup(); | ||
@@ -8,0 +10,0 @@ const RESPONSE_BODY = { from: 'foobar' }; |
@@ -5,2 +5,3 @@ const IS_BROWSER = typeof window !== 'undefined' && window !== null; | ||
if (!IS_BROWSER) { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
const temp = require('temp').track(); | ||
@@ -10,3 +11,3 @@ dataDirectoryPath = temp.mkdirSync(); | ||
const BalenaAuth = require('balena-auth')['default']; | ||
import BalenaAuth from 'balena-auth'; | ||
@@ -19,7 +20,7 @@ const auth = new BalenaAuth({ | ||
// Make sure any existing tokens are removed before the tests start | ||
auth.removeKey(); | ||
void auth.removeKey(); | ||
const { getRequest } = require('../build/request'); | ||
const chai = require('chai'); | ||
const chaiAsPromised = require('chai-as-promised'); | ||
import { getRequest } from '../build/request'; | ||
import * as chai from 'chai'; | ||
import * as chaiAsPromised from 'chai-as-promised'; | ||
chai.use(chaiAsPromised); | ||
@@ -32,3 +33,3 @@ | ||
module.exports = () => ({ | ||
export default () => ({ | ||
IS_BROWSER, | ||
@@ -35,0 +36,0 @@ auth, |
@@ -1,13 +0,14 @@ | ||
const Bluebird = require('bluebird'); | ||
const { expect } = require('chai'); | ||
const zlib = require('browserify-zlib'); | ||
const { PassThrough } = require('stream'); | ||
const rindle = require('rindle'); | ||
import { PassThrough } from 'stream'; | ||
import { expect } from 'chai'; | ||
import setup from './setup'; | ||
import * as Bluebird from 'bluebird'; | ||
import * as rindle from 'rindle'; | ||
import * as zlib from 'browserify-zlib'; | ||
import * as mockhttp from 'mockttp'; | ||
const mockServer = mockhttp.getLocal(); | ||
const { auth, request } = setup(); | ||
const gzip = Bluebird.promisify(zlib.gzip); | ||
const mockServer = require('mockttp').getLocal(); | ||
const { auth, request } = require('./setup')(); | ||
describe('Request (stream):', function () { | ||
@@ -14,0 +15,0 @@ beforeEach(() => Promise.all([auth.removeKey(), mockServer.start()])); |
@@ -1,14 +0,16 @@ | ||
const { expect } = require('chai'); | ||
const sinon = require('sinon'); | ||
const errors = require('balena-errors'); | ||
const rindle = require('rindle'); | ||
const tokens = require('./tokens.json'); | ||
import { expect } from 'chai'; | ||
import setup from './setup'; | ||
import * as rindle from 'rindle'; | ||
import * as sinon from 'sinon'; | ||
import * as errors from 'balena-errors'; | ||
import * as mockhttp from 'mockttp'; | ||
import * as tokens from './tokens.json'; | ||
import * as utils from '../build/utils'; | ||
const johnDoeFixture = tokens.johndoe; | ||
const janeDoeFixture = tokens.janedoe; | ||
const utils = require('../build/utils'); | ||
const mockServer = require('mockttp').getLocal(); | ||
const mockServer = mockhttp.getLocal(); | ||
const { auth, request } = require('./setup')(); | ||
const { auth, request } = setup(); | ||
@@ -294,4 +296,4 @@ describe('Request (token):', function () { | ||
describe('given a working /user/v1/refresh-token endpoint', function () { | ||
beforeEach(function () { | ||
auth.setKey(johnDoeFixture.token); | ||
beforeEach(async function () { | ||
await auth.setKey(johnDoeFixture.token); | ||
return mockServer | ||
@@ -298,0 +300,0 @@ .forGet('/user/v1/refresh-token') |
@@ -1,11 +0,13 @@ | ||
const { Headers } = require('fetch-ponyfill')({ Promise }); | ||
const { expect } = require('chai'); | ||
const sinon = require('sinon'); | ||
const johnDoeFixture = require('./tokens.json').johndoe; | ||
const utils = require('../build/utils'); | ||
import { expect } from 'chai'; | ||
import { TokenType } from 'balena-auth/build/token'; | ||
import setup from './setup'; | ||
import * as fetchPonyfill from 'fetch-ponyfill'; | ||
import * as sinon from 'sinon'; | ||
import * as tokens from './tokens.json'; | ||
import * as utils from '../build/utils'; | ||
const { TokenType } = require('balena-auth/build/token'); | ||
const { Headers } = fetchPonyfill({ Promise }); | ||
const { auth } = setup(); | ||
const johnDoeFixture = tokens.johndoe; | ||
const { auth } = require('./setup')(); | ||
describe('Utils:', function () { | ||
@@ -12,0 +14,0 @@ describe('.shouldRefreshKey()', function () { |
Sorry, the diff of this file is not supported yet
214527
4097
30