Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions acceptance/apps/validate-package-manager/bin/npm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
printf '%s %s\n' "${0##*/}" "$*" >> commands.log
if [ "$*" = "${VALIDATION_TEST_FAIL:-}" ]; then
echo "validation stdout"
echo "validation stderr" >&2
exit 17
fi
7 changes: 7 additions & 0 deletions acceptance/apps/validate-package-manager/bin/npm.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
echo %~n0 %*>>commands.log
if "%*"=="%VALIDATION_TEST_FAIL%" (
echo validation stdout
echo validation stderr 1>&2
exit /b 17
)
7 changes: 7 additions & 0 deletions acceptance/apps/validate-package-manager/bin/pnpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
printf '%s %s\n' "${0##*/}" "$*" >> commands.log
if [ "$*" = "${VALIDATION_TEST_FAIL:-}" ]; then
echo "validation stdout"
echo "validation stderr" >&2
exit 17
fi
7 changes: 7 additions & 0 deletions acceptance/apps/validate-package-manager/bin/pnpm.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
echo %~n0 %*>>commands.log
if "%*"=="%VALIDATION_TEST_FAIL%" (
echo validation stdout
echo validation stderr 1>&2
exit /b 17
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"packageManager": "npm@10.9.2"
}
2 changes: 2 additions & 0 deletions acceptance/apps/validate-package-manager/out.test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Cloud = false
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]
36 changes: 36 additions & 0 deletions acceptance/apps/validate-package-manager/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

=== Warn but continue on conflicting lockfiles
>>> [CLI] apps validate --path conflicting
Warn: found conflicting package managers; using npm from package-lock.json and ignoring pnpm-lock.yaml
Validating project using npm...
✅ Installing dependencies ([DURATION])
✅ Generating types ([DURATION])
✅ Running AST-grep lint ([DURATION])
✅ Type checking ([DURATION])
✅ Building ([DURATION])
✅ Running tests ([DURATION])
✅ All validation checks passed ([DURATION])

=== Warn but continue on unsupported lockfiles
>>> [CLI] apps validate --path unsupported
Warn: ignoring unsupported lockfile yarn.lock; apps validation uses npm or pnpm
Validating project using npm...
✅ Installing dependencies ([DURATION])
✅ Generating types ([DURATION])
✅ Running AST-grep lint ([DURATION])
✅ Type checking ([DURATION])
✅ Building ([DURATION])
✅ Running tests ([DURATION])
✅ All validation checks passed ([DURATION])

=== Declared package manager wins over a pnpm lockfile
>>> [CLI] apps validate --path metadata-npm
Warn: found conflicting package managers; using npm from package.json and ignoring pnpm-lock.yaml
Validating project using npm...
✅ Installing dependencies ([DURATION])
✅ Generating types ([DURATION])
✅ Running AST-grep lint ([DURATION])
✅ Type checking ([DURATION])
✅ Building ([DURATION])
✅ Running tests ([DURATION])
✅ All validation checks passed ([DURATION])
10 changes: 10 additions & 0 deletions acceptance/apps/validate-package-manager/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export PATH="$PWD/bin:$PATH"

title "Warn but continue on conflicting lockfiles"
trace $CLI apps validate --path conflicting

title "Warn but continue on unsupported lockfiles"
trace $CLI apps validate --path unsupported

title "Declared package manager wins over a pnpm lockfile"
trace $CLI apps validate --path metadata-npm
6 changes: 6 additions & 0 deletions acceptance/apps/validate-package-manager/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]
Ignore = ["commands.log"]

[[Repls]]
Old = '\d+\.\d+s'
New = '[DURATION]'
5 changes: 0 additions & 5 deletions acceptance/apps/validate/bom/package.json

This file was deleted.

1 change: 0 additions & 1 deletion acceptance/apps/validate/invalid/package.json

This file was deleted.

8 changes: 0 additions & 8 deletions acceptance/apps/validate/lifecycle/add-build/package.json

This file was deleted.

8 changes: 0 additions & 8 deletions acceptance/apps/validate/lifecycle/invalidated/package.json

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions acceptance/apps/validate/lifecycle/update-manifest.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions acceptance/apps/validate/metadata-npm/databricks.yml

This file was deleted.

8 changes: 0 additions & 8 deletions acceptance/apps/validate/metadata-npm/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions acceptance/apps/validate/non-runnable/package.json

This file was deleted.

1 change: 0 additions & 1 deletion acceptance/apps/validate/null/package.json

This file was deleted.

112 changes: 0 additions & 112 deletions acceptance/apps/validate/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,115 +82,3 @@ pnpm run --if-present typegen
pnpm run --if-present lint:ast-grep
pnpm run --if-present typecheck
pnpm run --if-present build

