Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions integration-tests/appsec/iast-esbuild.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ describe('esbuild support for IAST', () => {
let proc, agent, sandbox, axios
let applicationDir, bundledApplicationDir

before(async () => {
before(async function () {
this.timeout(120_000)
sandbox = await createSandbox([])
const cwd = sandbox.folder
applicationDir = path.join(cwd, 'appsec/iast-esbuild')
Expand All @@ -26,16 +27,33 @@ describe('esbuild support for IAST', () => {
const craftedNodeModulesDir = path.join(applicationDir, 'tmp_node_modules')
fs.mkdirSync(craftedNodeModulesDir)
await exec('npm init -y', { cwd: craftedNodeModulesDir })
await exec('npm install @datadog/wasm-js-rewriter @datadog/native-iast-taint-tracking', {
cwd: craftedNodeModulesDir,
timeout: 3e3
})

// Install app deps
await exec('npm install || npm install', {
cwd: applicationDir,
timeout: 6e3
})
try {
await exec('npm install @datadog/wasm-js-rewriter @datadog/native-iast-taint-tracking', {
cwd: craftedNodeModulesDir,
timeout: 3e3
})
} catch {
await exec('sleep 60')
await exec('npm install @datadog/wasm-js-rewriter @datadog/native-iast-taint-tracking', {
cwd: craftedNodeModulesDir,
timeout: 3e3
})
}

try {
// Install app deps
await exec('npm install', {
cwd: applicationDir,
timeout: 6e3
})
} catch {
await exec('sleep 60')
await exec('npm install', {
cwd: applicationDir,
timeout: 6e3
})
}

// Bundle the application
await exec('npm run build', {
Expand Down