Skip to content

Commit

Permalink
fix: integration job feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Sep 8, 2023
1 parent baa215c commit 8dfc18b
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 77 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
},
plugins: ['prettier', '@typescript-eslint'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/brace-style': 'off',
'@typescript-eslint/comma-dangle': 'off',
'@typescript-eslint/comma-spacing': 'off',
Expand Down
2 changes: 2 additions & 0 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"ignorewarnings",
"iife",
"indx",
"Infile",
"lcov",
"linebreak",
"lintstagedrc",
Expand All @@ -92,6 +93,7 @@
"mutingpermissionsets",
"myexperiencebundle",
"nonblock",
"notblank",
"notexist",
"notificationtypes",
"notiftype",
Expand Down
2 changes: 1 addition & 1 deletion __tests__/functional/delta.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const getFileLineNumber = async (path: string) => {
output: process.stdout,
terminal: false,
})
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
for await (const _ of rl) {
++linesCount
}
Expand Down
6 changes: 3 additions & 3 deletions __tests__/perf/bench.js → __tests__/perf/bench.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'
const { execCmd } = require('@salesforce/cli-plugins-testkit')
const Benchmark = require('benchmark')
const suite = new Benchmark.Suite()
import { execCmd } from '@salesforce/cli-plugins-testkit'
import benchmark from 'benchmark'
const suite = new benchmark.Suite()

suite
.add('e2e-test', () => {
Expand Down
1 change: 0 additions & 1 deletion __tests__/unit/lib/post-processor/includeProcessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,3 @@ describe('IncludeProcessor', () => {
})
})
})
it('test', () => {})
4 changes: 2 additions & 2 deletions __tests__/unit/lib/service/lwcHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import LwcHandler from '../../../../src/service/lwcHandler'
import { copyFiles } from '../../../../src/utils/fsHelper'
import { Work } from '../../../../src/types/work'
import { MetadataRepository } from '../../../../src/types/metadata'
const {
import {
ADDITION,
DELETION,
MODIFICATION,
} = require('../../../../src/utils/gitConstants')
} from '../../../../src/utils/gitConstants'

