Skip to content

Commit

Permalink
SALTO-1155: Update jest version (#1804)
Browse files Browse the repository at this point in the history
* Update jest version
* Retry install in circle CI to work around yarn bug - yarnpkg/yarn#2629
  • Loading branch information
ori-moisis committed Jan 31, 2021
1 parent 34e8dde commit 2ac7d5e
Show file tree
Hide file tree
Showing 48 changed files with 1,431 additions and 988 deletions.
4 changes: 3 additions & 1 deletion .circleci/config.yml
Expand Up @@ -73,7 +73,9 @@ jobs:

- run: yarn config set cache-folder /mnt/ramdisk/yarn-cache

- run: yarn
# Yarn has some random race-condition failures, trying multiple times seems to help
# when the source of the problem is yarn itself and not the packages
- run: yarn || yarn || yarn

- run:
# As a workaround to the --frozen-lockfile flag not working with workspaces
Expand Down
4 changes: 2 additions & 2 deletions jest.base.config.js
Expand Up @@ -25,8 +25,8 @@ module.exports = {
collectCoverage: true,
coverageReporters: ['json', 'lcov', 'text', 'clover', 'json-summary'],
collectCoverageFrom: [
'**/*.js',
'**/*.jsx',
'**/dist/**/*.js',
'**/dist/**/*.jsx',
'!**/node_modules/**',
'!*.config.js',
'!coverage/**',
Expand Down
8 changes: 4 additions & 4 deletions packages/adapter-api/package.json
Expand Up @@ -36,7 +36,7 @@
"wu": "^2.1.0"
},
"devDependencies": {
"@types/jest": "^24.0.0",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.133",
"@types/node": "^12.7.1",
"@types/shelljs": "^0.7.8",
Expand All @@ -52,9 +52,9 @@
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"jest-junit": "^6.4.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-junit": "^12.0.0",
"tsc-watch": "^2.2.1",
"typescript": "3.9.3"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/adapter-utils/package.json
Expand Up @@ -39,7 +39,7 @@
"wu": "^2.1.0"
},
"devDependencies": {
"@types/jest": "^24.0.0",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.133",
"@types/node": "^12.7.1",
"@types/shelljs": "^0.7.8",
Expand All @@ -55,9 +55,9 @@
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"jest-junit": "^6.4.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-junit": "^12.0.0",
"tsc-watch": "^2.2.1",
"typescript": "3.9.3"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Expand Up @@ -69,7 +69,7 @@
"@types/express": "^4.17.7",
"@types/figlet": "^1.2.0",
"@types/inquirer": "0.0.35",
"@types/jest": "^24.0.0",
"@types/jest": "^26.0.20",
"@types/mkdirp": "^0.5.2",
"@types/rimraf": "^2.0.3",
"@types/semver": "^7.3.3",
Expand All @@ -83,8 +83,8 @@
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"jest": "^24.9.0",
"jest-junit": "^6.4.0",
"jest": "^26.6.3",
"jest-junit": "^12.0.0",
"memory-streams": "^0.1.3",
"nexe": "4.0.0-beta.6",
"sinon": "^9.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/clean.test.ts
Expand Up @@ -22,7 +22,7 @@ import { action } from '../../src/commands/clean'
const commandName = 'clean'

jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
getDefaultAdapterConfig: jest.fn().mockImplementation(service => ({ a: 'a', serviceName: service })),
cleanWorkspace: jest.fn(),
}))
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/deploy.test.ts
Expand Up @@ -27,7 +27,7 @@ const mockDeploy = mocks.deploy
const mockPreview = mocks.preview
jest.mock('../../src/callbacks')
jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
deploy: jest.fn().mockImplementation((
ws: Workspace,
actionPlan: Plan,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/diff.test.ts
Expand Up @@ -22,7 +22,7 @@ import * as mocks from '../mocks'
const commandName = 'diff'

jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
diff: jest.fn().mockImplementation(() => Promise.resolve([])),
}))
describe('diff command', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/element.test.ts
Expand Up @@ -38,7 +38,7 @@ const mockedList: typeof core.listUnresolvedReferences = (_workspace, completeFr
)
jest.mock('open')
jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
listUnresolvedReferences: jest.fn().mockImplementation((_ws, env) => mockedList(_ws, env)),
}))
describe('Element command group', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/fetch.test.ts
Expand Up @@ -35,7 +35,7 @@ const eventsNames = {
}

jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
fetch: jest.fn().mockImplementation(() => Promise.resolve({
changes: [],
mergeErrors: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/init.test.ts
Expand Up @@ -22,7 +22,7 @@ import { getEnvName } from '../../src/callbacks'
import { CommandArgs } from '../../src/command_builder'

jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
initLocalWorkspace: jest.fn().mockImplementation(
(_baseDir: string, workspaceName: string): Workspace => {
if (workspaceName === 'error') throw new Error('failed')
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/restore.test.ts
Expand Up @@ -32,7 +32,7 @@ const eventsNames = {
}

jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
restore: jest.fn().mockImplementation(() => Promise.resolve([])),
}))

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/commands/service.test.ts
Expand Up @@ -30,7 +30,7 @@ jest.mock('../../src/cli_oauth_authenticator', () => ({
}),
}))
jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
getAdaptersCredentialsTypes: jest.fn().mockImplementation((serviceNames: string[]):
Record<string, AdapterAuthentication> => {
if (serviceNames[0] === 'noAdapter') {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/workspace/workspace.test.ts
Expand Up @@ -47,7 +47,7 @@ const mockWsFunctions = {

const mockWs = mockWsFunctions as unknown as Workspace
jest.mock('@salto-io/core', () => ({
...jest.requireActual('@salto-io/core'),
...jest.requireActual<{}>('@salto-io/core'),
loadLocalWorkspace: jest.fn().mockImplementation(() => mockWs),
}))
jest.mock('inquirer', () => ({
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Expand Up @@ -54,7 +54,7 @@
"wu": "^2.1.0"
},
"devDependencies": {
"@types/jest": "^24.0.0",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.133",
"@types/node": "^12.7.1",
"@types/supertest": "^2.0.4",
Expand All @@ -71,9 +71,9 @@
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"jest-junit": "^6.4.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-junit": "^12.0.0",
"nock": "^12.0.1",
"tsc-watch": "^2.2.1",
"typescript": "3.9.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/api.test.ts
Expand Up @@ -52,7 +52,7 @@ const mockServiceWithInstall = 'adapterWithInstallMethod'
const SERVICES = [mockService, emptyMockService]

jest.mock('../src/core/fetch', () => ({
...jest.requireActual('../src/core/fetch'),
...jest.requireActual<{}>('../src/core/fetch'),
fetchChanges: jest.fn(),
}))
jest.mock('../src/core/restore', () => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/app_config.test.ts
Expand Up @@ -20,7 +20,7 @@ import * as conf from '../src/app_config'


jest.mock('@salto-io/file', () => ({
...jest.requireActual('@salto-io/file'),
...jest.requireActual<{}>('@salto-io/file'),
mkdirp: jest.fn(),
replaceContents: jest.fn(),
exists: jest.fn(),
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/core/adapters/adapters.test.ts
Expand Up @@ -24,11 +24,11 @@ import {
} from '../../../src/core/adapters'

jest.mock('@salto-io/workspace', () => ({
...jest.requireActual('@salto-io/workspace'),
...jest.requireActual<{}>('@salto-io/workspace'),
configSource: jest.fn(),
}))
jest.mock('@salto-io/adapter-utils', () => ({
...jest.requireActual('@salto-io/adapter-utils'),
...jest.requireActual<{}>('@salto-io/adapter-utils'),
createDefaultInstanceFromType: jest.fn(),
}))

Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/core/clean.test.ts
Expand Up @@ -19,7 +19,7 @@ import * as adapters from '../../src/core/adapters'
import { mockWorkspace } from '../common/workspace'

jest.mock('../../src/core/adapters', () => ({
...jest.requireActual('../../src/core/adapters'),
...jest.requireActual<{}>('../../src/core/adapters'),
getDefaultAdapterConfig: jest.fn(service => ({ service, aaa: 'aaa' })),
}))

Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/core/fetch.test.ts
Expand Up @@ -29,7 +29,7 @@ import { mockFunction } from '../common/helpers'

jest.mock('pietile-eventemitter')
jest.mock('@salto-io/adapter-utils', () => ({
...jest.requireActual('@salto-io/adapter-utils'),
...jest.requireActual<{}>('@salto-io/adapter-utils'),
applyInstancesDefaults: jest.fn(),
}))

Expand Down Expand Up @@ -236,7 +236,7 @@ describe('fetch', () => {
}
})

describe('multiple adapters', async () => {
describe('multiple adapters', () => {
const adapters = {
dummy1: {
fetch: mockFunction<AdapterOperations['fetch']>().mockResolvedValue({ elements: [], isPartial: true }),
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/workspace/local/cache.test.ts
Expand Up @@ -25,7 +25,7 @@ const { parseResultCache } = parseCache
type SourceMap = parser.SourceMap

jest.mock('@salto-io/file', () => ({
...jest.requireActual('@salto-io/file'),
...jest.requireActual<{}>('@salto-io/file'),
stat: jest.fn(),
exists: jest.fn(),
readFile: jest.fn(),
Expand All @@ -34,7 +34,7 @@ jest.mock('@salto-io/file', () => ({
}))

jest.mock('@salto-io/workspace', () => ({
...jest.requireActual('@salto-io/workspace'),
...jest.requireActual<{}>('@salto-io/workspace'),
serialize: jest.fn(),
}))

Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/workspace/local/directory_store.test.ts
Expand Up @@ -22,7 +22,7 @@ import {
import { localDirectoryStore } from '../../../src/local-workspace/dir_store'

jest.mock('@salto-io/file', () => ({
...jest.requireActual('@salto-io/file'),
...jest.requireActual<{}>('@salto-io/file'),
readdirp: jest.fn(),
stat: jest.fn(),
statSync: jest.fn(),
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/workspace/local/state.test.ts
Expand Up @@ -38,7 +38,7 @@ jest.mock('glob', () => (query: string, f: (_err: Error | null, files: string[])
}
})
jest.mock('@salto-io/file', () => ({
...jest.requireActual('@salto-io/file'),
...jest.requireActual<{}>('@salto-io/file'),
replaceContents: jest.fn().mockImplementation(() => Promise.resolve()),
readTextFile: jest.fn().mockImplementation((filename: string) => {
if (filename === 'error') {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/workspace/local/workspace.test.ts
Expand Up @@ -28,15 +28,15 @@ import * as mockDirStore from '../../../src/local-workspace/dir_store'
const { ENVS_PREFIX } = ws.nacl

jest.mock('@salto-io/file', () => ({
...jest.requireActual('@salto-io/file'),
...jest.requireActual<{}>('@salto-io/file'),
exists: jest.fn(),
rm: jest.fn(),
isEmptyDir: {
notFoundAsUndefined: jest.fn(() => true),
},
}))
jest.mock('@salto-io/workspace', () => ({
...jest.requireActual('@salto-io/workspace'),
...jest.requireActual<{}>('@salto-io/workspace'),
initWorkspace: jest.fn(),
loadWorkspace: jest.fn(),
}))
Expand Down
7 changes: 4 additions & 3 deletions packages/dag/package.json
Expand Up @@ -36,6 +36,7 @@
"wu": "^2.1.0"
},
"devDependencies": {
"@types/jest": "^26.0.20",
"eslint": "^6.2.2",
"eslint-config-airbnb": "18.0.1",
"eslint-plugin-header": "^3.0.0",
Expand All @@ -44,9 +45,9 @@
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"jest-junit": "^6.4.0",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-junit": "^12.0.0",
"typescript": "3.9.3"
}
}
8 changes: 4 additions & 4 deletions packages/dummy-adapter/package.json
Expand Up @@ -40,10 +40,10 @@
"unique-names-generator": "^4.3.1"
},
"devDependencies": {
"@types/jest": "^24.0.0",
"@types/jest": "^26.0.20",
"@types/seedrandom": "^2.4.28",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"jest-junit": "^6.4.0"
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"jest-junit": "^12.0.0"
}
}
14 changes: 11 additions & 3 deletions packages/e2e-credentials-store/.eslintrc.js
Expand Up @@ -19,10 +19,18 @@ const deepMerge = require('../../build_utils/deep_merge')
module.exports = deepMerge(
require('../../eslintrc.js'),
{
overrides: [
{
files: ['*.ts'],
parserOptions: {
tsconfigRootDir: __dirname,
project: path.resolve(__dirname, './tsconfig.json'),
},
}
],
parserOptions: {
tsconfigRootDir: __dirname,
project: path.resolve(__dirname, './tsconfig.json'),
},
project: [],
}
},
)

18 changes: 18 additions & 0 deletions packages/e2e-credentials-store/jest-dynalite-config.js
@@ -0,0 +1,18 @@
/*
* Copyright 2021 Salto Labs Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = {
tables: [],
}

0 comments on commit 2ac7d5e

Please sign in to comment.