Skip to content

Commit d1370c8

Browse files
committed
Remove eslint-disable no-undef and add jest in eslint config
1. Remove eslint-disable no-undef in the Jest test files and add jest in eslint config. 2. Add the function fail in file test_nc_master_keys.test. Signed-off-by: shirady <[email protected]>
1 parent f981264 commit d1370c8

15 files changed

+8
-14
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
env: {
1313
node: true,
1414
es2022: true,
15+
jest: true,
1516
},
1617

1718
// See https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-environments

src/test/unit_tests/jest_tests/test_bucket_diff.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2023 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
// disabling init_rand_seed as it takes longer than the actual test execution

src/test/unit_tests/jest_tests/test_bucket_log_based_replication.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2023 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
// disabling init_rand_seed as it takes longer than the actual test execution

src/test/unit_tests/jest_tests/test_list_object.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2016 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54

src/test/unit_tests/jest_tests/test_nc_master_keys.test.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2024 NooBaa */
2-
/* eslint-disable no-undef */
32

43
'use strict';
54

@@ -136,3 +135,10 @@ async function read_master_keys_json() {
136135
const master_keys = JSON.parse(data.toString());
137136
return master_keys;
138137
}
138+
139+
// Jest has builtin function fail that based on Jasmine
140+
// in case Jasmine would get removed from jest, created this one
141+
// based on this: https://stackoverflow.com/a/55526098/16571658
142+
function fail(reason) {
143+
throw new Error(reason);
144+
}

src/test/unit_tests/jest_tests/test_nc_master_keys_exec.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2024 NooBaa */
2-
/* eslint-disable no-undef */
32

43
'use strict';
54

src/test/unit_tests/jest_tests/test_nc_nsfs_account_cli.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2016 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
// disabling init_rand_seed as it takes longer than the actual test execution

src/test/unit_tests/jest_tests/test_nc_nsfs_account_schema_validation.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2024 NooBaa */
2-
/* eslint-disable no-undef */
32

43
'use strict';
54

src/test/unit_tests/jest_tests/test_nc_nsfs_bucket_cli.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2016 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
// disabling init_rand_seed as it takes longer than the actual test execution

src/test/unit_tests/jest_tests/test_nc_nsfs_bucket_schema_validation.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2024 NooBaa */
2-
/* eslint-disable no-undef */
32

43
'use strict';
54

src/test/unit_tests/jest_tests/test_nc_nsfs_config_schema_validation.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2024 NooBaa */
2-
/* eslint-disable no-undef */
32

43
'use strict';
54

src/test/unit_tests/jest_tests/test_nc_nsfs_new_buckets_path_validation.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2016 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
// disabling init_rand_seed as it takes longer than the actual test execution

src/test/unit_tests/jest_tests/test_noobaa_s3_client.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2023 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
const { NodeHttpHandler } = require("@smithy/node-http-handler");

src/test/unit_tests/jest_tests/test_os_utils.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2016 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
const child_process = require('child_process');

src/test/unit_tests/jest_tests/test_s3_utils.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* Copyright (C) 2016 NooBaa */
2-
/* eslint-disable no-undef */
32
'use strict';
43

54
const s3_utils = require('../../../endpoint/s3/s3_utils');

0 commit comments

Comments
 (0)