jest.mock('../../../../src/utils/fsHelper')

Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/lib/utils/fxpHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('fxpHelper', () => {
describe('when called with non xml content', () => {
beforeEach(() => {
// Arrange
mockedReadPathFromGit.mockResolvedValueOnce('{"attribut": "value"}')
mockedReadPathFromGit.mockResolvedValueOnce('{"attribute": "value"}')
})
it('returns empty object', async () => {
// Act
Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/lib/utils/metadataDiff.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
'use strict'
import { expect, jest, describe, it } from '@jest/globals'
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper'
Expand Down
96 changes: 48 additions & 48 deletions __tests__/unit/lib/utils/repoGitDiff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jest.mock('../../../../src/utils/childProcessUtils', () => {
})

const mockedGetSpawContent = jest.mocked(getSpawnContent)
const mockedGetSpawContentByLine = jest.mocked(getSpawnContentByLine)
const mockedGetSpawnContentByLine = jest.mocked(getSpawnContentByLine)

const FORCEIGNORE_MOCK_PATH = '__mocks__/.forceignore'

Expand Down Expand Up @@ -61,7 +61,7 @@ describe(`test if repoGitDiff`, () => {
})
it('can parse git correctly', async () => {
const output: string[] = []
mockedGetSpawContentByLine.mockResolvedValue([])
mockedGetSpawnContentByLine.mockResolvedValue([])
config.ignore = FORCEIGNORE_MOCK_PATH
config.ignoreWhitespace = true
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
Expand All @@ -71,7 +71,7 @@ describe(`test if repoGitDiff`, () => {

it('can parse git permissively', async () => {
const output: string[] = []
mockedGetSpawContentByLine.mockResolvedValue([])
mockedGetSpawnContentByLine.mockResolvedValue([])
config.ignore = FORCEIGNORE_MOCK_PATH
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
Expand All @@ -82,11 +82,11 @@ describe(`test if repoGitDiff`, () => {
const output: string[] = [
'force-app/main/default/objects/Account/fields/awesome.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce(
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce(
output.map(x => `1${TAB}1${TAB}${x}`)
)
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
config.ignore = FORCEIGNORE_MOCK_PATH
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
Expand All @@ -97,11 +97,11 @@ describe(`test if repoGitDiff`, () => {
const output: string[] = [
'force-app/main/default/objects/Account/fields/awesome.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce(
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce(
output.map(x => `1${TAB}1${TAB}${x}`)
)
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
expect(work).toStrictEqual(output.map(x => `${DELETION}${TAB}${x}`))
Expand All @@ -111,11 +111,11 @@ describe(`test if repoGitDiff`, () => {
const output: string[] = [
'force-app/main/default/objects/Account/fields/awesome.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce(
mockedGetSpawnContentByLine.mockResolvedValueOnce(
output.map(x => `1${TAB}1${TAB}${x}`)
)
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
expect(work).toStrictEqual(output.map(x => `${ADDITION}${TAB}${x}`))
Expand All @@ -125,11 +125,11 @@ describe(`test if repoGitDiff`, () => {
const output: string[] = [
'force-app/main/default/objects/Account/fields/awesome.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce(
mockedGetSpawnContentByLine.mockResolvedValueOnce(
output.map(x => `1${TAB}1${TAB}${x}`)
)
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
expect(work).toStrictEqual(output.map(x => `${ADDITION}${TAB}${x}`))
Expand All @@ -139,9 +139,9 @@ describe(`test if repoGitDiff`, () => {
const output: string[] = [
'force-app/main/default/objects/Account/fields/awesome.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce(
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce(
output.map(x => `1${TAB}1${TAB}${x}`)
)
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
Expand All @@ -153,9 +153,9 @@ describe(`test if repoGitDiff`, () => {
const output: string[] = [
'force-app/main/default/objects/Account/fields/awesome.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce(
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce(
output.map(x => `1${TAB}1${TAB}${x}`)
)
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
Expand All @@ -165,11 +165,11 @@ describe(`test if repoGitDiff`, () => {

it('can filter ignored files', async () => {
const output = 'force-app/main/default/pages/test.page-meta.xml'
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
config.ignore = FORCEIGNORE_MOCK_PATH
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
Expand All @@ -180,11 +180,11 @@ describe(`test if repoGitDiff`, () => {

it('can filter ignored destructive files', async () => {
const output = 'force-app/main/default/pages/test.page-meta.xml'
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawContent.mockResolvedValueOnce(
Buffer.from(`1${TAB}1${TAB}${output}`)
)
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
config.ignoreDestructive = FORCEIGNORE_MOCK_PATH
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
Expand All @@ -195,7 +195,7 @@ describe(`test if repoGitDiff`, () => {

it('can filter ignored and ignored destructive files', async () => {
const output = 'force-app/main/default/lwc/jsconfig.json'
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawContent.mockResolvedValueOnce(
Buffer.from(`1${TAB}1${TAB}${output}`)
)
Expand All @@ -213,11 +213,11 @@ describe(`test if repoGitDiff`, () => {

it('can filter deletion if only ignored is specified files', async () => {
const output = 'force-app/main/default/pages/test.page-meta.xml'
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
config.ignore = FORCEIGNORE_MOCK_PATH
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
Expand All @@ -228,11 +228,11 @@ describe(`test if repoGitDiff`, () => {

it('cannot filter non deletion if only ignored destructive is specified files', async () => {
const output = 'force-app/main/default/pages/test.page-meta.xml'
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])

config.ignoreDestructive = FORCEIGNORE_MOCK_PATH
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
Expand All @@ -243,11 +243,11 @@ describe(`test if repoGitDiff`, () => {

it('can filter sub folders', async () => {
const output = 'force-app/main/default/pages/test.page-meta.xml'
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
config.ignore = FORCEIGNORE_MOCK_PATH
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
Expand All @@ -262,13 +262,13 @@ describe(`test if repoGitDiff`, () => {
'force-app/account/domain/classes/Account.cls',
]

mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[1]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[0]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
const expected: string[] = [`${ADDITION}${TAB}${output[1]}`]
Expand All @@ -280,13 +280,13 @@ describe(`test if repoGitDiff`, () => {
'force-app/main/default/objects/Account/fields/TEST__c.field-meta.xml',
'force-app/main/default/objects/Account/fields/Test__c.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[1]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[0]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
const expected: string[] = [`${ADDITION}${TAB}${output[1]}`]
Expand All @@ -298,13 +298,13 @@ describe(`test if repoGitDiff`, () => {
'force-app/main/default/classes/Account.cls',
'force-app/main/default/classes/RenamedAccount.cls',
]
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[1]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[0]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
const expected: string[] = [
Expand All @@ -319,13 +319,13 @@ describe(`test if repoGitDiff`, () => {
'force-app/main/default/objects/Account/fields/CustomField__c.field-meta.xml',
'force-app/main/default/objects/Opportunity/fields/CustomField__c.field-meta.xml',
]
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[1]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([
mockedGetSpawnContentByLine.mockResolvedValueOnce([
`1${TAB}1${TAB}${output[0]}`,
])
mockedGetSpawContentByLine.mockResolvedValueOnce([])
mockedGetSpawnContentByLine.mockResolvedValueOnce([])
const repoGitDiff = new RepoGitDiff(config, globalMetadata)
const work = await repoGitDiff.getLines()
const expected: string[] = [
Expand Down
4 changes: 2 additions & 2 deletions __tests__/unit/lib/utils/repoSetup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Config } from '../../../../src/types/config'
jest.mock('../../../../src/utils/childProcessUtils')

const mockedGetSpawContent = jest.mocked(getSpawnContent)
const mockedGetSpawContentByLine = jest.mocked(getSpawnContentByLine)
const mockedGetSpawnContentByLine = jest.mocked(getSpawnContentByLine)

describe(`test if repoSetup`, () => {
const config: Config = {
Expand Down Expand Up @@ -93,7 +93,7 @@ describe(`test if repoSetup`, () => {
// Arrange
const expected = ['file/path/name.ext', 'other/file/path/name.ext']
config.repo = './'
mockedGetSpawContentByLine.mockResolvedValue(expected)
mockedGetSpawnContentByLine.mockResolvedValue(expected)

// Act
const repoSetup = new RepoSetup(config)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"test:build:local": "yarn clean ; shx rm -rf .yarn/cache node_modules ; yarn && yarn pack && yarn test",
"test:mutation": "stryker run",
"test:nut": "nyc mocha **/*.nut.ts",
"test:perf": "node __tests__/perf/bench.js | tee perf-result.txt",
"test:perf": "node __tests__/perf/bench.mjs | tee perf-result.txt",
"test:unit": "jest",
"test:unit:clear:cache": "jest --clearCache",
"test:unit:coverage": "jest --coverage",
Expand Down
Loading

0 comments on commit 8dfc18b

Please sign in to comment.