diff --git a/test/dist.test.js b/test/dist.test.js index 23a5564..c7a021b 100644 --- a/test/dist.test.js +++ b/test/dist.test.js @@ -1,5 +1,4 @@ /* eslint-env es6, node */ -'use strict'; /* note: dynamic imports are used because 'dist' may not exist */ diff --git a/test/integration.test.js b/test/integration.test.js index 1c227c9..a0b5e32 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -4,8 +4,6 @@ // spell-checker:ignore (names) Deno ; (vars) ESM ESMs vNodeJSMajor vNodeJSminor ; (words) cyclomatic -'use strict'; - const fs = require('fs'); const path = require('path'); const util = require('util'); diff --git a/test/unit.test.js b/test/unit.test.js index 8c24967..149cdbd 100644 --- a/test/unit.test.js +++ b/test/unit.test.js @@ -1,7 +1,6 @@ /* eslint-disable functional/immutable-data , functional/no-loop-statement , security-node/non-literal-reg-expr , security/detect-non-literal-regexp , security/detect-object-injection */ /* eslint-env es6, node */ // spell-checker:ignore (vars) ESM ESMs vNodeJSMajor vNodeJSminor -'use strict'; const path = require('path'); @@ -26,13 +25,14 @@ function typeOf(value) { function xdgPathRegex(name) { return new RegExp( + // biome-ignore lint/style/useTemplate: # better clarity with comment '(^|' + regexpEscape(path.sep) + ')' + regexpEscape(name) + '(' + // for windows, `name` may be embedded within the generated paths (instead of always trailing as in MacOS/*nix) - (isWinOS ? regexpEscape(path.sep) + '|' : '') + + (isWinOS ? `${regexpEscape(path.sep)}|` : '') + '$)', ); } @@ -324,8 +324,8 @@ test('correct paths with only XDG_*_HOME set', (t) => { data: 'XDG_DATA_HOME', state: 'XDG_STATE_HOME', }; - delete process.env.XDG_CONFIG_DIRS; - delete process.env.XDG_DATA_DIRS; + process.env.XDG_CONFIG_DIRS = void 0; + process.env.XDG_DATA_DIRS = void 0; Object.keys(envVars).forEach((key) => { const env = envVars[key]; process.env[env] = path.join('.', env); @@ -385,8 +385,8 @@ test('correct "isolated" paths with only XDG_*_HOME set', (t) => { data: 'XDG_DATA_HOME', state: 'XDG_STATE_HOME', }; - delete process.env.XDG_CONFIG_DIRS; - delete process.env.XDG_DATA_DIRS; + process.env.XDG_CONFIG_DIRS = void 0; + process.env.XDG_DATA_DIRS = void 0; for (const key of Object.keys(envVars)) { const env = envVars[key]; process.env[env] = path.join('.', env); @@ -446,8 +446,8 @@ test('correct non-"isolated" paths with only XDG_*_HOME set', (t) => { data: 'XDG_DATA_HOME', state: 'XDG_STATE_HOME', }; - delete process.env.XDG_CONFIG_DIRS; - delete process.env.XDG_DATA_DIRS; + process.env.XDG_CONFIG_DIRS = void 0; + process.env.XDG_DATA_DIRS = void 0; Object.keys(envVars).forEach((key) => { const env = envVars[key]; process.env[env] = path.join('.', env); @@ -685,8 +685,7 @@ test('correct non-"isolated" paths with XDG_* set', (t) => { test('correctly derive anonymous (CJS)', (t) => { const command = 'node'; process.env.TEST_MODULE_PATH = './build/lab/src/mod.cjs.js'; - const script = - '"p = require(\'' + process.env.TEST_MODULE_PATH + '\'); console.log(p.$name({}));"'; + const script = `"p = require('${process.env.TEST_MODULE_PATH}'); console.log(p.$name({}));"`; const args = ['-e', isWinOS ? script : script.replace('$name', '\\$name')]; const options = { shell: true, encoding: 'utf-8' }; @@ -705,8 +704,7 @@ if (settledSupportForESMs) { test('correctly derive anonymous (ESM/[import CJS])', (t) => { const command = 'node'; process.env.TEST_MODULE_PATH = './build/lab/src/mod.cjs.js'; - const script = - '"import p from \'' + process.env.TEST_MODULE_PATH + '\'; console.log(p.$name({}));"'; + const script = `"import p from '${process.env.TEST_MODULE_PATH}'; console.log(p.$name({}));"`; const args = [ '--input-type=module', '-e', @@ -728,8 +726,7 @@ if (settledSupportForESMs) { test('correctly derive anonymous (ESM/[esm-wrapper])', (t) => { const command = 'node'; process.env.TEST_MODULE_PATH = './build/lab/src/esm-wrapper/mod.esm.js'; - const script = - '"import p from \'' + process.env.TEST_MODULE_PATH + '\'; console.log(p.$name({}));"'; + const script = `"import p from '${process.env.TEST_MODULE_PATH}'; console.log(p.$name({}));"`; const args = [ '--input-type=module', '-e', @@ -751,8 +748,7 @@ if (settledSupportForESMs) { test('correctly derive anonymous (ESM)', (t) => { const command = 'node'; process.env.TEST_MODULE_PATH = './build/esm/src/mod.esm.js'; - const script = - '"import p from \'' + process.env.TEST_MODULE_PATH + '\'; console.log(p.$name({}));"'; + const script = `"import p from '${process.env.TEST_MODULE_PATH}'; console.log(p.$name({}));"`; const args = [ '--input-type=module', '-e',