mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
chore(deps) updates (all but insomnia) to use @jest/globals (#4793)
This commit is contained in:
parent
fa02c76afa
commit
6e5476de70
3510
packages/insomnia-cookies/package-lock.json
generated
3510
packages/insomnia-cookies/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,9 @@
|
||||
"build": "tsc --build tsconfig.build.json",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^28.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"tough-cookie": "^2.3.3"
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it, jest } from '@jest/globals';
|
||||
import { Cookie, CookieJar, CookieSerialized } from 'tough-cookie';
|
||||
|
||||
import { cookiesFromJar, jarFromCookies } from './cookies';
|
||||
|
@ -1,9 +1,4 @@
|
||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||
module.exports = {
|
||||
preset: '../../jest-preset.js',
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
isolatedModules: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
3412
packages/insomnia-importers/package-lock.json
generated
3412
packages/insomnia-importers/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -37,6 +37,7 @@
|
||||
"yaml": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^28.1.0",
|
||||
"@types/ramda": "^0.27.44",
|
||||
"@types/shell-quote": "^1.7.0",
|
||||
"@types/yaml": "^1.9.7",
|
||||
|
@ -1,3 +1,6 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import { fail } from 'assert';
|
||||
|
||||
import { convert } from './convert';
|
||||
|
||||
describe('Import errors', () => {
|
||||
|
@ -2,18 +2,20 @@ import { ImportRequest } from './entities';
|
||||
import { importers } from './importers';
|
||||
import { setDefaults } from './utils';
|
||||
|
||||
export interface RootConverter {
|
||||
type: {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
};
|
||||
export interface ConvertResultType {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface ConvertResult<T = {}> {
|
||||
type: ConvertResultType;
|
||||
data: {
|
||||
_type: 'export';
|
||||
__export_format: 4;
|
||||
__export_date: string;
|
||||
__export_source: `insomnia.importers:v${string}`;
|
||||
resources: ImportRequest;
|
||||
resources: ImportRequest<T>[];
|
||||
};
|
||||
}
|
||||
|
||||
@ -29,7 +31,7 @@ export const convert = async (rawData: string) => {
|
||||
resources[0].environment = resources[0].variable;
|
||||
}
|
||||
|
||||
return {
|
||||
const convertedResult: ConvertResult = {
|
||||
type: {
|
||||
id: importer.id,
|
||||
name: importer.name,
|
||||
@ -40,9 +42,11 @@ export const convert = async (rawData: string) => {
|
||||
__export_format: 4,
|
||||
__export_date: new Date().toISOString(),
|
||||
__export_source: 'insomnia.importers:v0.1.0',
|
||||
resources: resources.map(setDefaults),
|
||||
resources: resources.map(setDefaults) as ImportRequest[],
|
||||
},
|
||||
};
|
||||
|
||||
return convertedResult;
|
||||
}
|
||||
|
||||
throw new Error('No importers found for file');
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@ -39,11 +40,11 @@ describe('Fixtures', () => {
|
||||
|
||||
const ids = new Set();
|
||||
for (const resource of results.data.resources) {
|
||||
if (ids.has(resource._id)) {
|
||||
if (ids.has(resource?._id)) {
|
||||
const json = JSON.stringify(resource, null, '\t');
|
||||
throw new Error(`Export contained multiple duplicate IDs: ${json}`);
|
||||
}
|
||||
ids.add(resource._id);
|
||||
ids.add(resource?._id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import { ImportPostman } from './postman';
|
||||
import { HttpsSchemaGetpostmanComJsonCollectionV210, Request1 } from './postman-2.1.types';
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
export { convert, RootConverter } from './convert';
|
||||
export { convert, ConvertResult, ConvertResultType } from './convert';
|
||||
export * from './importers';
|
||||
export { ImportRequest, Converter, Importer } from './entities';
|
||||
|
@ -1,9 +1,12 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import { setDefaults, unthrowableParseJson } from './utils';
|
||||
|
||||
describe('setDefaults()', () => {
|
||||
it('should leave non-objects alone', () => {
|
||||
expect(setDefaults(null)).toBe(null);
|
||||
});
|
||||
|
||||
it('should leave unrecognized types alone', () => {
|
||||
const obj = {
|
||||
_type: 'weird',
|
||||
@ -11,6 +14,7 @@ describe('setDefaults()', () => {
|
||||
// @ts-expect-error -- this is an intentionally unrecognized `_type`
|
||||
expect(setDefaults(obj)).toBe(obj);
|
||||
});
|
||||
|
||||
it('should set correct request defaults', () => {
|
||||
expect(
|
||||
setDefaults({
|
||||
@ -28,6 +32,7 @@ describe('setDefaults()', () => {
|
||||
authentication: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('should set correct request_group defaults', () => {
|
||||
expect(
|
||||
setDefaults({
|
||||
@ -40,6 +45,7 @@ describe('setDefaults()', () => {
|
||||
environment: {},
|
||||
});
|
||||
});
|
||||
|
||||
it('should set correct environment defaults', () => {
|
||||
expect(
|
||||
setDefaults({
|
||||
@ -52,6 +58,7 @@ describe('setDefaults()', () => {
|
||||
data: {},
|
||||
});
|
||||
});
|
||||
|
||||
describe('unthrowableParseJson', () => {
|
||||
it('should parse happy json', () => {
|
||||
const json = '{"foo": "bar"}';
|
||||
@ -60,6 +67,7 @@ describe('setDefaults()', () => {
|
||||
foo: 'bar',
|
||||
});
|
||||
});
|
||||
|
||||
it('should quietly fail on bad json', () => {
|
||||
expect(() => {
|
||||
const json = '{"foo": "bar';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ImportRequest } from './entities';
|
||||
|
||||
export const setDefaults = (obj: ImportRequest) => {
|
||||
export const setDefaults = (obj: ImportRequest | null) => {
|
||||
if (!obj || !obj._type) {
|
||||
return obj;
|
||||
}
|
||||
|
2
packages/insomnia-inso/package-lock.json
generated
2
packages/insomnia-inso/package-lock.json
generated
@ -29,6 +29,7 @@
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
|
||||
"@babel/preset-env": "^7.10.2",
|
||||
"@jest/globals": "^28.1.0",
|
||||
"@types/babel__core": "^7.1.12",
|
||||
"@types/babel__preset-env": "^7.9.1",
|
||||
"@types/mkdirp": "^1.0.1",
|
||||
@ -41,6 +42,7 @@
|
||||
"execa": "^5.0.0",
|
||||
"get-bin-path": "^5.1.0",
|
||||
"jest": "^28.1.0",
|
||||
"jest-mock": "^28.0.2",
|
||||
"node-loader": "1.0.2",
|
||||
"pkg": "^5.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
|
@ -43,6 +43,7 @@
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
|
||||
"@babel/preset-env": "^7.10.2",
|
||||
"@jest/globals": "^28.1.0",
|
||||
"@types/babel__core": "^7.1.12",
|
||||
"@types/babel__preset-env": "^7.9.1",
|
||||
"@types/mkdirp": "^1.0.1",
|
||||
@ -55,6 +56,7 @@
|
||||
"execa": "^5.0.0",
|
||||
"get-bin-path": "^5.1.0",
|
||||
"jest": "^28.1.0",
|
||||
"jest-mock": "^28.0.2",
|
||||
"node-loader": "1.0.2",
|
||||
"pkg": "^5.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import { MockedFunction } from 'jest-mock';
|
||||
import { parseArgsStringToArgv } from 'string-argv';
|
||||
|
||||
import * as packageJson from '../package.json';
|
||||
@ -24,11 +26,11 @@ const initInso = () => {
|
||||
};
|
||||
};
|
||||
|
||||
const generateConfig = _generateConfig as jest.MockedFunction<typeof _generateConfig>;
|
||||
const lintSpecification = _lintSpecification as jest.MockedFunction<typeof _lintSpecification>;
|
||||
const runInsomniaTests = _runInsomniaTests as jest.MockedFunction<typeof _runInsomniaTests>;
|
||||
const exportSpecification = _exportSpecification as jest.MockedFunction<typeof _exportSpecification>;
|
||||
const exit = _exit as jest.MockedFunction<typeof _exit>;
|
||||
const generateConfig = _generateConfig as MockedFunction<typeof _generateConfig>;
|
||||
const lintSpecification = _lintSpecification as MockedFunction<typeof _lintSpecification>;
|
||||
const runInsomniaTests = _runInsomniaTests as MockedFunction<typeof _runInsomniaTests>;
|
||||
const exportSpecification = _exportSpecification as MockedFunction<typeof _exportSpecification>;
|
||||
const exit = _exit as MockedFunction<typeof _exit>;
|
||||
|
||||
describe('cli', () => {
|
||||
beforeAll(() => {
|
||||
|
@ -1,3 +1,6 @@
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import { MockedFunction } from 'jest-mock';
|
||||
|
||||
import { globalBeforeAll, globalBeforeEach } from '../jest/before';
|
||||
import { logger } from '../logger';
|
||||
import { writeFileWithCliOptions as _writeFileWithCliOptions } from '../write-file';
|
||||
@ -5,7 +8,7 @@ import { exportSpecification } from './export-specification';
|
||||
|
||||
jest.mock('../write-file');
|
||||
|
||||
const writeFileWithCliOptions = _writeFileWithCliOptions as jest.MockedFunction<typeof _writeFileWithCliOptions>;
|
||||
const writeFileWithCliOptions = _writeFileWithCliOptions as MockedFunction<typeof _writeFileWithCliOptions>;
|
||||
|
||||
describe('exportSpecification()', () => {
|
||||
beforeAll(() => {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import { MockedFunction } from 'jest-mock';
|
||||
import { DeclarativeConfigResult, generate as _generate, generateFromString as _generateFromString, KongForKubernetesResult } from 'openapi-2-kong';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
@ -11,9 +13,9 @@ import { conversionTypeMap, generateConfig, GenerateConfigOptions } from './gene
|
||||
jest.mock('openapi-2-kong');
|
||||
jest.mock('../write-file');
|
||||
|
||||
const generate = _generate as jest.MockedFunction<typeof _generate>;
|
||||
const generateFromString = _generateFromString as jest.MockedFunction<typeof _generateFromString>;
|
||||
const writeFileWithCliOptions = _writeFileWithCliOptions as jest.MockedFunction<typeof _writeFileWithCliOptions>;
|
||||
const generate = _generate as MockedFunction<typeof _generate>;
|
||||
const generateFromString = _generateFromString as MockedFunction<typeof _generateFromString>;
|
||||
const writeFileWithCliOptions = _writeFileWithCliOptions as MockedFunction<typeof _writeFileWithCliOptions>;
|
||||
|
||||
const mockConversionResult: KongForKubernetesResult = {
|
||||
// @ts-expect-error -- TSCONVERSION the tests seem to suggest that this is valid, yet it is not allowed by the types.
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import path from 'path';
|
||||
|
||||
import { globalBeforeAll, globalBeforeEach } from '../jest/before';
|
||||
@ -8,28 +9,34 @@ describe('lint specification', () => {
|
||||
beforeAll(() => {
|
||||
globalBeforeAll();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
globalBeforeEach();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should return true for linting passed', async () => {
|
||||
const result = await lintSpecification('spc_46c5a4a40e83445a9bd9d9758b86c16c', {
|
||||
workingDir: 'src/db/fixtures/git-repo',
|
||||
});
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should lint specification from file with relative path', async () => {
|
||||
const result = await lintSpecification('openapi-spec.yaml', {
|
||||
workingDir: 'src/commands/fixtures',
|
||||
});
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should lint specification from file with relative path and no working directory', async () => {
|
||||
const result = await lintSpecification('src/commands/fixtures/openapi-spec.yaml', {});
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should lint specification from file with absolute path', async () => {
|
||||
const directory = path.join(process.cwd(), 'src/commands/fixtures');
|
||||
const result = await lintSpecification(path.join(directory, 'openapi-spec.yaml'), {
|
||||
@ -37,12 +44,14 @@ describe('lint specification', () => {
|
||||
});
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for linting failed', async () => {
|
||||
const result = await lintSpecification('spc_46c5a4a40e83445a9bd9d9758b86c16c', {
|
||||
workingDir: 'src/db/fixtures/git-repo-malformed-spec',
|
||||
});
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false if spec could not be found', async () => {
|
||||
const result = await lintSpecification('not-found', {});
|
||||
expect(result).toBe(false);
|
||||
@ -51,6 +60,7 @@ describe('lint specification', () => {
|
||||
|
||||
expect(logs.fatal).toContain('Failed to read "not-found"');
|
||||
});
|
||||
|
||||
it('should return false if spec was not specified', async () => {
|
||||
const result = await lintSpecification('', {});
|
||||
expect(result).toBe(false);
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import { generate as _generate, runTestsCli as _runTestsCli } from 'insomnia-testing';
|
||||
import { MockedFunction } from 'jest-mock';
|
||||
|
||||
import { globalBeforeAll, globalBeforeEach } from '../jest/before';
|
||||
import { logger } from '../logger';
|
||||
@ -8,8 +10,8 @@ import { runInsomniaTests, RunTestsOptions } from './run-tests';
|
||||
jest.mock('insomnia-testing');
|
||||
jest.mock('insomnia-send-request');
|
||||
|
||||
const generate = _generate as jest.MockedFunction<typeof _generate>;
|
||||
const runTestsCli = _runTestsCli as jest.MockedFunction<typeof _runTestsCli>;
|
||||
const generate = _generate as MockedFunction<typeof _generate>;
|
||||
const runTestsCli = _runTestsCli as MockedFunction<typeof _runTestsCli>;
|
||||
|
||||
describe('runInsomniaTests()', () => {
|
||||
beforeAll(() => {
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { afterAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import { getAppDataDir } from './data-directory';
|
||||
|
||||
jest.mock('os', () => ({
|
||||
...jest.requireActual<typeof os>('os'),
|
||||
...jest.requireActual('os') as unknown as typeof os,
|
||||
homedir: (): string => 'homedir',
|
||||
}));
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import path from 'path';
|
||||
|
||||
import gitAdapter from './git-adapter';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import path from 'path';
|
||||
|
||||
import insomniaAdapter from './insomnia-adapter';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import path from 'path';
|
||||
|
||||
import neDbAdapter from './ne-db-adapter';
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import { MockedFunction } from 'jest-mock';
|
||||
import path from 'path';
|
||||
|
||||
import { globalBeforeAll, globalBeforeEach } from '../jest/before';
|
||||
@ -11,9 +13,9 @@ jest.mock('./adapters/git-adapter');
|
||||
jest.mock('./adapters/ne-db-adapter');
|
||||
jest.mock('./adapters/insomnia-adapter');
|
||||
|
||||
const gitAdapter = _gitAdapter as jest.MockedFunction<typeof _gitAdapter>;
|
||||
const neDbAdapter = _neDbAdapter as jest.MockedFunction<typeof _neDbAdapter>;
|
||||
const insomniaAdapter = _insomniaAdapter as jest.MockedFunction<typeof _insomniaAdapter>;
|
||||
const gitAdapter = _gitAdapter as MockedFunction<typeof _gitAdapter>;
|
||||
const neDbAdapter = _neDbAdapter as MockedFunction<typeof _neDbAdapter>;
|
||||
const insomniaAdapter = _insomniaAdapter as MockedFunction<typeof _insomniaAdapter>;
|
||||
|
||||
describe('loadDb()', () => {
|
||||
beforeAll(() => {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it, jest } from '@jest/globals';
|
||||
import enquirer from 'enquirer';
|
||||
|
||||
import type { Database } from '../index';
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import _enquirer from 'enquirer';
|
||||
import { Mock, MockedClass } from 'jest-mock';
|
||||
|
||||
import { globalBeforeAll, globalBeforeEach } from '../../jest/before';
|
||||
import type { Database } from '../index';
|
||||
@ -8,10 +10,10 @@ import type { Environment, Workspace } from './types';
|
||||
import { generateIdIsh } from './util';
|
||||
|
||||
jest.mock('enquirer');
|
||||
const enquirer = _enquirer as jest.MockedClass<typeof _enquirer> & {
|
||||
const enquirer = _enquirer as MockedClass<typeof _enquirer> & {
|
||||
__mockPromptRun: (str: string) => void;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- missing types from enquirer
|
||||
__constructorMock: jest.Mock;
|
||||
__constructorMock: Mock;
|
||||
};
|
||||
|
||||
describe('Environment', () => {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
import enquirer from 'enquirer';
|
||||
|
||||
import type { Database } from '../index';
|
||||
@ -78,6 +79,7 @@ describe('Unit Test Suite', () => {
|
||||
expect(enquirer.__constructorMock.mock.calls[0][0]).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('loadTestSuites()', () => {
|
||||
it('should return empty array if no suites matched', () => {
|
||||
expect(loadTestSuites(db, 'not-found')).toHaveLength(0);
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { beforeEach, describe, expect, it } from '@jest/globals';
|
||||
|
||||
import type { Database } from '../index';
|
||||
import { emptyDb } from '../index';
|
||||
import type { Workspace } from './types';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it, jest } from '@jest/globals';
|
||||
import commander from 'commander';
|
||||
import path from 'path';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import execa from 'execa';
|
||||
import { getBinPathSync } from 'get-bin-path';
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { afterAll, describe, expect, it, jest } from '@jest/globals';
|
||||
|
||||
import { noConsoleLog } from './logger';
|
||||
describe('logger', () => {
|
||||
describe('noConsoleLog()', () => {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, jest } from '@jest/globals';
|
||||
|
||||
import * as packageJson from '../package.json';
|
||||
import { InsoError } from './errors';
|
||||
import { globalBeforeAll, globalBeforeEach } from './jest/before';
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { describe, expect, it, jest } from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import { Mock } from 'jest-mock';
|
||||
import mkdirp from 'mkdirp';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
@ -65,13 +67,13 @@ describe('writeFileWithCliOptions', () => {
|
||||
});
|
||||
it('should return an error if make directory fails', async () => {
|
||||
const error = new Error('mkdir sync error');
|
||||
(mkdirp.sync as jest.Mock).mockRejectedValue(error);
|
||||
(mkdirp.sync as Mock).mockRejectedValue(error);
|
||||
const promise = writeFileWithCliOptions('file.yaml', 'contents');
|
||||
await expect(promise).rejects.toThrow(new InsoError('Failed to write to "file.yaml"', error));
|
||||
});
|
||||
it('should return an error if write file fails', async () => {
|
||||
const error = new Error('fs promises writeFile error');
|
||||
(fs.promises.writeFile as jest.Mock).mockRejectedValue(error);
|
||||
(fs.promises.writeFile as Mock).mockRejectedValue(error);
|
||||
const promise = writeFileWithCliOptions('file.yaml', 'contents');
|
||||
await expect(promise).rejects.toThrow(new InsoError('Failed to write to "file.yaml"', error));
|
||||
});
|
||||
|
@ -19,7 +19,7 @@
|
||||
"assets",
|
||||
"scripts",
|
||||
|
||||
"**/@types/mocha/*",
|
||||
"**/@types/mocha",
|
||||
"**/*.test.ts",
|
||||
"**/__snapshots__/**",
|
||||
"**/__mocks__/*"
|
||||
|
5935
packages/insomnia-prettify/package-lock.json
generated
Normal file
5935
packages/insomnia-prettify/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,10 @@
|
||||
"package.json",
|
||||
"README.md"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^28.1.0",
|
||||
"jest": "^28.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"bootstrap": "npm run build",
|
||||
"lint": "eslint . --ext .js,.ts,.tsx --cache",
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
|
@ -1,9 +1,4 @@
|
||||
/** @type { import('@jest/types').Config.InitialOptions } */
|
||||
module.exports = {
|
||||
preset: '../../jest-preset.js',
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
isolatedModules: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
1
packages/insomnia-smoke-test/package-lock.json
generated
1
packages/insomnia-smoke-test/package-lock.json
generated
@ -11,6 +11,7 @@
|
||||
"devDependencies": {
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"@grpc/proto-loader": "^0.6.11",
|
||||
"@jest/globals": "^28.1.0",
|
||||
"@playwright/test": "^1.20.2",
|
||||
"@types/concurrently": "^6.0.1",
|
||||
"@types/express": "^4.17.11",
|
||||
|
@ -29,6 +29,7 @@
|
||||
"devDependencies": {
|
||||
"@grpc/grpc-js": "^1.6.7",
|
||||
"@grpc/proto-loader": "^0.6.11",
|
||||
"@jest/globals": "^28.1.0",
|
||||
"@playwright/test": "^1.20.2",
|
||||
"@types/concurrently": "^6.0.1",
|
||||
"@types/express": "^4.17.11",
|
||||
|
2840
packages/insomnia-testing/package-lock.json
generated
2840
packages/insomnia-testing/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,7 @@
|
||||
"@types/chai": "^4.2.15",
|
||||
"@types/mkdirp": "^1.0.1",
|
||||
"@types/mocha": "^8.2.1",
|
||||
"jest-mock": "^28.0.2",
|
||||
"@jest/globals": "^28.1.0",
|
||||
"typescript": "^4.5.5"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
import { readdirSync, readFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import { escapeJsStr, indent } from './util';
|
||||
|
||||
describe('util', () => {
|
||||
|
@ -1,4 +1,6 @@
|
||||
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import { generate } from '../generate';
|
||||
import { runTests } from '../run';
|
||||
import { mockedSendRequest, mockedSendRequestMultiple } from '../test-helpers/send-request-mock';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { mocked } from 'jest-mock';
|
||||
import { describe, expect, it, jest } from '@jest/globals';
|
||||
|
||||
import { SendRequestCallback } from './insomnia';
|
||||
import { runTests } from './run';
|
||||
@ -28,7 +28,7 @@ describe('Example', () => {
|
||||
`;
|
||||
|
||||
describe('run', () => {
|
||||
const getMockedSendRequest = () => mocked<SendRequestCallback<{status: number}>>(jest.fn().mockResolvedValue({ status: 200 }));
|
||||
const getMockedSendRequest = () => jest.fn<SendRequestCallback<{status: number}>>().mockResolvedValue({ status: 200 });
|
||||
|
||||
it('runs a mocha suite', async () => {
|
||||
const { stats } = await runTests(exampleTest, { sendRequest: getMockedSendRequest() });
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { mocked } from 'jest-mock';
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { SendRequestCallback } from '../run/insomnia';
|
||||
|
||||
export const mockedSendRequest = <TResp extends {status: number}>(response?: TResp) => {
|
||||
return mocked<SendRequestCallback<TResp>>(jest.fn()).mockResolvedValue(response || { status: 200 } as TResp);
|
||||
return jest.fn<SendRequestCallback<TResp>>().mockResolvedValue(response || { status: 200 } as TResp);
|
||||
};
|
||||
|
||||
export const mockedSendRequestMultiple = <TResp>(...responses: TResp[]) => {
|
||||
let mock = mocked<SendRequestCallback<TResp>>(jest.fn());
|
||||
let mock = jest.fn<SendRequestCallback<TResp>>();
|
||||
|
||||
responses.forEach(response => {
|
||||
mock = mock.mockResolvedValueOnce(response);
|
||||
|
5935
packages/insomnia-url/package-lock.json
generated
Normal file
5935
packages/insomnia-url/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,10 @@
|
||||
"package.json",
|
||||
"READEM.md"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^28.1.0",
|
||||
"jest": "^28.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"bootstrap": "npm run build",
|
||||
"lint": "eslint . --ext .js,.ts,.tsx --cache",
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import { setDefaultProtocol } from './protocol';
|
||||
|
||||
describe('setDefaultProtocol()', () => {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import {
|
||||
buildQueryParameter,
|
||||
buildQueryStringFromParams,
|
||||
|
5920
packages/insomnia-xpath/package-lock.json
generated
5920
packages/insomnia-xpath/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,9 @@
|
||||
"test": "jest --silent"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/xmldom": "0.1.30"
|
||||
"@types/xmldom": "0.1.30",
|
||||
"@jest/globals": "^28.1.0",
|
||||
"jest": "^28.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"insomnia-cookies": "3.1.0-beta.1",
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { describe, expect, it } from '@jest/globals';
|
||||
|
||||
import { query } from './query';
|
||||
|
||||
describe('query()', () => {
|
||||
|
646
packages/insomnia/package-lock.json
generated
646
packages/insomnia/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,7 @@
|
||||
"@grpc/grpc-js": "^1.1.8",
|
||||
"@grpc/proto-loader": "^0.5.5",
|
||||
"@hapi/hawk": "^8.0.0",
|
||||
"@jest/globals": "^28.1.0",
|
||||
"@stoplight/spectral": "^5.9.0",
|
||||
"analytics-node": "^6.0.0",
|
||||
"aws4": "^1.11.0",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import fs from 'fs';
|
||||
import { convert } from 'insomnia-importers';
|
||||
import { convert, ConvertResultType } from 'insomnia-importers';
|
||||
|
||||
import type { ApiSpec } from '../models/api-spec';
|
||||
import type { BaseModel } from '../models/index';
|
||||
@ -26,12 +26,6 @@ export interface ImportResult {
|
||||
summary: Record<string, BaseModel[]>;
|
||||
}
|
||||
|
||||
interface ConvertResultType {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface ConvertResult {
|
||||
type: ConvertResultType;
|
||||
data: {
|
||||
@ -123,7 +117,7 @@ export async function importRaw(
|
||||
let results: ConvertResult;
|
||||
|
||||
try {
|
||||
results = await convert(rawContent);
|
||||
results = (await convert(rawContent)) as unknown as ConvertResult;
|
||||
} catch (err) {
|
||||
const importResult: ImportResult = {
|
||||
source: 'not found',
|
||||
|
@ -9,7 +9,8 @@
|
||||
"strictNullChecks": true,
|
||||
"jsx": "react",
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true
|
||||
"skipLibCheck": true,
|
||||
"types": ["node", "jest"],
|
||||
},
|
||||
"include": [
|
||||
"**/*.d.ts",
|
||||
@ -26,6 +27,7 @@
|
||||
"**/__snapshots__",
|
||||
"**/__tests__",
|
||||
"**/main.min.js",
|
||||
"src/coverage",
|
||||
"__jest__",
|
||||
"assets",
|
||||
"bin",
|
||||
|
@ -21,6 +21,7 @@
|
||||
"bin",
|
||||
"build",
|
||||
"config",
|
||||
"src/coverage",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
"resolveJsonModule": true,
|
||||
"strict": true,
|
||||
"jsx": "react",
|
||||
"types": ["node"],
|
||||
"isolatedModules": false,
|
||||
"emitDeclarationOnly": true,
|
||||
"sourceMap": false,
|
||||
|
@ -20,6 +20,6 @@
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "ES2019",
|
||||
"types": ["node", "jest"]
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user