mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
.cjs file support for config files
This commit is contained in:
@@ -11,7 +11,6 @@ export class CLIUtils {
|
||||
public static readonly allowedConfigFileExtensions: string[] = [
|
||||
'.js',
|
||||
'.json',
|
||||
'.mjs',
|
||||
'.cjs'
|
||||
];
|
||||
|
||||
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
compact: true,
|
||||
exclude: ['**/foo.js'],
|
||||
selfDefending: false,
|
||||
sourceMap: true
|
||||
};
|
||||
@@ -31,7 +31,29 @@ describe('CLIUtils', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #2: json file with config', () => {
|
||||
describe('Variant #2: cjs file with config', () => {
|
||||
const configDirName: string = 'test/fixtures';
|
||||
const configFileName: string = 'config.cjs';
|
||||
const configFilePath: string = `../../../${configDirName}/${configFileName}`;
|
||||
const expectedResult: TInputOptions = {
|
||||
compact: true,
|
||||
exclude: ['**/foo.js'],
|
||||
selfDefending: false,
|
||||
sourceMap: true
|
||||
};
|
||||
|
||||
let result: Object;
|
||||
|
||||
before(() => {
|
||||
result = CLIUtils.getUserConfig(configFilePath);
|
||||
});
|
||||
|
||||
it('should return object with user configuration', () => {
|
||||
assert.deepEqual(result, expectedResult);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Variant #3: json file with config', () => {
|
||||
const configDirName: string = 'test/fixtures';
|
||||
const configFileName: string = 'config.json';
|
||||
const configFilePath: string = `../../../${configDirName}/${configFileName}`;
|
||||
|
||||
Reference in New Issue
Block a user