test(i18n): align merge failure fixtures
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -58,6 +58,28 @@ function installFixtureRuntime(root: string): void {
|
|||||||
symlinkSync(join(workspaceRoot, 'scripts'), join(root, 'scripts'), linkType)
|
symlinkSync(join(workspaceRoot, 'scripts'), join(root, 'scripts'), linkType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function startMergeWithFakeNode(
|
||||||
|
fixture: Fixture,
|
||||||
|
nodeScript = '#!/bin/sh\nexit 72\n',
|
||||||
|
) {
|
||||||
|
const fakeBin = join(fixture.root, 'fake-bin')
|
||||||
|
const fakeNode = join(fakeBin, 'node')
|
||||||
|
write(fixture.root, 'fake-bin/node', nodeScript)
|
||||||
|
chmodSync(fakeNode, 0o755)
|
||||||
|
git(fixture, [
|
||||||
|
'config',
|
||||||
|
'merge.dsh-translation-pairing.driver',
|
||||||
|
`${shellQuote(driverLauncher)} %O %A %B %P`,
|
||||||
|
])
|
||||||
|
return spawnSync('git', ['-C', fixture.root, 'merge', '--no-commit', 'master'], {
|
||||||
|
encoding: 'utf8',
|
||||||
|
env: {
|
||||||
|
...fixture.env,
|
||||||
|
PATH: `${fakeBin}${delimiter}${fixture.env.PATH ?? ''}`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function createFixture(attributes = true): Fixture {
|
function createFixture(attributes = true): Fixture {
|
||||||
const root = mkdtempSync(join(tmpdir(), 'dsh-translation-pairing-merge-'))
|
const root = mkdtempSync(join(tmpdir(), 'dsh-translation-pairing-merge-'))
|
||||||
fixtures.push(root)
|
fixtures.push(root)
|
||||||
@@ -327,24 +349,9 @@ describe('translation pairing merge composition', () => {
|
|||||||
it('leaves an ordinary recoverable conflict when the configured runtime is unavailable', () => {
|
it('leaves an ordinary recoverable conflict when the configured runtime is unavailable', () => {
|
||||||
const fixture = createFixture()
|
const fixture = createFixture()
|
||||||
const records = createDivergedPair(fixture)
|
const records = createDivergedPair(fixture)
|
||||||
const fakeBin = join(fixture.root, 'fake-bin')
|
|
||||||
const fakeNode = join(fakeBin, 'node')
|
|
||||||
write(fixture.root, 'fake-bin/node', '#!/bin/sh\nexit 72\n')
|
|
||||||
chmodSync(fakeNode, 0o755)
|
|
||||||
const command = [
|
|
||||||
shellQuote(driverLauncher),
|
|
||||||
'%O', '%A', '%B', '%P',
|
|
||||||
].join(' ')
|
|
||||||
git(fixture, ['config', 'merge.dsh-translation-pairing.driver', command])
|
|
||||||
const headBefore = git(fixture, ['rev-parse', 'HEAD'])
|
const headBefore = git(fixture, ['rev-parse', 'HEAD'])
|
||||||
|
|
||||||
const result = spawnSync('git', ['-C', fixture.root, 'merge', '--no-commit', 'master'], {
|
const result = startMergeWithFakeNode(fixture)
|
||||||
encoding: 'utf8',
|
|
||||||
env: {
|
|
||||||
...fixture.env,
|
|
||||||
PATH: `${fakeBin}${delimiter}${fixture.env.PATH ?? ''}`,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.status).toBe(1)
|
expect(result.status).toBe(1)
|
||||||
expect(result.stderr).toContain('runtime is unavailable; leaving an ordinary text conflict')
|
expect(result.stderr).toContain('runtime is unavailable; leaving an ordinary text conflict')
|
||||||
@@ -366,27 +373,10 @@ describe('translation pairing merge composition', () => {
|
|||||||
it('falls back before a broken driver entrypoint can replace the launcher', () => {
|
it('falls back before a broken driver entrypoint can replace the launcher', () => {
|
||||||
const fixture = createFixture()
|
const fixture = createFixture()
|
||||||
createDivergedPair(fixture)
|
createDivergedPair(fixture)
|
||||||
const fakeBin = join(fixture.root, 'fake-bin')
|
const result = startMergeWithFakeNode(
|
||||||
const fakeNode = join(fakeBin, 'node')
|
fixture,
|
||||||
write(
|
|
||||||
fixture.root,
|
|
||||||
'fake-bin/node',
|
|
||||||
'#!/bin/sh\nif [ "$3" = "--eval" ]; then exit 0; fi\nexit 72\n',
|
'#!/bin/sh\nif [ "$3" = "--eval" ]; then exit 0; fi\nexit 72\n',
|
||||||
)
|
)
|
||||||
chmodSync(fakeNode, 0o755)
|
|
||||||
git(fixture, [
|
|
||||||
'config',
|
|
||||||
'merge.dsh-translation-pairing.driver',
|
|
||||||
`${shellQuote(driverLauncher)} %O %A %B %P`,
|
|
||||||
])
|
|
||||||
|
|
||||||
const result = spawnSync('git', ['-C', fixture.root, 'merge', '--no-commit', 'master'], {
|
|
||||||
encoding: 'utf8',
|
|
||||||
env: {
|
|
||||||
...fixture.env,
|
|
||||||
PATH: `${fakeBin}${delimiter}${fixture.env.PATH ?? ''}`,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.status).toBe(1)
|
expect(result.status).toBe(1)
|
||||||
expect(result.stderr).toContain('runtime is unavailable; leaving an ordinary text conflict')
|
expect(result.stderr).toContain('runtime is unavailable; leaving an ordinary text conflict')
|
||||||
@@ -398,23 +388,7 @@ describe('translation pairing merge composition', () => {
|
|||||||
it('keeps a clean text fallback unresolved until the explicit resolver confirms it', () => {
|
it('keeps a clean text fallback unresolved until the explicit resolver confirms it', () => {
|
||||||
const fixture = createFixture()
|
const fixture = createFixture()
|
||||||
createTextCleanDivergedPair(fixture)
|
createTextCleanDivergedPair(fixture)
|
||||||
const fakeBin = join(fixture.root, 'fake-bin')
|
const result = startMergeWithFakeNode(fixture)
|
||||||
const fakeNode = join(fakeBin, 'node')
|
|
||||||
write(fixture.root, 'fake-bin/node', '#!/bin/sh\nexit 72\n')
|
|
||||||
chmodSync(fakeNode, 0o755)
|
|
||||||
git(fixture, [
|
|
||||||
'config',
|
|
||||||
'merge.dsh-translation-pairing.driver',
|
|
||||||
`${shellQuote(driverLauncher)} %O %A %B %P`,
|
|
||||||
])
|
|
||||||
|
|
||||||
const result = spawnSync('git', ['-C', fixture.root, 'merge', '--no-commit', 'master'], {
|
|
||||||
encoding: 'utf8',
|
|
||||||
env: {
|
|
||||||
...fixture.env,
|
|
||||||
PATH: `${fakeBin}${delimiter}${fixture.env.PATH ?? ''}`,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.status).toBe(1)
|
expect(result.status).toBe(1)
|
||||||
expect(git(fixture, ['diff', '--name-only', '--diff-filter=U'])).toBe('docs/guide.i18n.yaml')
|
expect(git(fixture, ['diff', '--name-only', '--diff-filter=U'])).toBe('docs/guide.i18n.yaml')
|
||||||
|
|||||||
Reference in New Issue
Block a user