=== Warn but continue on conflicting lockfiles
>>> [CLI] apps validate --path conflicting
Warn: found conflicting package managers; using npm from package-lock.json and ignoring pnpm-lock.yaml
Validating project using npm...
✅ Installing dependencies ([DURATION])
✅ Generating types ([DURATION])
✅ Running AST-grep lint ([DURATION])
✅ Type checking ([DURATION])
✅ Building ([DURATION])
✅ Running tests ([DURATION])
✅ All validation checks passed ([DURATION])

=== Warn but continue on unsupported lockfiles
>>> [CLI] apps validate --path unsupported
Warn: ignoring unsupported lockfile yarn.lock; apps validation uses npm or pnpm
Validating project using npm...
✅ Installing dependencies ([DURATION])
✅ Generating types ([DURATION])
✅ Running AST-grep lint ([DURATION])
✅ Type checking ([DURATION])
✅ Building ([DURATION])
✅ Running tests ([DURATION])
✅ All validation checks passed ([DURATION])

=== Validate npm workspace scripts without root scripts
>>> grep -x workspace build ran LOG.workspaces
workspace build ran

>>> grep -F validation failed (exit code 17) LOG.workspaces
validation failed (exit code 17)

=== Deploy rejects a failing npm workspace build
>>> grep -x workspace build ran LOG.workspaces-deploy
workspace build ran

>>> grep -F validation failed - fix errors before deploying LOG.workspaces-deploy
Error: validation failed - fix errors before deploying

=== Use declared npm despite a pnpm lockfile
>>> grep -x declared npm build ran LOG.metadata-npm
declared npm build ran

>>> grep -F validation failed (exit code 17) LOG.metadata-npm
validation failed (exit code 17)

=== Deploy honors the declared package manager
>>> grep -x declared npm build ran LOG.metadata-npm-deploy
declared npm build ran

>>> grep -F validation failed - fix errors before deploying LOG.metadata-npm-deploy
Error: validation failed - fix errors before deploying

=== Reject a missing package.json
>>> musterr [CLI] apps validate --path missing
Error: no supported project type detected (looking for package.json)

=== Report native manifest errors with dependencies absent
>>> grep -x Error: validation failed LOG.invalid-absent
Error: validation failed

=== Report native manifest errors with dependencies present
>>> grep -x Error: validation failed LOG.invalid-present
Error: validation failed

=== Reject a null manifest through the package manager
>>> grep -x Error: validation failed LOG.null
Error: validation failed

=== Run scripts from a manifest with a UTF-8 BOM
>>> grep -x BOM build ran LOG.bom
BOM build ran

>>> grep -F validation failed (exit code 17) LOG.bom
validation failed (exit code 17)

=== Let the package manager ignore non-runnable script entries
>>> grep -x non-runnable entries ignored LOG.non-runnable
non-runnable entries ignored

>>> grep -F validation failed (exit code 17) LOG.non-runnable
validation failed (exit code 17)

=== Run a build added by install
>>> grep -x added build ran LOG.add-build-install
added build ran

>>> grep -F validation failed (exit code 17) LOG.add-build-install
validation failed (exit code 17)

=== Skip a build removed by install
>>> grep -F All validation checks passed LOG.remove-build-install
✅ All validation checks passed ([DURATION])

=== Report native errors after install invalidates the manifest
>>> grep -x Error: validation failed LOG.invalidated-install
Error: validation failed

=== Run a build added by typegen
>>> grep -x added build ran LOG.add-build-typegen
added build ran

>>> grep -F validation failed (exit code 17) LOG.add-build-typegen
validation failed (exit code 17)

=== Skip a build removed by typegen
>>> grep -F All validation checks passed LOG.remove-build-typegen
✅ All validation checks passed ([DURATION])

=== Report native errors after typegen invalidates the manifest
>>> grep -x Error: validation failed LOG.invalidated-typegen
Error: validation failed
80 changes: 0 additions & 80 deletions acceptance/apps/validate/script
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
validation_path="$PATH"
export PATH="$PWD/bin:$PATH"

title "Validate the directory selected by --path"
Expand All @@ -15,82 +14,3 @@ trace VALIDATION_TEST_FAIL="run --if-present build" musterr $CLI apps deploy

title "Commands executed in the project directory"
trace cat commands.log

title "Warn but continue on conflicting lockfiles"
trace $CLI apps validate --path conflicting

title "Warn but continue on unsupported lockfiles"
trace $CLI apps validate --path unsupported

