Skip to content

Commit

Permalink
fix(npm): npm outdated (#39)
Browse files Browse the repository at this point in the history
* fix(npm): npm outdated

* fix(website): npm outdated

There's a change in the yargs-parser dep that changes the handling of quotes inside CLI option value strings. So we have to fix our test to remove the extra quotes.
  • Loading branch information
jy95 authored Dec 27, 2021
1 parent fa166e8 commit fe88589
Show file tree
Hide file tree
Showing 9 changed files with 8,498 additions and 6,778 deletions.
5,084 changes: 2,522 additions & 2,562 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,24 +65,24 @@
}
],
"devDependencies": {
"@size-limit/preset-small-lib": "^6.0.4",
"@size-limit/preset-small-lib": "^7.0.5",
"@types/jest": "^27.0.3",
"@types/lodash": "^4.14.177",
"@types/node": "^16.11.10",
"@types/yargs": "^17.0.7",
"dts-cli": "^0.19.7",
"fsify": "^4.0.2",
"@types/lodash": "^4.14.178",
"@types/node": "^17.0.5",
"@types/yargs": "^17.0.8",
"dts-cli": "^1.1.3",
"fsify": "^5.0.0",
"husky": "^7.0.4",
"semantic-release": "^17.4.7",
"size-limit": "^6.0.4",
"size-limit": "^7.0.5",
"tslib": "^2.3.1",
"typescript": "^4.5.2"
"typescript": "^4.5.4"
},
"dependencies": {
"exceljs": "^4.2.1",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"yargs": "^17.2.1"
"yargs": "^17.3.1"
},
"eslintConfig": {
"overrides": [
Expand Down
53 changes: 21 additions & 32 deletions test/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ const ROOT_TEST_FOLDER = 'tests-for-diff';
// Build the parser used for that command
const parser = yargs.command(command, describeText, builder, handler).help();

// to concat faster command
type concat_cmd_type = (args: string[]) => string;
type prepare_mandatory_args_type = (...args: string[]) => string[];
const concat_cmd: concat_cmd_type = (args: string[]) =>
`diff ${args.join(' ')}`;
const prepare_mandatory_args: prepare_mandatory_args_type = (...files) => [
...files.map((file) => `"${file}"`),
];

// to access easier the paths of test file paths
const test_files_list = [
'file1.json',
Expand Down Expand Up @@ -68,7 +59,7 @@ type test_files_type = typeof test_files_list[number];
// files path
const TEST_FILES: { [x in test_files_type]: string } = test_files_list.reduce(
(acc: any, curr: test_files_type, idx: number) => {
acc[curr] = path.resolve(
acc[curr] = path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
idx < 10 ? VALID_TEST_FOLDER : USELESS_TEST_FOLDER,
Expand All @@ -79,6 +70,15 @@ const TEST_FILES: { [x in test_files_type]: string } = test_files_list.reduce(
{}
);

// to concat faster command
type concat_cmd_type = (args: string[]) => string;
type prepare_mandatory_args_type = (...args: test_files_type[]) => string[];
const concat_cmd: concat_cmd_type = (args: string[]) =>
`diff ${args.join(' ')}`;
const prepare_mandatory_args: prepare_mandatory_args_type = (...files) => [
...files.map((file) => `${TEST_FILES[file]}`),
];

// generate contents for comparison
const generate_i18_contents = (idx: number) => {
return [
Expand Down Expand Up @@ -228,9 +228,9 @@ const E2E_JSON_REPORTER: [
'--filename',
`"diff_inline-JSON"`,
'--outputDir',
`"${TEMP_FOLDER}"`,
`${TEMP_FOLDER}`,
],
path.resolve(TEMP_FOLDER, 'diff_inline-JSON.json'),
path.join(TEMP_FOLDER, 'diff_inline-JSON.json'),
{
files: {
file1: TEST_FILES[TEST_FILE_FILE1],
Expand All @@ -242,7 +242,7 @@ const E2E_JSON_REPORTER: [
[
'should work with two files',
[[TEST_FILE_JSON_SETTINGS1]],
path.resolve(TEMP_FOLDER, 'diff_settings1-JSON.json'),
path.join(TEMP_FOLDER, 'diff_settings1-JSON.json'),
{
files: {
file1: TEST_FILES[TEST_FILE_FILE1],
Expand Down Expand Up @@ -277,7 +277,7 @@ const E2E_JSON_REPORTER: [
[
'should work with three files',
[[TEST_FILE_JSON_SETTINGS2]],
path.resolve(TEMP_FOLDER, 'diff_settings2-JSON.json'),
path.join(TEMP_FOLDER, 'diff_settings2-JSON.json'),
{
files: {
file1: TEST_FILES[TEST_FILE_FILE1],
Expand Down Expand Up @@ -335,7 +335,7 @@ const E2E_JSON_REPORTER: [
[
'should work with js config file',
[[TEST_FILE_JSON_SETTINGS3]],
path.resolve(TEMP_FOLDER, 'diff_settings3-JSON.json'),
path.join(TEMP_FOLDER, 'diff_settings3-JSON.json'),
{
files: {
file1: TEST_FILES[TEST_FILE_FILE1],
Expand Down Expand Up @@ -374,11 +374,11 @@ const E2E_JSON_REPORTER: [
'--filename',
`"diff_flat_inline-JSON"`,
'--outputDir',
`"${TEMP_FOLDER}"`,
`${TEMP_FOLDER}`,
'--keySeparator',
`"false"`,
],
path.resolve(TEMP_FOLDER, 'diff_flat_inline-JSON.json'),
path.join(TEMP_FOLDER, 'diff_flat_inline-JSON.json'),
{
files: {
file1: TEST_FILES[TEST_FILE_FLAT_FILE1],
Expand All @@ -399,7 +399,7 @@ const E2E_JSON_REPORTER: [
[
'should respect user wanted operations for output',
[[TEST_FILE_JSON_SETTINGS4]],
path.resolve(TEMP_FOLDER, 'diff_settings4-JSON.json'),
path.join(TEMP_FOLDER, 'diff_settings4-JSON.json'),
{
files: {
file1: TEST_FILES[TEST_FILE_FILE1],
Expand Down Expand Up @@ -458,7 +458,7 @@ describe('[diff command]', () => {
// optional args
...otherArgs,
// mandatory args
...prepare_mandatory_args(...files.map((file) => TEST_FILES[file])),
...prepare_mandatory_args(...files),
]);
//console.warn(test_cmd);
// Test out if error message is thrown
Expand Down Expand Up @@ -500,23 +500,12 @@ describe('[diff command]', () => {

let test_cmd = concat_cmd([
...(files.length === 1
? [
'--settings',
...prepare_mandatory_args(
...files.map((file) => TEST_FILES[file])
),
]
? ['--settings', ...prepare_mandatory_args(...files)]
: []),
// optional args
...otherArgs,
// mandatory args (if needed)
...(files.length >= 2
? [
...prepare_mandatory_args(
...files.map((file) => TEST_FILES[file])
),
]
: []),
...(files.length >= 2 ? [...prepare_mandatory_args(...files)] : []),
]);

await parser.parseAsync(test_cmd);
Expand Down
16 changes: 8 additions & 8 deletions test/export/export-csv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const structure: fsify_structure = [
name: TEST_FILE_FILES,
contents: JSON.stringify(
generate_files(TRANSLATIONS_KEYS, (locale) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -156,7 +156,7 @@ const structure: fsify_structure = [
name: TEST_FILE_FLAT_FILES,
contents: JSON.stringify(
generate_files(TRANSLATIONS_KEYS, (locale) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -170,13 +170,13 @@ const structure: fsify_structure = [
type: fsify.FILE,
name: TEST_FILE_SETTINGS1,
contents: JSON.stringify({
files: path.resolve(
files: path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
TEST_FILE_FILES
),
columns: path.resolve(
columns: path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -192,7 +192,7 @@ const structure: fsify_structure = [
name: TEST_FILE_SETTINGS2,
contents: JSON.stringify({
files: generate_files(TRANSLATIONS_KEYS, (locale) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand Down Expand Up @@ -281,7 +281,7 @@ const structure: fsify_structure = [
name: TEST_FILE_FILES_DUP,
contents: JSON.stringify(
generate_files(TRANSLATIONS_KEYS, (_) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand Down Expand Up @@ -343,7 +343,7 @@ const TEST_FILES: { [x in test_files_type]: string } = test_files_list.reduce(
idx < 7 ? VALID_TEST_FOLDER : USELESS_TEST_FOLDER,
curr,
];
acc[curr] = path.resolve(...arr);
acc[curr] = path.join(...arr);
return acc;
},
{}
Expand Down Expand Up @@ -530,7 +530,7 @@ describe('[export_csv command]', () => {
]);
// example : 'settings1-output'
let filename = settingsFile.substring(0, settingsFile.lastIndexOf('.'));
let expectedFile = path.resolve(TEMP_FOLDER, `${filename}-output.csv`);
let expectedFile = path.join(TEMP_FOLDER, `${filename}-output.csv`);

// run command
//console.warn(test_cmd);
Expand Down
22 changes: 11 additions & 11 deletions test/export/export-xlsx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const structure: fsify_structure = [
name: TEST_FILE_FILES,
contents: JSON.stringify(
generate_files(TRANSLATIONS_KEYS, (locale) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -170,7 +170,7 @@ const structure: fsify_structure = [
name: TEST_FILE_FLAT_FILES,
contents: JSON.stringify(
generate_files(TRANSLATIONS_KEYS, (locale) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -190,13 +190,13 @@ const structure: fsify_structure = [
type: fsify.FILE,
name: TEST_FILE_SETTINGS1,
contents: JSON.stringify({
files: path.resolve(
files: path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
TEST_FILE_FILES
),
columns: path.resolve(
columns: path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -213,7 +213,7 @@ const structure: fsify_structure = [
name: TEST_FILE_SETTINGS2,
contents: JSON.stringify({
files: generate_files(TRANSLATIONS_KEYS, (locale) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -231,13 +231,13 @@ const structure: fsify_structure = [
type: fsify.FILE,
name: TEST_FILE_SETTINGS3,
contents: JSON.stringify({
files: path.resolve(
files: path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
TEST_FILE_FILES
),
columns: path.resolve(
columns: path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand All @@ -249,7 +249,7 @@ const structure: fsify_structure = [
'fixtures/export-xlsx',
'worksheetCustomizer-dynamic.js'
),
resultsFilter: path.resolve(
resultsFilter: path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand Down Expand Up @@ -344,7 +344,7 @@ const structure: fsify_structure = [
name: TEST_FILE_FILES_DUP,
contents: JSON.stringify(
generate_files(TRANSLATIONS_KEYS, (_) =>
path.resolve(
path.join(
TEMP_FOLDER,
ROOT_TEST_FOLDER,
VALID_TEST_FOLDER,
Expand Down Expand Up @@ -430,7 +430,7 @@ const TEST_FILES: { [x in test_files_type]: string } = test_files_list.reduce(
idx < 9 ? VALID_TEST_FOLDER : USELESS_TEST_FOLDER,
curr,
];
acc[curr] = path.resolve(...arr);
acc[curr] = path.join(...arr);
return acc;
},
{}
Expand Down Expand Up @@ -668,7 +668,7 @@ describe('[export_xlsx command]', () => {
]);
// example : 'settings1-output'
let filename = settingsFile.substring(0, settingsFile.lastIndexOf('.'));
let expectedFile = path.resolve(TEMP_FOLDER, `${filename}-output.xlsx`);
let expectedFile = path.join(TEMP_FOLDER, `${filename}-output.xlsx`);
// run command
//console.warn(test_cmd);
await parser.parseAsync(test_cmd);
Expand Down
8 changes: 4 additions & 4 deletions test/import/import-csv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const TEST_FILES: { [x in test_files_type]: string } = test_files_list.reduce(
idx > 0 && idx < 6 ? VALID_TEST_FOLDER : USELESS_TEST_FOLDER,
curr,
];
acc[curr] = path.resolve(...arr);
acc[curr] = path.join(...arr);
return acc;
},
{}
Expand Down Expand Up @@ -184,7 +184,7 @@ const structure: fsify_structure = [
input: TEST_FILES[TEST_FILE_INPUT],
columns: TEST_FILES[TEST_FILE_COLUMNS],
locales: ['FR', 'NL', 'DE'],
outputDir: path.resolve(TEMP_FOLDER, ROOT_TEST_FOLDER),
outputDir: path.join(TEMP_FOLDER, ROOT_TEST_FOLDER),
suffix: '_settings1',
}),
},
Expand All @@ -203,7 +203,7 @@ const structure: fsify_structure = [
},
},
locales: ['FR', 'NL', 'DE'],
outputDir: path.resolve(TEMP_FOLDER, ROOT_TEST_FOLDER),
outputDir: path.join(TEMP_FOLDER, ROOT_TEST_FOLDER),
suffix: '_settings2',
}),
},
Expand All @@ -222,7 +222,7 @@ const structure: fsify_structure = [
},
},
locales: ['FR', 'NL', 'DE'],
outputDir: path.resolve(TEMP_FOLDER, ROOT_TEST_FOLDER),
outputDir: path.join(TEMP_FOLDER, ROOT_TEST_FOLDER),
suffix: '_settings3',
keySeparator: false,
}),
Expand Down
6 changes: 3 additions & 3 deletions test/import/import-xlsx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const TEST_FILES: { [x in test_files_type]: string } = test_files_list.reduce(
idx > 0 && idx < 7 ? VALID_TEST_FOLDER : USELESS_TEST_FOLDER,
curr,
];
acc[curr] = path.resolve(...arr);
acc[curr] = path.join(...arr);
return acc;
},
{}
Expand Down Expand Up @@ -186,7 +186,7 @@ const structure: fsify_structure = [
input: TEST_FILES[TEST_FILE_INPUT],
columns: TEST_FILES[TEST_FILE_COLUMNS],
locales: ['FR', 'NL', 'DE'],
outputDir: path.resolve(TEMP_FOLDER, ROOT_TEST_FOLDER),
outputDir: path.join(TEMP_FOLDER, ROOT_TEST_FOLDER),
suffix: '_settings1',
}),
},
Expand All @@ -205,7 +205,7 @@ const structure: fsify_structure = [
},
},
locales: ['FR', 'NL', 'DE'],
outputDir: path.resolve(TEMP_FOLDER, ROOT_TEST_FOLDER),
outputDir: path.join(TEMP_FOLDER, ROOT_TEST_FOLDER),
suffix: '_settings2',
}),
},
Expand Down
Loading

0 comments on commit fe88589

Please sign in to comment.