mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-14 23:50:06 +00:00
Merge pull request #622 from sasjs/update-dependencies
chore: update dependencies
This commit is contained in:
@@ -127,7 +127,7 @@ module.exports = {
|
|||||||
setupFiles: [],
|
setupFiles: [],
|
||||||
|
|
||||||
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
||||||
setupFilesAfterEnv: ['jest-extended'],
|
setupFilesAfterEnv: ['jest-extended/all'],
|
||||||
|
|
||||||
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
||||||
// snapshotSerializers: [],
|
// snapshotSerializers: [],
|
||||||
|
|||||||
6258
package-lock.json
generated
6258
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -51,31 +51,31 @@
|
|||||||
"cp": "0.2.0",
|
"cp": "0.2.0",
|
||||||
"dotenv": "10.0.0",
|
"dotenv": "10.0.0",
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
"jest": "27.2.0",
|
"jest": "27.4.7",
|
||||||
"jest-extended": "0.11.5",
|
"jest-extended": "2.0.0",
|
||||||
"node-polyfill-webpack-plugin": "1.1.4",
|
"node-polyfill-webpack-plugin": "1.1.4",
|
||||||
"path": "0.12.7",
|
"path": "0.12.7",
|
||||||
"pem": "1.14.4",
|
"pem": "1.14.4",
|
||||||
"process": "0.11.10",
|
"process": "0.11.10",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"semantic-release": "18.0.0",
|
"semantic-release": "18.0.0",
|
||||||
"terser-webpack-plugin": "5.2.4",
|
"terser-webpack-plugin": "5.3.0",
|
||||||
"ts-jest": "27.0.3",
|
"ts-jest": "27.1.3",
|
||||||
"ts-loader": "9.2.6",
|
"ts-loader": "9.2.6",
|
||||||
"tslint": "6.1.3",
|
"tslint": "6.1.3",
|
||||||
"tslint-config-prettier": "1.18.0",
|
"tslint-config-prettier": "1.18.0",
|
||||||
"typedoc": "0.19.2",
|
"typedoc": "0.22.11",
|
||||||
"typedoc-neo-theme": "1.1.1",
|
"typedoc-neo-theme": "1.1.1",
|
||||||
"typedoc-plugin-external-module-name": "4.0.6",
|
"typedoc-plugin-external-module-name": "4.0.6",
|
||||||
"typescript": "4.3.5",
|
"typescript": "4.5.4",
|
||||||
"webpack": "5.56.0",
|
"webpack": "5.66.0",
|
||||||
"webpack-cli": "4.7.2"
|
"webpack-cli": "4.7.2"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sasjs/utils": "2.32.0",
|
"@sasjs/utils": "2.35.0",
|
||||||
"axios": "0.25.0",
|
"axios": "0.25.0",
|
||||||
"axios-cookiejar-support": "1.0.1",
|
"axios-cookiejar-support": "2.0.3",
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
"https": "1.0.0",
|
"https": "1.0.0",
|
||||||
"tough-cookie": "4.0.0"
|
"tough-cookie": "4.0.0"
|
||||||
|
|||||||
@@ -272,7 +272,13 @@ export async function executeScript(
|
|||||||
|
|
||||||
return { result: jobResult?.result, log }
|
return { result: jobResult?.result, log }
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e && e.status === 404) {
|
interface HttpError {
|
||||||
|
status: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const error = e as HttpError
|
||||||
|
|
||||||
|
if (error.status === 404) {
|
||||||
return executeScript(
|
return executeScript(
|
||||||
requestClient,
|
requestClient,
|
||||||
sessionManager,
|
sessionManager,
|
||||||
@@ -287,7 +293,7 @@ export async function executeScript(
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
throw prefixMessage(e, 'Error while executing script. ')
|
throw prefixMessage(e as Error, 'Error while executing script. ')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,34 @@
|
|||||||
import { WriteStream } from '../../../types'
|
import { WriteStream } from '../../../types'
|
||||||
import { writeStream } from '../writeStream'
|
import { writeStream } from '../writeStream'
|
||||||
import 'jest-extended'
|
import {
|
||||||
|
createWriteStream,
|
||||||
|
fileExists,
|
||||||
|
readFile,
|
||||||
|
deleteFile
|
||||||
|
} from '@sasjs/utils'
|
||||||
|
|
||||||
describe('writeStream', () => {
|
describe('writeStream', () => {
|
||||||
const stream: WriteStream = {
|
const filename = 'test.txt'
|
||||||
write: jest.fn(),
|
const content = 'test'
|
||||||
path: 'test'
|
let stream: WriteStream
|
||||||
}
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
stream = await createWriteStream(filename)
|
||||||
|
})
|
||||||
|
|
||||||
it('should resolve when the stream is written successfully', async () => {
|
it('should resolve when the stream is written successfully', async () => {
|
||||||
expect(writeStream(stream, 'test')).toResolve()
|
await expect(writeStream(stream, content)).toResolve()
|
||||||
|
await expect(fileExists(filename)).resolves.toEqual(true)
|
||||||
|
await expect(readFile(filename)).resolves.toEqual(content + '\n')
|
||||||
|
|
||||||
expect(stream.write).toHaveBeenCalledWith('test\n', expect.anything())
|
await deleteFile(filename)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reject when the write errors out', async () => {
|
it('should reject when the write errors out', async () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(stream, 'write')
|
.spyOn(stream, 'write')
|
||||||
.mockImplementation((_, callback) => callback(new Error('Test Error')))
|
.mockImplementation((_, callback) => callback(new Error('Test Error')))
|
||||||
const error = await writeStream(stream, 'test').catch((e) => e)
|
const error = await writeStream(stream, content).catch((e) => e)
|
||||||
|
|
||||||
expect(error.message).toEqual('Test Error')
|
expect(error.message).toEqual('Test Error')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,13 +3,9 @@ import { WriteStream } from '../../types'
|
|||||||
export const writeStream = async (
|
export const writeStream = async (
|
||||||
stream: WriteStream,
|
stream: WriteStream,
|
||||||
content: string
|
content: string
|
||||||
): Promise<void> => {
|
): Promise<void> =>
|
||||||
return new Promise((resolve, reject) => {
|
stream.write(content + '\n', (e) => {
|
||||||
stream.write(content + '\n', (e) => {
|
if (e) return Promise.reject(e)
|
||||||
if (e) {
|
|
||||||
return reject(e)
|
return Promise.resolve()
|
||||||
}
|
|
||||||
return resolve()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as https from 'https'
|
import * as https from 'https'
|
||||||
import { AxiosRequestConfig } from 'axios'
|
import { AxiosRequestConfig } from 'axios'
|
||||||
import axiosCookieJarSupport from 'axios-cookiejar-support'
|
import * as axiosCookieJarSupport from 'axios-cookiejar-support'
|
||||||
import * as tough from 'tough-cookie'
|
import * as tough from 'tough-cookie'
|
||||||
import { prefixMessage } from '@sasjs/utils/error'
|
import { prefixMessage } from '@sasjs/utils/error'
|
||||||
import { RequestClient, throwIfError } from './RequestClient'
|
import { RequestClient, throwIfError } from './RequestClient'
|
||||||
@@ -17,7 +17,7 @@ export class Sas9RequestClient extends RequestClient {
|
|||||||
status >= 200 && status < 303
|
status >= 200 && status < 303
|
||||||
|
|
||||||
if (axiosCookieJarSupport) {
|
if (axiosCookieJarSupport) {
|
||||||
axiosCookieJarSupport(this.httpClient)
|
axiosCookieJarSupport.wrapper(this.httpClient)
|
||||||
this.httpClient.defaults.jar = new tough.CookieJar()
|
this.httpClient.defaults.jar = new tough.CookieJar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ describe('ContextManager', () => {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
editError = error
|
editError = error as Error
|
||||||
}
|
}
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
@@ -542,7 +542,7 @@ describe('ContextManager', () => {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
deleteError = error
|
deleteError = error as Error
|
||||||
}
|
}
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
|
|||||||
1
src/types/system/global.d.ts
vendored
Normal file
1
src/types/system/global.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import 'jest-extended'
|
||||||
@@ -6,7 +6,8 @@
|
|||||||
"declaration": true,
|
"declaration": true,
|
||||||
"outDir": "./build",
|
"outDir": "./build",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"sourceMap": true
|
"sourceMap": true,
|
||||||
|
"typeRoots": ["./node_modules/@types", "./src/types/system"]
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
|
|||||||
Reference in New Issue
Block a user