From b8c44be59947db13145c573382d62d5c59ab3e22 Mon Sep 17 00:00:00 2001 From: Asger F Date: Thu, 12 Mar 2026 09:46:35 +0100 Subject: [PATCH] Add QL test for bun/tsx shebang recognition in TypeScript files Add test files with #!/usr/bin/env bun, #!/usr/bin/env tsx, and #!/usr/bin/env node shebangs. The query lists extracted .ts files, verifying that all three shebangs are recognized and the files are not skipped by the extractor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../test/library-tests/TypeScript/Shebangs/Shebangs.expected | 4 ++++ .../ql/test/library-tests/TypeScript/Shebangs/Shebangs.ql | 4 ++++ .../ql/test/library-tests/TypeScript/Shebangs/shebang_bun.ts | 2 ++ .../ql/test/library-tests/TypeScript/Shebangs/shebang_node.ts | 2 ++ .../ql/test/library-tests/TypeScript/Shebangs/shebang_tsx.ts | 2 ++ .../ql/test/library-tests/TypeScript/Shebangs/tsconfig.json | 3 +++ 6 files changed, 17 insertions(+) create mode 100644 javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.expected create mode 100644 javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.ql create mode 100644 javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_bun.ts create mode 100644 javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_node.ts create mode 100644 javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_tsx.ts create mode 100644 javascript/ql/test/library-tests/TypeScript/Shebangs/tsconfig.json diff --git a/javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.expected b/javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.expected new file mode 100644 index 00000000000..3f4d018029a --- /dev/null +++ b/javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.expected @@ -0,0 +1,4 @@ +| shebang_bun.ts | +| shebang_node.ts | +| shebang_tsx.ts | +| tsconfig.json | diff --git a/javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.ql b/javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.ql new file mode 100644 index 00000000000..1b3590b82d0 --- /dev/null +++ b/javascript/ql/test/library-tests/TypeScript/Shebangs/Shebangs.ql @@ -0,0 +1,4 @@ +import javascript + +from File f +select f.getRelativePath() diff --git a/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_bun.ts b/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_bun.ts new file mode 100644 index 00000000000..417e04ff16a --- /dev/null +++ b/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_bun.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env bun +const x: number = 1; diff --git a/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_node.ts b/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_node.ts new file mode 100644 index 00000000000..10b11969aa5 --- /dev/null +++ b/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_node.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +const x: number = 1; diff --git a/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_tsx.ts b/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_tsx.ts new file mode 100644 index 00000000000..31331240ced --- /dev/null +++ b/javascript/ql/test/library-tests/TypeScript/Shebangs/shebang_tsx.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env tsx +const x: number = 1; diff --git a/javascript/ql/test/library-tests/TypeScript/Shebangs/tsconfig.json b/javascript/ql/test/library-tests/TypeScript/Shebangs/tsconfig.json new file mode 100644 index 00000000000..82194fc7ab0 --- /dev/null +++ b/javascript/ql/test/library-tests/TypeScript/Shebangs/tsconfig.json @@ -0,0 +1,3 @@ +{ + "include": ["."] +}