Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lockfiles #3231

Merged
merged 14 commits into from
Nov 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add lock-check tests
  • Loading branch information
ry committed Oct 29, 2019
commit ecccf9f9807345be9e6885dce4616a510aa2a27f
1 change: 1 addition & 0 deletions cli/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl Lockfile {
let mut f = std::fs::OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(&self.filename)?;
use std::io::Write;
f.write_all(s.as_bytes())?;
Expand Down
12 changes: 12 additions & 0 deletions cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,18 @@ itest!(_050_more_jsons {
output: "050_more_jsons.ts.out",
});

itest!(lock_check_ok {
args: "run --lock-check=lock_check_ok.json 003_relative_import.ts",
output: "003_relative_import.ts.out",
});

itest!(lock_check_err {
args: "run --lock-check=lock_check_err.json 003_relative_import.ts",
output: "lock_check_err.out",
check_stderr: true,
exit_code: 10,
});

itest!(async_error {
exit_code: 1,
args: "run --reload async_error.ts",
Expand Down
5 changes: 5 additions & 0 deletions cli/tests/lock_check_err.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"file:https:///Users/rld/src/deno/cli/tests/subdir/print_hello.ts": "bad",
"file:https:///Users/rld/src/deno/cli/tests/003_relative_import.ts": "alsobad",
"file:https:///Users/rld/src/deno/cli/tests/subdir/print_hello.ts": "somemissing"
}
1 change: 1 addition & 0 deletions cli/tests/lock_check_err.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[WILDCARD]lock file check failed lock_check_err.json file:https:///[WILDCARD]tests/003_relative_import.ts
4 changes: 4 additions & 0 deletions cli/tests/lock_check_ok.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"file:https:///Users/rld/src/deno/cli/tests/003_relative_import.ts": "da3b7f60f5ff635dbc27f3e5e05420f0f2c34676f080ef935ea547116424adeb",
"file:https:///Users/rld/src/deno/cli/tests/subdir/print_hello.ts": "5c93c66125878389f47f4abcac003f4be1276c5223612c26302460d71841e287"
}