From 968f441da32ae5fc3783a4f9bcda3d34fa276b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 16 Sep 2024 14:39:58 +0100 Subject: test: rewrite some ignored tests to spec tests (#25652) Ref https://github.com/denoland/deno/issues/25241 Rewritten these tests: - check::package_json_basic - check::package_json_fail_check - check::package_json_with_deno_json - info::package_json_basic - test::package_json_basic - run::package_json_auto_discovered_for_npm_binary - run::package_json_with_deno_json --- tests/specs/check/package_json_fail_check/__test__.jsonc | 14 ++++++++++++++ tests/specs/check/package_json_fail_check/fail_check.out | 4 ++++ tests/specs/check/package_json_fail_check/fail_check.ts | 3 +++ tests/specs/check/package_json_fail_check/install.out | 3 +++ tests/specs/check/package_json_fail_check/lib.ts | 9 +++++++++ tests/specs/check/package_json_fail_check/package.json | 5 +++++ 6 files changed, 38 insertions(+) create mode 100644 tests/specs/check/package_json_fail_check/__test__.jsonc create mode 100644 tests/specs/check/package_json_fail_check/fail_check.out create mode 100644 tests/specs/check/package_json_fail_check/fail_check.ts create mode 100644 tests/specs/check/package_json_fail_check/install.out create mode 100644 tests/specs/check/package_json_fail_check/lib.ts create mode 100644 tests/specs/check/package_json_fail_check/package.json (limited to 'tests/specs/check/package_json_fail_check') diff --git a/tests/specs/check/package_json_fail_check/__test__.jsonc b/tests/specs/check/package_json_fail_check/__test__.jsonc new file mode 100644 index 000000000..e5b4a4db0 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + "args": "check --quiet fail_check.ts", + "output": "fail_check.out", + "exitCode": 1 + } + ] +} diff --git a/tests/specs/check/package_json_fail_check/fail_check.out b/tests/specs/check/package_json_fail_check/fail_check.out new file mode 100644 index 000000000..03997a051 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/fail_check.out @@ -0,0 +1,4 @@ +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const _test: string = getValue(); + ~~~~~ + at file:///[WILDCARD]/fail_check.ts:3:7 diff --git a/tests/specs/check/package_json_fail_check/fail_check.ts b/tests/specs/check/package_json_fail_check/fail_check.ts new file mode 100644 index 000000000..cef10763d --- /dev/null +++ b/tests/specs/check/package_json_fail_check/fail_check.ts @@ -0,0 +1,3 @@ +import { getValue } from "./lib.ts"; + +const _test: string = getValue(); diff --git a/tests/specs/check/package_json_fail_check/install.out b/tests/specs/check/package_json_fail_check/install.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/check/package_json_fail_check/install.out @@ -0,0 +1,3 @@ +Download http://localhost:4260/@denotest/esm-basic +Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz +Initialize @denotest/esm-basic@1.0.0 diff --git a/tests/specs/check/package_json_fail_check/lib.ts b/tests/specs/check/package_json_fail_check/lib.ts new file mode 100644 index 000000000..1deed81f7 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/lib.ts @@ -0,0 +1,9 @@ +import * as test from "@denotest/esm-basic"; + +export function add(a: number, b: number) { + return a + b; +} + +export function getValue() { + return test.getValue(); +} diff --git a/tests/specs/check/package_json_fail_check/package.json b/tests/specs/check/package_json_fail_check/package.json new file mode 100644 index 000000000..54ca824d6 --- /dev/null +++ b/tests/specs/check/package_json_fail_check/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@denotest/esm-basic": "*" + } +} -- cgit v1.2.3