mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
added setup spec for global tests configuration
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
import { BabelPolyfill } from './polyfills/BabelPolyfill';
|
||||
|
||||
import { JavaScriptObfuscator } from "../src/JavaScriptObfuscator";
|
||||
|
||||
import { NO_CUSTOM_NODES_PRESET } from "../src/preset-options/NoCustomNodesPreset";
|
||||
|
||||
const assert: Chai.AssertStatic = require('chai').assert;
|
||||
|
||||
BabelPolyfill.append();
|
||||
|
||||
describe('JavaScriptObfuscator', () => {
|
||||
describe('obfuscate (sourceCode: string, customOptions?: IOptionsPreset): string', () => {
|
||||
it('should obfuscate simple code with variable inside global scope', () => {
|
||||
|
||||
@@ -2,16 +2,12 @@ import * as fs from 'fs';
|
||||
import * as mkdirp from 'mkdirp';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { BabelPolyfill } from './polyfills/BabelPolyfill';
|
||||
|
||||
import { StdoutWriteMock } from "../test/mocks/StdoutWriteMock";
|
||||
|
||||
import { JavaScriptObfuscator } from "../src/JavaScriptObfuscator";
|
||||
|
||||
const assert: Chai.AssertStatic = require('chai').assert;
|
||||
|
||||
BabelPolyfill.append();
|
||||
|
||||
describe('JavaScriptObfuscatorCLI', function (): void {
|
||||
let fixturesDirName: string = 'test/fixtures',
|
||||
fixtureFileName: string = 'sample.js',
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { BabelPolyfill } from './polyfills/BabelPolyfill';
|
||||
|
||||
import { IBlockStatementNode } from "../src/interfaces/nodes/IBlockStatementNode";
|
||||
import { IFunctionDeclarationNode } from "../src/interfaces/nodes/IFunctionDeclarationNode";
|
||||
import { IIdentifierNode } from "../src/interfaces/nodes/IIdentifierNode";
|
||||
@@ -14,8 +12,6 @@ import { NodeUtils } from '../src/NodeUtils';
|
||||
|
||||
const assert: any = require('chai').assert;
|
||||
|
||||
BabelPolyfill.append();
|
||||
|
||||
function getProgramNode (bodyNodes: INode[] = []): IProgramNode {
|
||||
return {
|
||||
type: NodeType.Program,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { BabelPolyfill } from './polyfills/BabelPolyfill';
|
||||
|
||||
import { IOptionsPreset } from "../src/interfaces/IOptionsPreset";
|
||||
|
||||
import { OptionsNormalizer } from '../src/OptionsNormalizer';
|
||||
@@ -8,8 +6,6 @@ import { DEFAULT_PRESET } from '../src/preset-options/DefaultPreset';
|
||||
|
||||
const assert: Chai.AssertStatic = require('chai').assert;
|
||||
|
||||
BabelPolyfill.append();
|
||||
|
||||
describe('OptionsNormalizer', () => {
|
||||
describe('normalizeOptionsPreset (options: IOptionsPreset): IOptionsPreset', () => {
|
||||
let optionsPreset1: IOptionsPreset = Object.assign({}, DEFAULT_PRESET, {
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import { BabelPolyfill } from './polyfills/BabelPolyfill';
|
||||
|
||||
import { Utils } from '../src/Utils';
|
||||
|
||||
import { JSFuck } from '../src/enums/JSFuck';
|
||||
|
||||
const assert: Chai.AssertStatic = require('chai').assert;
|
||||
|
||||
BabelPolyfill.append();
|
||||
|
||||
describe('Utils', () => {
|
||||
describe('arrayContains (array: any[], searchElement: any): boolean', () => {
|
||||
it('should return boolean depends on condition if array is contains given value or not', () => {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import { BabelPolyfill } from '../polyfills/BabelPolyfill';
|
||||
|
||||
before(() => {
|
||||
BabelPolyfill.append();
|
||||
});
|
||||
Reference in New Issue
Block a user