From 84bafd11d52609e74a52df8e57752d5e3c25f717 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 3 Mar 2023 18:27:05 -0400 Subject: fix: lazily surface errors in package.json deps parsing (#17974) Closes #17941 --- cli/tests/testdata/package_json/invalid_value/error.ts | 4 ++++ cli/tests/testdata/package_json/invalid_value/error.ts.out | 6 ++++++ cli/tests/testdata/package_json/invalid_value/ok.ts | 4 ++++ cli/tests/testdata/package_json/invalid_value/ok.ts.out | 3 +++ cli/tests/testdata/package_json/invalid_value/package.json | 9 +++++++++ cli/tests/testdata/package_json/invalid_value/task.out | 6 ++++++ 6 files changed, 32 insertions(+) create mode 100644 cli/tests/testdata/package_json/invalid_value/error.ts create mode 100644 cli/tests/testdata/package_json/invalid_value/error.ts.out create mode 100644 cli/tests/testdata/package_json/invalid_value/ok.ts create mode 100644 cli/tests/testdata/package_json/invalid_value/ok.ts.out create mode 100644 cli/tests/testdata/package_json/invalid_value/package.json create mode 100644 cli/tests/testdata/package_json/invalid_value/task.out (limited to 'cli/tests/testdata') diff --git a/cli/tests/testdata/package_json/invalid_value/error.ts b/cli/tests/testdata/package_json/invalid_value/error.ts new file mode 100644 index 000000000..fd75d633c --- /dev/null +++ b/cli/tests/testdata/package_json/invalid_value/error.ts @@ -0,0 +1,4 @@ +// the package.json will error when importing +import * as test from "@denotest/cjs-default-export"; + +console.log(test); diff --git a/cli/tests/testdata/package_json/invalid_value/error.ts.out b/cli/tests/testdata/package_json/invalid_value/error.ts.out new file mode 100644 index 000000000..866388e60 --- /dev/null +++ b/cli/tests/testdata/package_json/invalid_value/error.ts.out @@ -0,0 +1,6 @@ +error: Parsing version constraints in the application-level package.json is more strict at the moment. + +Invalid npm specifier version requirement. Unexpected character. + invalid stuff that won't parse + ~ + at file:///[WILDCARD]/error.ts:2:23 diff --git a/cli/tests/testdata/package_json/invalid_value/ok.ts b/cli/tests/testdata/package_json/invalid_value/ok.ts new file mode 100644 index 000000000..ce517439f --- /dev/null +++ b/cli/tests/testdata/package_json/invalid_value/ok.ts @@ -0,0 +1,4 @@ +import * as test from "@denotest/esm-basic"; + +test.setValue(2); +console.log(test.getValue()); diff --git a/cli/tests/testdata/package_json/invalid_value/ok.ts.out b/cli/tests/testdata/package_json/invalid_value/ok.ts.out new file mode 100644 index 000000000..3c7e2792f --- /dev/null +++ b/cli/tests/testdata/package_json/invalid_value/ok.ts.out @@ -0,0 +1,3 @@ +Download http://localhost:4545/npm/registry/@denotest/esm-basic +Download http://localhost:4545/npm/registry/@denotest/esm-basic/1.0.0.tgz +2 diff --git a/cli/tests/testdata/package_json/invalid_value/package.json b/cli/tests/testdata/package_json/invalid_value/package.json new file mode 100644 index 000000000..c8857649e --- /dev/null +++ b/cli/tests/testdata/package_json/invalid_value/package.json @@ -0,0 +1,9 @@ +{ + "scripts": { + "test": "echo 1" + }, + "dependencies": { + "@denotest/esm-basic": "*", + "@denotest/cjs-default-export": "invalid stuff that won't parse" + } +} diff --git a/cli/tests/testdata/package_json/invalid_value/task.out b/cli/tests/testdata/package_json/invalid_value/task.out new file mode 100644 index 000000000..914dc27c6 --- /dev/null +++ b/cli/tests/testdata/package_json/invalid_value/task.out @@ -0,0 +1,6 @@ +Warning Ignoring dependency '@denotest/cjs-default-export' in package.json because its version requirement failed to parse: Invalid npm specifier version requirement. Unexpected character. + invalid stuff that won't parse + ~ +Warning Currently only basic package.json `scripts` are supported. Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in the upcoming release. +Task test echo 1 +1 -- cgit v1.2.3