From 6310389a07a6d90bd103c5f92822f6482bec330a Mon Sep 17 00:00:00 2001 From: Jesse Attas Date: Mon, 1 Jun 2026 16:41:55 -0500 Subject: [PATCH 1/6] Update yargs in xliff-to-json-converter --- package-lock.json | 156 +++++++++++++++++- packages/xliff-to-json-converter/package.json | 4 +- 2 files changed, 154 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index fae63bebbf..b6f6e0e9b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3493,6 +3493,7 @@ "os": [ "aix" ], + "peer": true, "engines": { "node": ">=18" } @@ -3510,6 +3511,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=18" } @@ -3527,6 +3529,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=18" } @@ -3544,6 +3547,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=18" } @@ -3561,6 +3565,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">=18" } @@ -3578,6 +3583,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">=18" } @@ -3595,6 +3601,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -3612,6 +3619,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -3629,6 +3637,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3646,6 +3655,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3663,6 +3673,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3680,6 +3691,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3697,6 +3709,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3714,6 +3727,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3731,6 +3745,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3748,6 +3763,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3765,6 +3781,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -3782,6 +3799,7 @@ "os": [ "netbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -3799,6 +3817,7 @@ "os": [ "netbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -3816,6 +3835,7 @@ "os": [ "openbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -3833,6 +3853,7 @@ "os": [ "openbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -3850,6 +3871,7 @@ "os": [ "openharmony" ], + "peer": true, "engines": { "node": ">=18" } @@ -3867,6 +3889,7 @@ "os": [ "sunos" ], + "peer": true, "engines": { "node": ">=18" } @@ -3884,6 +3907,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=18" } @@ -3901,6 +3925,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=18" } @@ -3918,6 +3943,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=18" } @@ -8297,6 +8323,7 @@ "hasInstallScript": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "detect-libc": "^2.0.3", "is-glob": "^4.0.3", @@ -8339,6 +8366,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8360,6 +8388,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8381,6 +8410,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8402,6 +8432,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8423,6 +8454,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8444,6 +8476,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8465,6 +8498,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8486,6 +8520,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8507,6 +8542,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8528,6 +8564,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8549,6 +8586,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8570,6 +8608,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8591,6 +8630,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">= 10.0.0" }, @@ -8605,7 +8645,8 @@ "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", "dev": true, "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/@parcel/watcher/node_modules/picomatch": { "version": "4.0.4", @@ -8614,6 +8655,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "engines": { "node": ">=12" }, @@ -13304,6 +13346,7 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, "license": "ISC", "dependencies": { "string-width": "^4.2.0", @@ -13318,12 +13361,14 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, "license": "MIT" }, "node_modules/cliui/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -13333,6 +13378,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -13347,6 +13393,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -13359,6 +13406,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -14992,6 +15040,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "prr": "~1.0.1" }, @@ -18266,6 +18315,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "bin": { "image-size": "bin/image-size.js" }, @@ -20499,6 +20549,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "bin": { "mime": "cli.js" }, @@ -20513,6 +20564,7 @@ "dev": true, "license": "BSD-3-Clause", "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -25460,6 +25512,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "iconv-lite": "^0.6.3", "sax": "^1.2.4" @@ -25478,6 +25531,7 @@ "dev": true, "license": "MIT", "optional": true, + "peer": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -27929,7 +27983,8 @@ "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", "dev": true, "license": "MIT", - "optional": true + "optional": true, + "peer": true }, "node_modules/pump": { "version": "3.0.4", @@ -29756,6 +29811,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -34707,6 +34763,7 @@ "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, "license": "MIT", "dependencies": { "cliui": "^8.0.1", @@ -34725,6 +34782,7 @@ "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, "license": "ISC", "engines": { "node": ">=12" @@ -34734,12 +34792,14 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, "license": "MIT" }, "node_modules/yargs/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -34749,6 +34809,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -34763,6 +34824,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -35381,7 +35443,7 @@ "license": "MIT", "dependencies": { "xliff": "^6.1.0", - "yargs": "^17.5.1" + "yargs": "^18.0.0" }, "bin": { "xliff-to-json-converter": "dist/esm/index.js" @@ -35389,11 +35451,97 @@ "devDependencies": { "@ni-private/eslint-config-nimble": "*", "@types/jasmine": "^5.1.4", - "@types/yargs": "^17.0.10", + "@types/yargs": "^17.0.35", "jasmine": "^5.1.0", "jasmine-core": "^5.1.2", "typescript": "~5.8.3" } + }, + "packages/xliff-to-json-converter/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "packages/xliff-to-json-converter/node_modules/cliui": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "license": "ISC", + "dependencies": { + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "packages/xliff-to-json-converter/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/xliff-to-json-converter/node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "packages/xliff-to-json-converter/node_modules/yargs": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", + "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", + "license": "MIT", + "dependencies": { + "cliui": "^9.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "string-width": "^7.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^22.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } + }, + "packages/xliff-to-json-converter/node_modules/yargs-parser": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", + "license": "ISC", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } } } } diff --git a/packages/xliff-to-json-converter/package.json b/packages/xliff-to-json-converter/package.json index 2cde2222d9..93f15db0f0 100644 --- a/packages/xliff-to-json-converter/package.json +++ b/packages/xliff-to-json-converter/package.json @@ -45,12 +45,12 @@ "license": "MIT", "dependencies": { "xliff": "^6.1.0", - "yargs": "^17.5.1" + "yargs": "^18.0.0" }, "devDependencies": { "@ni-private/eslint-config-nimble": "*", "@types/jasmine": "^5.1.4", - "@types/yargs": "^17.0.10", + "@types/yargs": "^17.0.35", "jasmine": "^5.1.0", "jasmine-core": "^5.1.2", "typescript": "~5.8.3" From 7f0b71a891991f00dce0a4aaad109c534d39bccd Mon Sep 17 00:00:00 2001 From: Jesse Attas Date: Mon, 1 Jun 2026 16:48:19 -0500 Subject: [PATCH 2/6] Add test --- .../src/tests/index.spec.ts | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 packages/xliff-to-json-converter/src/tests/index.spec.ts diff --git a/packages/xliff-to-json-converter/src/tests/index.spec.ts b/packages/xliff-to-json-converter/src/tests/index.spec.ts new file mode 100644 index 0000000000..012e5c9e55 --- /dev/null +++ b/packages/xliff-to-json-converter/src/tests/index.spec.ts @@ -0,0 +1,53 @@ +import { execFile as execFileCallback } from 'node:child_process'; +import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { promisify } from 'node:util'; + +const execFile = promisify(execFileCallback); + +describe('xliff-to-json-converter cli', () => { + it('converts an xliff file passed on the command line', async () => { + const tempDir = await mkdtemp(join(tmpdir(), 'xliff-to-json-converter-')); + const sourceFile = join(tempDir, 'messages.de.xlf'); + const destinationFile = join(tempDir, 'messages.de.json'); + const cliPath = fileURLToPath(new URL('../index.js', import.meta.url)); + const xliffContents = ` + + + + + + HomeStartseite + + + + + `; + + try { + await writeFile(sourceFile, xliffContents); + + const { stdout } = await execFile(process.execPath, [ + cliPath, + '--source', + sourceFile, + '--destination', + destinationFile + ]); + + const jsonContents = await readFile(destinationFile, 'utf-8'); + + expect(stdout).toContain(`Converting ${sourceFile} -> ${destinationFile}`); + expect(JSON.parse(jsonContents)).toEqual({ + locale: 'de-DE', + translations: { + '2821179408673282599': 'Startseite' + } + }); + } finally { + await rm(tempDir, { recursive: true, force: true }); + } + }); +}); \ No newline at end of file From 753390071d55d6f246d9fae48649e741bfcd21b0 Mon Sep 17 00:00:00 2001 From: Jesse Attas Date: Mon, 1 Jun 2026 16:48:46 -0500 Subject: [PATCH 3/6] Change files --- ...son-converter-5fd8dba9-f517-4d05-a753-435eba883a1c.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@ni-xliff-to-json-converter-5fd8dba9-f517-4d05-a753-435eba883a1c.json diff --git a/change/@ni-xliff-to-json-converter-5fd8dba9-f517-4d05-a753-435eba883a1c.json b/change/@ni-xliff-to-json-converter-5fd8dba9-f517-4d05-a753-435eba883a1c.json new file mode 100644 index 0000000000..de4249ee90 --- /dev/null +++ b/change/@ni-xliff-to-json-converter-5fd8dba9-f517-4d05-a753-435eba883a1c.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Update yargs dependency version", + "packageName": "@ni/xliff-to-json-converter", + "email": "jattasNI@users.noreply.github.com", + "dependentChangeType": "patch" +} From e556dd8be8fba5cfcde49335b19def0706adc662 Mon Sep 17 00:00:00 2001 From: Jesse Attas Date: Mon, 1 Jun 2026 16:50:02 -0500 Subject: [PATCH 4/6] Renovate config --- .github/renovate.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index 4e49c43f03..6ee8e82a26 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -46,7 +46,6 @@ "!/playwright/", "!/typescript/", "!/vite/", - "!/yargs/", "!/zone.js/" ] }, From b0767209472e1b39327819c2f1d7674b9c5c90ae Mon Sep 17 00:00:00 2001 From: Jesse Attas Date: Mon, 1 Jun 2026 16:56:46 -0500 Subject: [PATCH 5/6] lint --- packages/xliff-to-json-converter/src/tests/index.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/xliff-to-json-converter/src/tests/index.spec.ts b/packages/xliff-to-json-converter/src/tests/index.spec.ts index 012e5c9e55..18d789186c 100644 --- a/packages/xliff-to-json-converter/src/tests/index.spec.ts +++ b/packages/xliff-to-json-converter/src/tests/index.spec.ts @@ -43,7 +43,8 @@ describe('xliff-to-json-converter cli', () => { expect(JSON.parse(jsonContents)).toEqual({ locale: 'de-DE', translations: { - '2821179408673282599': 'Startseite' + // eslint-disable-next-line @typescript-eslint/naming-convention + '2821179408673282599': 'Startseite' } }); } finally { From f03bf24e1aa7c0e0f9d5fb218144f52baeadae57 Mon Sep 17 00:00:00 2001 From: Jesse Attas Date: Mon, 1 Jun 2026 16:58:22 -0500 Subject: [PATCH 6/6] restructure test --- .../src/tests/index.spec.ts | 61 +++++++++++-------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/packages/xliff-to-json-converter/src/tests/index.spec.ts b/packages/xliff-to-json-converter/src/tests/index.spec.ts index 18d789186c..a345f690d4 100644 --- a/packages/xliff-to-json-converter/src/tests/index.spec.ts +++ b/packages/xliff-to-json-converter/src/tests/index.spec.ts @@ -8,10 +8,21 @@ import { promisify } from 'node:util'; const execFile = promisify(execFileCallback); describe('xliff-to-json-converter cli', () => { + let tempDir: string; + let sourceFile: string; + let destinationFile: string; + + beforeEach(async () => { + tempDir = await mkdtemp(join(tmpdir(), 'xliff-to-json-converter-')); + sourceFile = join(tempDir, 'messages.de.xlf'); + destinationFile = join(tempDir, 'messages.de.json'); + }); + + afterEach(async () => { + await rm(tempDir, { recursive: true, force: true }); + }); + it('converts an xliff file passed on the command line', async () => { - const tempDir = await mkdtemp(join(tmpdir(), 'xliff-to-json-converter-')); - const sourceFile = join(tempDir, 'messages.de.xlf'); - const destinationFile = join(tempDir, 'messages.de.json'); const cliPath = fileURLToPath(new URL('../index.js', import.meta.url)); const xliffContents = ` @@ -26,29 +37,25 @@ describe('xliff-to-json-converter cli', () => { `; - try { - await writeFile(sourceFile, xliffContents); - - const { stdout } = await execFile(process.execPath, [ - cliPath, - '--source', - sourceFile, - '--destination', - destinationFile - ]); - - const jsonContents = await readFile(destinationFile, 'utf-8'); - - expect(stdout).toContain(`Converting ${sourceFile} -> ${destinationFile}`); - expect(JSON.parse(jsonContents)).toEqual({ - locale: 'de-DE', - translations: { - // eslint-disable-next-line @typescript-eslint/naming-convention - '2821179408673282599': 'Startseite' - } - }); - } finally { - await rm(tempDir, { recursive: true, force: true }); - } + await writeFile(sourceFile, xliffContents); + + const { stdout } = await execFile(process.execPath, [ + cliPath, + '--source', + sourceFile, + '--destination', + destinationFile + ]); + + const jsonContents = await readFile(destinationFile, 'utf-8'); + + expect(stdout).toContain(`Converting ${sourceFile} -> ${destinationFile}`); + expect(JSON.parse(jsonContents)).toEqual({ + locale: 'de-DE', + translations: { + // eslint-disable-next-line @typescript-eslint/naming-convention + '2821179408673282599': 'Startseite' + } + }); }); }); \ No newline at end of file