Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Jun 27, 2024
1 parent 0f0dc06 commit 2fbd88e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/js/compiler/compiler_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package compiler

import (
"context"
"strings"
"testing"
"time"

"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/gologger/levels"
"github.com/projectdiscovery/nuclei/v3/pkg/types"
)

func TestNewCompilerConsoleDebug(t *testing.T) {
Expand All @@ -18,7 +21,15 @@ func TestNewCompilerConsoleDebug(t *testing.T) {
})

compiler := New()
_, err := compiler.Execute("console.log('hello world');", NewExecuteArgs())
p, err := WrapScriptNCompile("console.log('hello world');", false)
if err != nil {
t.Fatal(err)
}

_, err = compiler.ExecuteWithOptions(p, NewExecuteArgs(), &ExecuteOptions{Context: context.Background(),
Timeout: 10,
TimeoutVariants: types.TimeoutVariants{JsCompilerExecutionTimeout: time.Duration(10) * time.Second}},
)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 2fbd88e

Please sign in to comment.