diff options
Diffstat (limited to 'tests/specs')
11 files changed, 155 insertions, 13 deletions
diff --git a/tests/specs/install/future_install_local_deno/__test__.jsonc b/tests/specs/install/future_install_local_deno/__test__.jsonc index eb780d962..928030699 100644 --- a/tests/specs/install/future_install_local_deno/__test__.jsonc +++ b/tests/specs/install/future_install_local_deno/__test__.jsonc @@ -12,6 +12,14 @@ // ensure deps are actually cached "args": "run --cached-only main.js", "output": "" + }, + { + // check for lockfile + "args": [ + "eval", + "console.log(Deno.readTextFileSync('./deno.lock').trim())" + ], + "output": "deno.lock.out" } ] } diff --git a/tests/specs/install/future_install_local_deno/deno.lock.out b/tests/specs/install/future_install_local_deno/deno.lock.out new file mode 100644 index 000000000..fd3d52e42 --- /dev/null +++ b/tests/specs/install/future_install_local_deno/deno.lock.out @@ -0,0 +1,22 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "jsr:@denotest/add": "jsr:@denotest/add@1.0.0", + "npm:@denotest/esm-basic@^1.0.0": "npm:@denotest/esm-basic@1.0.0" + }, + "jsr": { + "@denotest/add@1.0.0": [WILDCARD] + }, + "npm": { + "@denotest/esm-basic@1.0.0": [WILDCARD] + } + }, + "remote": [WILDCARD], + "workspace": { + "dependencies": [ + "jsr:@denotest/add", + "npm:@denotest/esm-basic@^1.0.0" + ] + } +} diff --git a/tests/specs/install/future_install_node_modules/__test__.jsonc b/tests/specs/install/future_install_node_modules/__test__.jsonc index eb780d962..571216557 100644 --- a/tests/specs/install/future_install_node_modules/__test__.jsonc +++ b/tests/specs/install/future_install_node_modules/__test__.jsonc @@ -1,17 +1,56 @@ { - "tempDir": true, - "envs": { - "DENO_FUTURE": "1" - }, - "steps": [ - { - "args": "install", - "output": "install.out" + "tests": { + "install_sets_up_node_modules": { + "tempDir": true, + "envs": { + "DENO_FUTURE": "1" + }, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + // ensure deps are actually cached + "args": "run --cached-only main.js", + "output": "" + }, + { + // check for lockfile + "args": [ + "eval", + "console.log(Deno.readTextFileSync('./deno.lock').trim())" + ], + "output": "deno.lock.out" + } + ] }, - { - // ensure deps are actually cached - "args": "run --cached-only main.js", - "output": "" + "install_errors_corrupted_lockfile": { + "tempDir": true, + "envs": { + "DENO_FUTURE": "1" + }, + "steps": [ + { + "args": "install", + "output": "install.out" + }, + { + // Mess up the lockfile + "args": [ + "run", + "-A", + "corrupt.js" + ], + "output": "" + }, + { + // Run the install again + "args": "install", + "output": "corrupted.out", + "exitCode": 10 + } + ] } - ] + } } diff --git a/tests/specs/install/future_install_node_modules/corrupt.js b/tests/specs/install/future_install_node_modules/corrupt.js new file mode 100644 index 000000000..fcc146081 --- /dev/null +++ b/tests/specs/install/future_install_node_modules/corrupt.js @@ -0,0 +1,5 @@ +const lock = JSON.parse(Deno.readTextFileSync("./deno.lock")); +const pkg = lock.packages.npm["@denotest/esm-basic@1.0.0"]; +// Corrupt the integrity hash +pkg.integrity = pkg.integrity.slice(0, -1); +Deno.writeTextFileSync("./deno.lock", JSON.stringify(lock)); diff --git a/tests/specs/install/future_install_node_modules/corrupted.out b/tests/specs/install/future_install_node_modules/corrupted.out new file mode 100644 index 000000000..89578cbe2 --- /dev/null +++ b/tests/specs/install/future_install_node_modules/corrupted.out @@ -0,0 +1,3 @@ +[WILDCARD] +error: Integrity check failed for package: "npm:@denotest/esm-basic@1.0.0".[WILDCARD] +Use "--lock-write" flag to regenerate the lockfile at [WILDCARD]
\ No newline at end of file diff --git a/tests/specs/install/future_install_node_modules/deno.lock.out b/tests/specs/install/future_install_node_modules/deno.lock.out new file mode 100644 index 000000000..b30232996 --- /dev/null +++ b/tests/specs/install/future_install_node_modules/deno.lock.out @@ -0,0 +1,19 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:@denotest/esm-basic": "npm:@denotest/esm-basic@1.0.0" + }, + "npm": { + "@denotest/esm-basic@1.0.0": [WILDCARD] + } + }, + "remote": {}, + "workspace": { + "packageJson": { + "dependencies": [ + "npm:@denotest/esm-basic" + ] + } + } +} diff --git a/tests/specs/lockfile/only_package_json/__test__.jsonc b/tests/specs/lockfile/only_package_json/__test__.jsonc new file mode 100644 index 000000000..6b28a7a92 --- /dev/null +++ b/tests/specs/lockfile/only_package_json/__test__.jsonc @@ -0,0 +1,16 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "cache index.js", + "output": "cache.out" + }, + { + "args": [ + "eval", + "console.log(Deno.readTextFileSync('./deno.lock').trim())" + ], + "output": "deno.lock.out" + } + ] +} diff --git a/tests/specs/lockfile/only_package_json/cache.out b/tests/specs/lockfile/only_package_json/cache.out new file mode 100644 index 000000000..b8114c12a --- /dev/null +++ b/tests/specs/lockfile/only_package_json/cache.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/lockfile/only_package_json/deno.lock.out b/tests/specs/lockfile/only_package_json/deno.lock.out new file mode 100644 index 000000000..b30232996 --- /dev/null +++ b/tests/specs/lockfile/only_package_json/deno.lock.out @@ -0,0 +1,19 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:@denotest/esm-basic": "npm:@denotest/esm-basic@1.0.0" + }, + "npm": { + "@denotest/esm-basic@1.0.0": [WILDCARD] + } + }, + "remote": {}, + "workspace": { + "packageJson": { + "dependencies": [ + "npm:@denotest/esm-basic" + ] + } + } +} diff --git a/tests/specs/lockfile/only_package_json/index.js b/tests/specs/lockfile/only_package_json/index.js new file mode 100644 index 000000000..2600083e2 --- /dev/null +++ b/tests/specs/lockfile/only_package_json/index.js @@ -0,0 +1 @@ +import * as basic from "@denotest/esm-basic"; diff --git a/tests/specs/lockfile/only_package_json/package.json b/tests/specs/lockfile/only_package_json/package.json new file mode 100644 index 000000000..6611f206f --- /dev/null +++ b/tests/specs/lockfile/only_package_json/package.json @@ -0,0 +1,7 @@ +{ + "name": "lockfile_only_package_json", + "dependencies": { + "@denotest/esm-basic": "*" + }, + "type": "module" +} |