title "Validate npm workspace scripts without root scripts"
export PATH="$validation_path"
mkdir -p workspaces/node_modules
trace musterr $CLI apps validate --path workspaces &> LOG.workspaces
trace grep -x "workspace build ran" LOG.workspaces
trace grep -F "validation failed (exit code 17)" LOG.workspaces

title "Deploy rejects a failing npm workspace build"
trace withdir workspaces musterr $CLI apps deploy &> LOG.workspaces-deploy
trace grep -x "workspace build ran" LOG.workspaces-deploy
trace grep -F "validation failed - fix errors before deploying" LOG.workspaces-deploy

title "Use declared npm despite a pnpm lockfile"
mkdir -p metadata-npm/node_modules
trace musterr $CLI apps validate --path metadata-npm &> LOG.metadata-npm
trace grep -x "declared npm build ran" LOG.metadata-npm
trace grep -F "validation failed (exit code 17)" LOG.metadata-npm

title "Deploy honors the declared package manager"
trace withdir metadata-npm musterr $CLI apps deploy &> LOG.metadata-npm-deploy
trace grep -x "declared npm build ran" LOG.metadata-npm-deploy
trace grep -F "validation failed - fix errors before deploying" LOG.metadata-npm-deploy

title "Reject a missing package.json"
mkdir missing
trace musterr $CLI apps validate --path missing

for dependencies in absent present; do
title "Report native manifest errors with dependencies $dependencies"
trace musterr $CLI apps validate --path invalid &> LOG.invalid-$dependencies
contains.py "EJSONPARSE" < LOG.invalid-$dependencies > LOG.check-invalid-$dependencies
trace grep -x "Error: validation failed" LOG.invalid-$dependencies
mkdir -p invalid/node_modules
done

title "Reject a null manifest through the package manager"
mkdir -p null/node_modules
trace musterr $CLI apps validate --path null &> LOG.null
trace grep -x "Error: validation failed" LOG.null

title "Run scripts from a manifest with a UTF-8 BOM"
mkdir -p bom/node_modules
trace musterr $CLI apps validate --path bom &> LOG.bom
trace grep -x "BOM build ran" LOG.bom
trace grep -F "validation failed (exit code 17)" LOG.bom

title "Let the package manager ignore non-runnable script entries"
mkdir -p non-runnable/node_modules
trace musterr $CLI apps validate --path non-runnable &> LOG.non-runnable
trace grep -x "non-runnable entries ignored" LOG.non-runnable
trace grep -F "validation failed (exit code 17)" LOG.non-runnable

for step in install typegen; do
cp -R lifecycle lifecycle-$step
if [ "$step" = typegen ]; then
mkdir -p lifecycle-$step/{add-build,remove-build,invalidated}/node_modules
fi

title "Run a build added by $step"
trace VALIDATION_UPDATE_STEP=$step VALIDATION_UPDATE_ACTION=add musterr $CLI apps validate --path lifecycle-$step/add-build &> LOG.add-build-$step
trace grep -x "added build ran" LOG.add-build-$step
trace grep -F "validation failed (exit code 17)" LOG.add-build-$step

title "Skip a build removed by $step"
trace VALIDATION_UPDATE_STEP=$step VALIDATION_UPDATE_ACTION=remove $CLI apps validate --path lifecycle-$step/remove-build &> LOG.remove-build-$step
trace grep -F "All validation checks passed" LOG.remove-build-$step

title "Report native errors after $step invalidates the manifest"
trace VALIDATION_UPDATE_STEP=$step VALIDATION_UPDATE_ACTION=invalidate musterr $CLI apps validate --path lifecycle-$step/invalidated &> LOG.invalidated-$step
contains.py "EJSONPARSE" < LOG.invalidated-$step > LOG.check-invalidated-$step
trace grep -x "Error: validation failed" LOG.invalidated-$step
done
6 changes: 1 addition & 5 deletions acceptance/apps/validate/test.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"]
Env.VALIDATION_TEST_FAIL = ""
Env.npm_config_audit = "false"
Env.npm_config_fund = "false"
Env.npm_config_offline = "true"
Env.npm_config_update_notifier = "false"
Ignore = ["commands.log", "node_modules", "missing", "lifecycle-install", "lifecycle-typegen"]
Ignore = ["commands.log"]

[[Repls]]
Old = '\d+\.\d+s'
Expand Down
2 changes: 0 additions & 2 deletions acceptance/apps/validate/workspaces/.npmrc

This file was deleted.

2 changes: 0 additions & 2 deletions acceptance/apps/validate/workspaces/databricks.yml

This file was deleted.

5 changes: 0 additions & 5 deletions acceptance/apps/validate/workspaces/package.json

This file was deleted.

Loading
Loading