From c3bad070fab1bec0c04cd444342074ce220ace0c Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Wed, 17 Jun 2020 04:27:01 +0100 Subject: [PATCH 1/8] [issue-#3-update-tests] Added original dep files --- tests/out-of-date-deps/original_deps.ts | 9 +++++++++ tests/up-to-date-deps/original_deps.ts | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/out-of-date-deps/original_deps.ts create mode 100644 tests/up-to-date-deps/original_deps.ts diff --git a/tests/out-of-date-deps/original_deps.ts b/tests/out-of-date-deps/original_deps.ts new file mode 100644 index 0000000..2d95371 --- /dev/null +++ b/tests/out-of-date-deps/original_deps.ts @@ -0,0 +1,9 @@ +import { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date + +import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date + +import * as colors from "https://deno.land/std@v0.53.0/fmt/colors.ts"; // out to date + +import { Drash as drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date + +export { Drash, fs, colors }; diff --git a/tests/up-to-date-deps/original_deps.ts b/tests/up-to-date-deps/original_deps.ts new file mode 100644 index 0000000..0b9969a --- /dev/null +++ b/tests/up-to-date-deps/original_deps.ts @@ -0,0 +1,9 @@ +import { Drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date + +import * as fs from "https://deno.land/std@0.57.0/fs/mod.ts"; // up to date + +import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts"; // up to date + +import { Drash as drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date + +export { Drash, fs, colors }; From aee1b625beef084786f7f5caad3592b48ab5b182 Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Wed, 17 Jun 2020 05:07:12 +0100 Subject: [PATCH 2/8] [issue-#3-update-tests] Added tests for update command --- .github/workflows/master.yml | 2 +- tests/update_test.ts | 387 ++++++++++++++++++++++++++++------- 2 files changed, 316 insertions(+), 73 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 74153de..7c2a30d 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -24,7 +24,7 @@ jobs: - name: Unit run: | deno cache mod.ts - deno test --allow-read --allow-run --allow-net + deno test --allow-read --allow-run --allow-write --allow-net linting: strategy: matrix: diff --git a/tests/update_test.ts b/tests/update_test.ts index 7ca11c1..2996081 100644 --- a/tests/update_test.ts +++ b/tests/update_test.ts @@ -1,76 +1,319 @@ // Update a specific dep that can be updated -import { assertEquals } from "../deps.ts"; +import { assertEquals, colours } from "../deps.ts"; -// Deno.test({ -// name: 'Update | Single | Modules to Update Exist', -// async fn(): Promise { -// -// } -// }) -// -// // Update a specific dep that is already up to date -// Deno.test({ -// name: 'Update | Single | No Modules to Update', -// async fn(): Promise { -// -// } -// }) -// -// // Update many deps that can be updated -// Deno.test({ -// name: 'Update | Many | Modules to Update Exist', -// async fn(): Promise { -// -// } -// }) -// -// // Update many deps that are already up to date -// Deno.test({ -// name: 'Update | Many | No Modules to Update', -// async fn(): Promise { -// -// } -// }) -// -// Deno.test({ -// name: 'Update | All | Modules to Update Exist', -// async fn(): Promise { -// -// } -// }) -// -// Deno.test({ -// name: 'Update | All | Modules to Update Exist', -// async fn(): Promise { -// -// } -// }) -// -// Deno.test({ -// name: 'Update | Single | std', -// async (): Promise { -// -// } -// }) -// -// Deno.test({ -// name: 'Update | Single | 3rd Party', -// async fn(): Promise { +/** + * @param dir eg "out-of-date-deps" + */ +function defaultDepsBackToOriginal (dir: string): void { + const pathToOriginal = "tests/" + dir + "/original_deps.ts" + const pathToMain = "tests/" + dir + "/deps.ts" + const originalContent = new TextDecoder().decode(Deno.readFileSync(pathToOriginal)) + Deno.writeFileSync(pathToMain, new TextEncoder().encode(originalContent)) +} + +/** + * @param dir eg "out-of-date-deps" + */ +function emptyDependencyFile (dir: string): void { + const path = "tests/" + dir + "/deps.ts" + Deno.writeFileSync(path, new TextEncoder().encode("")) +} + +/** + * @param dir eg "out-of-date-deps" --> "tests/out-of-date-deps/deps.ts + */ +function removeDependencyFile (dir: string): void { + try { + const path = "tests/" + dir + "/deps.ts" + Deno.removeSync(path) + } catch (err) { + + } +} + +Deno.test({ + name: 'Update | Single | Modules to Update Exist', + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps") + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs"], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + defaultDepsBackToOriginal("out-of-date-deps") + } +}) // -// } -// }) +// Update a specific dep that is already up to date +Deno.test({ + name: 'Update | Single | No Modules to Update', + async fn(): Promise { + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs"], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("Everything is already up to date") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + } +}) + +// Update many deps that can be updated +Deno.test({ + name: 'Update | Many | Modules to Update Exist', + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps") + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs", "fmt"], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + defaultDepsBackToOriginal("out-of-date-deps") + } +}) + +// Update many deps that are already up to date +Deno.test({ + name: 'Update | Many | No Modules to Update', + async fn(): Promise { + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs", "fmt"], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("Everything is already up to date") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + } +}) + +Deno.test({ + name: 'Update | All | Modules to Update Exist', + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps") + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update"], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + defaultDepsBackToOriginal("out-of-date-deps") + } +}) + +Deno.test({ + name: 'Update | All | Modules to Update Don\'t Exist', + async fn(): Promise { + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update"], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("Everything is already up to date") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + } +}) + +Deno.test({ + name: 'Update | Single | Third Party', + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps") + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "drash"], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + defaultDepsBackToOriginal("out-of-date-deps") + } +}) + +Deno.test({ + name: 'Update | Modules Dont Exist in Dependencies', + async fn(): Promise { + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "../../mod.ts", "update", "denon", "io"], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped" + }) + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + ); + assertEquals(stderr, colours.red("Modules specified do not exist in your dependencies.") + "\n"); + assertEquals(status.code, 1); + assertEquals(status.success, false); + } +}) + +Deno.test({ + name: "Update | single | Keeps the `v` if it exists in the imported version", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps") + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fmt", "drash"], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + defaultDepsBackToOriginal("out-of-date-deps") + } +}) -// Deno.test({ -// name: 'Update | Modules Dont Exist in Dependencies', -// async fn(): Promise { -// const p = await Deno.run({ -// cmd: ["deno", "run", "--allow-net", "--allow-read", "../../mod.ts", "update", "denon", "io"], -// cwd: "./tests/up-to-date-deps", -// stdout: "null" -// }) -// const status = await p.status() -// p.close() -// assertEquals(status.code, 1) -// assertEquals(status.success, false) -// } -// }) +Deno.test({ + name: "Update | single | Omits a `v` if it is not present in the imported version", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps") + const p = await Deno.run({ + cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs"], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals(stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + defaultDepsBackToOriginal("out-of-date-deps") + } +}) From 19296436c2adf0ac405f2254f67e000b74deee06 Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Wed, 17 Jun 2020 05:23:08 +0100 Subject: [PATCH 3/8] [issue-#3-update-tests] Improved assertions and fixed 3rd party deps not being updated --- src/commands/update.ts | 15 +++++++--- tests/out-of-date-deps/deps.ts | 2 -- tests/out-of-date-deps/original_deps.ts | 2 -- tests/up-to-date-deps/deps.ts | 2 -- tests/up-to-date-deps/original_deps.ts | 2 -- tests/update_test.ts | 40 +++++++++++++++++++++++++ 6 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/commands/update.ts b/src/commands/update.ts index b4b1ee8..808fc7f 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -29,10 +29,17 @@ export async function update(dependencies: string[]): Promise { if (module.importedVersion === module.latestRelease) { return; } - depsContent = depsContent.replace( - "std@" + module.importedVersion + "/" + module.name, - "std@" + module.latestRelease + "/" + module.name, - ); + if (module.std) { + depsContent = depsContent.replace( + "std@" + module.importedVersion + "/" + module.name, + "std@" + module.latestRelease + "/" + module.name, + ); + } else { + depsContent = depsContent.replace( + module.name + "@" + module.importedVersion, + module.name + "@" + module.latestRelease + ) + } console.info( colours.green( module.name + " was updated from " + module.importedVersion + " to " + diff --git a/tests/out-of-date-deps/deps.ts b/tests/out-of-date-deps/deps.ts index 2d95371..9b73308 100644 --- a/tests/out-of-date-deps/deps.ts +++ b/tests/out-of-date-deps/deps.ts @@ -4,6 +4,4 @@ import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date import * as colors from "https://deno.land/std@v0.53.0/fmt/colors.ts"; // out to date -import { Drash as drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date - export { Drash, fs, colors }; diff --git a/tests/out-of-date-deps/original_deps.ts b/tests/out-of-date-deps/original_deps.ts index 2d95371..9b73308 100644 --- a/tests/out-of-date-deps/original_deps.ts +++ b/tests/out-of-date-deps/original_deps.ts @@ -4,6 +4,4 @@ import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date import * as colors from "https://deno.land/std@v0.53.0/fmt/colors.ts"; // out to date -import { Drash as drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date - export { Drash, fs, colors }; diff --git a/tests/up-to-date-deps/deps.ts b/tests/up-to-date-deps/deps.ts index 0b9969a..8ecbe35 100644 --- a/tests/up-to-date-deps/deps.ts +++ b/tests/up-to-date-deps/deps.ts @@ -4,6 +4,4 @@ import * as fs from "https://deno.land/std@0.57.0/fs/mod.ts"; // up to date import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts"; // up to date -import { Drash as drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date - export { Drash, fs, colors }; diff --git a/tests/up-to-date-deps/original_deps.ts b/tests/up-to-date-deps/original_deps.ts index 0b9969a..8ecbe35 100644 --- a/tests/up-to-date-deps/original_deps.ts +++ b/tests/up-to-date-deps/original_deps.ts @@ -4,6 +4,4 @@ import * as fs from "https://deno.land/std@0.57.0/fs/mod.ts"; // up to date import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts"; // up to date -import { Drash as drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date - export { Drash, fs, colors }; diff --git a/tests/update_test.ts b/tests/update_test.ts index 2996081..5899029 100644 --- a/tests/update_test.ts +++ b/tests/update_test.ts @@ -56,6 +56,10 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent !== originalDepContent, true) + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) defaultDepsBackToOriginal("out-of-date-deps") } }) @@ -85,6 +89,9 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent === originalDepContent, true) } }) @@ -115,6 +122,11 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent !== originalDepContent, true) + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) + assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true) defaultDepsBackToOriginal("out-of-date-deps") } }) @@ -144,6 +156,9 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent === originalDepContent, true) } }) @@ -174,6 +189,12 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent !== originalDepContent, true) + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) + assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true) + assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true) defaultDepsBackToOriginal("out-of-date-deps") } }) @@ -202,6 +223,9 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent === originalDepContent, true) } }) @@ -230,6 +254,10 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent !== originalDepContent, true) + assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true) defaultDepsBackToOriginal("out-of-date-deps") } }) @@ -256,6 +284,9 @@ Deno.test({ assertEquals(stderr, colours.red("Modules specified do not exist in your dependencies.") + "\n"); assertEquals(status.code, 1); assertEquals(status.success, false); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent === originalDepContent, true) } }) @@ -285,6 +316,11 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent !== originalDepContent, true) + assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true) + assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true) defaultDepsBackToOriginal("out-of-date-deps") } }) @@ -314,6 +350,10 @@ Deno.test({ assertEquals(stderr, ""); assertEquals(status.code, 0); assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); + const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); + assertEquals(newDepContent !== originalDepContent, true) + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) defaultDepsBackToOriginal("out-of-date-deps") } }) From abe6c8cac49ba3d86db9a045d5348e4e00db73a3 Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Wed, 17 Jun 2020 05:25:29 +0100 Subject: [PATCH 4/8] deno fmt --- src/commands/update.ts | 10 +- tests/update_test.ts | 785 ++++++++++++++++++++++++----------------- 2 files changed, 471 insertions(+), 324 deletions(-) diff --git a/src/commands/update.ts b/src/commands/update.ts index 808fc7f..a4b0b25 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -31,14 +31,14 @@ export async function update(dependencies: string[]): Promise { } if (module.std) { depsContent = depsContent.replace( - "std@" + module.importedVersion + "/" + module.name, - "std@" + module.latestRelease + "/" + module.name, + "std@" + module.importedVersion + "/" + module.name, + "std@" + module.latestRelease + "/" + module.name, ); } else { depsContent = depsContent.replace( - module.name + "@" + module.importedVersion, - module.name + "@" + module.latestRelease - ) + module.name + "@" + module.importedVersion, + module.name + "@" + module.latestRelease, + ); } console.info( colours.green( diff --git a/tests/update_test.ts b/tests/update_test.ts index 5899029..69879c0 100644 --- a/tests/update_test.ts +++ b/tests/update_test.ts @@ -4,356 +4,503 @@ import { assertEquals, colours } from "../deps.ts"; /** * @param dir eg "out-of-date-deps" */ -function defaultDepsBackToOriginal (dir: string): void { - const pathToOriginal = "tests/" + dir + "/original_deps.ts" - const pathToMain = "tests/" + dir + "/deps.ts" - const originalContent = new TextDecoder().decode(Deno.readFileSync(pathToOriginal)) - Deno.writeFileSync(pathToMain, new TextEncoder().encode(originalContent)) +function defaultDepsBackToOriginal(dir: string): void { + const pathToOriginal = "tests/" + dir + "/original_deps.ts"; + const pathToMain = "tests/" + dir + "/deps.ts"; + const originalContent = new TextDecoder().decode( + Deno.readFileSync(pathToOriginal), + ); + Deno.writeFileSync(pathToMain, new TextEncoder().encode(originalContent)); } /** * @param dir eg "out-of-date-deps" */ -function emptyDependencyFile (dir: string): void { - const path = "tests/" + dir + "/deps.ts" - Deno.writeFileSync(path, new TextEncoder().encode("")) +function emptyDependencyFile(dir: string): void { + const path = "tests/" + dir + "/deps.ts"; + Deno.writeFileSync(path, new TextEncoder().encode("")); } /** * @param dir eg "out-of-date-deps" --> "tests/out-of-date-deps/deps.ts */ -function removeDependencyFile (dir: string): void { - try { - const path = "tests/" + dir + "/deps.ts" - Deno.removeSync(path) - } catch (err) { - - } +function removeDependencyFile(dir: string): void { + try { + const path = "tests/" + dir + "/deps.ts"; + Deno.removeSync(path); + } catch (err) { + } } Deno.test({ - name: 'Update | Single | Modules to Update Exist', - async fn(): Promise { - defaultDepsBackToOriginal("out-of-date-deps") - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs"], - cwd: "./tests/out-of-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent !== originalDepContent, true) - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) - defaultDepsBackToOriginal("out-of-date-deps") - } -}) + name: "Update | Single | Modules to Update Exist", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps"); + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + "fs", + ], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent !== originalDepContent, true); + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); + defaultDepsBackToOriginal("out-of-date-deps"); + }, +}); // // Update a specific dep that is already up to date Deno.test({ - name: 'Update | Single | No Modules to Update', - async fn(): Promise { - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs"], - cwd: "./tests/up-to-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("Everything is already up to date") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent === originalDepContent, true) - } -}) + name: "Update | Single | No Modules to Update", + async fn(): Promise { + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + "fs", + ], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("Everything is already up to date") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent === originalDepContent, true); + }, +}); // Update many deps that can be updated Deno.test({ - name: 'Update | Many | Modules to Update Exist', - async fn(): Promise { - defaultDepsBackToOriginal("out-of-date-deps") - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs", "fmt"], - cwd: "./tests/out-of-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent !== originalDepContent, true) - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) - assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true) - defaultDepsBackToOriginal("out-of-date-deps") - } -}) + name: "Update | Many | Modules to Update Exist", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps"); + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + "fs", + "fmt", + ], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent !== originalDepContent, true); + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true); + defaultDepsBackToOriginal("out-of-date-deps"); + }, +}); // Update many deps that are already up to date Deno.test({ - name: 'Update | Many | No Modules to Update', - async fn(): Promise { - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs", "fmt"], - cwd: "./tests/up-to-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("Everything is already up to date") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent === originalDepContent, true) - } -}) + name: "Update | Many | No Modules to Update", + async fn(): Promise { + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + "fs", + "fmt", + ], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("Everything is already up to date") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent === originalDepContent, true); + }, +}); Deno.test({ - name: 'Update | All | Modules to Update Exist', - async fn(): Promise { - defaultDepsBackToOriginal("out-of-date-deps") - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update"], - cwd: "./tests/out-of-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent !== originalDepContent, true) - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) - assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true) - assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true) - defaultDepsBackToOriginal("out-of-date-deps") - } -}) + name: "Update | All | Modules to Update Exist", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps"); + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + ], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent !== originalDepContent, true); + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true); + defaultDepsBackToOriginal("out-of-date-deps"); + }, +}); Deno.test({ - name: 'Update | All | Modules to Update Don\'t Exist', - async fn(): Promise { - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update"], - cwd: "./tests/up-to-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("Everything is already up to date") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent === originalDepContent, true) - } -}) + name: "Update | All | Modules to Update Don't Exist", + async fn(): Promise { + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + ], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("Everything is already up to date") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent === originalDepContent, true); + }, +}); Deno.test({ - name: 'Update | Single | Third Party', - async fn(): Promise { - defaultDepsBackToOriginal("out-of-date-deps") - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "drash"], - cwd: "./tests/out-of-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent !== originalDepContent, true) - assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true) - defaultDepsBackToOriginal("out-of-date-deps") - } -}) + name: "Update | Single | Third Party", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps"); + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + "drash", + ], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent !== originalDepContent, true); + assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true); + defaultDepsBackToOriginal("out-of-date-deps"); + }, +}); Deno.test({ - name: 'Update | Modules Dont Exist in Dependencies', - async fn(): Promise { - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "../../mod.ts", "update", "denon", "io"], - cwd: "./tests/up-to-date-deps", - stdout: "piped", - stderr: "piped" - }) - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" - ); - assertEquals(stderr, colours.red("Modules specified do not exist in your dependencies.") + "\n"); - assertEquals(status.code, 1); - assertEquals(status.success, false); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent === originalDepContent, true) - } -}) + name: "Update | Modules Dont Exist in Dependencies", + async fn(): Promise { + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "../../mod.ts", + "update", + "denon", + "io", + ], + cwd: "./tests/up-to-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n", + ); + assertEquals( + stderr, + colours.red("Modules specified do not exist in your dependencies.") + + "\n", + ); + assertEquals(status.code, 1); + assertEquals(status.success, false); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent === originalDepContent, true); + }, +}); Deno.test({ - name: "Update | single | Keeps the `v` if it exists in the imported version", - async fn(): Promise { - defaultDepsBackToOriginal("out-of-date-deps") - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fmt", "drash"], - cwd: "./tests/out-of-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent !== originalDepContent, true) - assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true) - assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true) - defaultDepsBackToOriginal("out-of-date-deps") - } -}) + name: "Update | single | Keeps the `v` if it exists in the imported version", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps"); + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + "fmt", + "drash", + ], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent !== originalDepContent, true); + assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true); + defaultDepsBackToOriginal("out-of-date-deps"); + }, +}); Deno.test({ - name: "Update | single | Omits a `v` if it is not present in the imported version", - async fn(): Promise { - defaultDepsBackToOriginal("out-of-date-deps") - const p = await Deno.run({ - cmd: ["deno", "run", "--allow-net", "--allow-read", "--allow-write", "../../mod.ts", "update", "fs"], - cwd: "./tests/out-of-date-deps", - stdout: "piped", - stderr: "piped", - }); - const status = await p.status(); - const output = await p.output(); - await p.close(); - const stdout = new TextDecoder("utf-8").decode(output); - const error = await p.stderrOutput(); - const stderr = new TextDecoder("utf-8").decode(error); - assertEquals(stdout, - "Gathering facts...\n" + - "Reading deps.ts to gather your dependencies...\n" + - "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" - ); - assertEquals(stderr, ""); - assertEquals(status.code, 0); - assertEquals(status.success, true); - const originalDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/original_deps.ts")); - const newDepContent = new TextDecoder("utf-8").decode(Deno.readFileSync("tests/out-of-date-deps/deps.ts")); - assertEquals(newDepContent !== originalDepContent, true) - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true) - defaultDepsBackToOriginal("out-of-date-deps") - } -}) + name: + "Update | single | Omits a `v` if it is not present in the imported version", + async fn(): Promise { + defaultDepsBackToOriginal("out-of-date-deps"); + const p = await Deno.run({ + cmd: [ + "deno", + "run", + "--allow-net", + "--allow-read", + "--allow-write", + "../../mod.ts", + "update", + "fs", + ], + cwd: "./tests/out-of-date-deps", + stdout: "piped", + stderr: "piped", + }); + const status = await p.status(); + const output = await p.output(); + await p.close(); + const stdout = new TextDecoder("utf-8").decode(output); + const error = await p.stderrOutput(); + const stderr = new TextDecoder("utf-8").decode(error); + assertEquals( + stdout, + "Gathering facts...\n" + + "Reading deps.ts to gather your dependencies...\n" + + "Checking if your modules can be updated...\n" + + colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n", + ); + assertEquals(stderr, ""); + assertEquals(status.code, 0); + assertEquals(status.success, true); + const originalDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/original_deps.ts"), + ); + const newDepContent = new TextDecoder("utf-8").decode( + Deno.readFileSync("tests/out-of-date-deps/deps.ts"), + ); + assertEquals(newDepContent !== originalDepContent, true); + assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); + defaultDepsBackToOriginal("out-of-date-deps"); + }, +}); From 9bca564cfd43c3e5927123fbde1a5080d661e589 Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Wed, 17 Jun 2020 05:27:01 +0100 Subject: [PATCH 5/8] [issue-#3-update-tests] Added windows to master ci --- .github/workflows/master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 7c2a30d..75b8fa9 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -9,7 +9,7 @@ jobs: tests: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest, windows-latest] deno: ["1.1.0"] runs-on: ${{ matrix.os }} From 389d27a833d3200dd2ece743602a6d2e3759a433 Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Mon, 22 Jun 2020 09:36:40 +0100 Subject: [PATCH 6/8] upgrade deno to v1.1.1 --- .github/workflows/master.yml | 2 +- README.md | 28 ++++++++++++------------- src/options/help.ts | 8 ++++---- src/options/version.ts | 2 +- tests/help_test.ts | 8 ++++---- tests/update_test.ts | 40 ++++++++++++++++++------------------ 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 75b8fa9..c2b42b0 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - deno: ["1.1.0"] + deno: ["1.1.1"] runs-on: ${{ matrix.os }} steps: diff --git a/README.md b/README.md index c57825f..729c107 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ As dmm only needs to read and write to your `deps.ts`, as well as requiring netw *Install* ``` -$ deno install --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts +$ deno install --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts $ dmm ... ``` @@ -58,7 +58,7 @@ $ dmm ... If you are using this method, be sure to use the latest version of dmm in the command below ``` -$ deno run https://deno.land/x/dmm@v1.1.0/mod.ts ... +$ deno run https://deno.land/x/dmm@v1.1.1/mod.ts ... ``` In the examples below, dmm is installed and we will be using it that way to make the commands easier to read. @@ -78,10 +78,10 @@ Information on fmt - Name: fmt - Description: Cannot retrieve descriptions for std modules - - deno.land Link: https://deno.land/std@0.57.0/fmt + - deno.land Link: https://deno.land/std@0.58.0/fmt - GitHub Repository: https://github.com/denoland/deno/tree/master/std/fmt - - Import Statement: import * as fmt from "https://deno.land/std@0.57.0/fmt"; - - Latest Version: 0.57.0 + - Import Statement: import * as fmt from "https://deno.land/std@0.58.0/fmt"; + - Latest Version: 0.58.0 ``` @@ -94,7 +94,7 @@ export { Drash } from "https://deno.land/x/drash@v1.0.0/mod.ts"; // out of date import * as fs from "https://deno.land/std@0.53.0/fs/mod.ts"; // out of date -import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts"; // up to date +import * as colors from "https://deno.land/std@0.58.0/fmt/colors.ts"; // up to date export { fs, colors } ``` @@ -109,7 +109,7 @@ Now we want to check if any of our dependencies need updating, but we don't want $ dmm check ... drash can be updated from v1.0.0 to v1.0.5 -fs can be updated from 0.53.0 to 0.57.0 +fs can be updated from 0.53.0 to 0.58.0 ... ``` @@ -121,7 +121,7 @@ Lets update our dependencies as some are out of date: $ dmm update ... drash was updated from v1.0.0 to v1.0.5 -fs was updated from 0.53.0 to 0.57.0 +fs was updated from 0.53.0 to 0.58.0 ... ``` @@ -130,9 +130,9 @@ Now lets check the `deps.ts` file, and you will notice the versions have been mo ```typescript export { Drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // was out of date -import * as fs from "https://deno.land/std@0.57.0/fs/mod.ts"; // was out of date +import * as fs from "https://deno.land/std@0.58.0/fs/mod.ts"; // was out of date -import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts"; +import * as colors from "https://deno.land/std@0.58.0/fmt/colors.ts"; export { fs, colors } ``` @@ -147,7 +147,7 @@ $ dmm --help A module manager for Deno. USAGE: - deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.0/mod.ts [ARGS] [MODULES] + deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.1/mod.ts [ARGS] [MODULES] dmm [ARGS] [MODULES] @@ -171,9 +171,9 @@ OPTIONS: EXAMPLE USAGE: Assume you are importing an out of date version of `fs` from `std`. - deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.0/mod.ts check fs - deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts update fs - deno run --allow-net https://deno.land/x/dmm@v1.1.0/mod.ts info http + deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.1/mod.ts check fs + deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts update fs + deno run --allow-net https://deno.land/x/dmm@v1.1.1/mod.ts info http dmm info http ``` diff --git a/src/options/help.ts b/src/options/help.ts index dc0f8e1..631e74d 100644 --- a/src/options/help.ts +++ b/src/options/help.ts @@ -4,7 +4,7 @@ export const helpMessage: string = "\n" + "\n" + "USAGE:" + "\n" + - " deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.0/mod.ts [ARGS] [MODULES]" + + " deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.1/mod.ts [ARGS] [MODULES]" + "\n" + "\n" + " dmm [ARGS] [MODULES]" + @@ -45,11 +45,11 @@ export const helpMessage: string = "\n" + "\n" + " Assume you are importing an out of date version of `fs` from `std`." + "\n" + - " deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.0/mod.ts check fs" + + " deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.1/mod.ts check fs" + "\n" + - " deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts update fs" + + " deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts update fs" + "\n" + - " deno run --allow-net https://deno.land/x/dmm@v1.1.0/mod.ts info http" + + " deno run --allow-net https://deno.land/x/dmm@v1.1.1/mod.ts info http" + "\n" + " dmm info http" + "\n"; diff --git a/src/options/version.ts b/src/options/version.ts index 5c94f68..5dee28f 100644 --- a/src/options/version.ts +++ b/src/options/version.ts @@ -1,2 +1,2 @@ -const version = "1.1.0"; +const version = "1.1.1"; export const versionMessage = `dmm ${version}`; diff --git a/tests/help_test.ts b/tests/help_test.ts index 673d435..eb9133b 100644 --- a/tests/help_test.ts +++ b/tests/help_test.ts @@ -22,7 +22,7 @@ Deno.test({ "A module manager for Deno.\n" + "\n" + "USAGE:\n" + - " deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.0/mod.ts [ARGS] [MODULES]\n" + + " deno run --allow-read --allow-net [--allow-write] https://deno.land/x/dmm@v1.1.1/mod.ts [ARGS] [MODULES]\n" + "\n" + " dmm [ARGS] [MODULES]\n" + "\n" + @@ -51,9 +51,9 @@ Deno.test({ "\n" + "EXAMPLE USAGE:\n" + " Assume you are importing an out of date version of `fs` from `std`.\n" + - " deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.0/mod.ts check fs\n" + - " deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.0/mod.ts update fs\n" + - " deno run --allow-net https://deno.land/x/dmm@v1.1.0/mod.ts info http\n" + + " deno run --allow-net --allow-read https://deno.land/x/dmm@v1.1.1/mod.ts check fs\n" + + " deno run --allow-net --allow-read --allow-write https://deno.land/x/dmm@v1.1.1/mod.ts update fs\n" + + " deno run --allow-net https://deno.land/x/dmm@v1.1.1/mod.ts info http\n" + " dmm info http\n" + "\n", ); diff --git a/tests/update_test.ts b/tests/update_test.ts index 69879c0..4245766 100644 --- a/tests/update_test.ts +++ b/tests/update_test.ts @@ -62,7 +62,7 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n", + colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -74,7 +74,7 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); @@ -156,8 +156,8 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n", + colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.58.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -169,8 +169,8 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); - assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.58.0/fmt") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); @@ -250,9 +250,9 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n", + colours.green("drash was updated from v1.0.0 to v1.0.6") + "\n" + + colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.58.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -264,9 +264,9 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); - assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true); - assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.58.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("drash@v1.0.6") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); @@ -344,7 +344,7 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n", + colours.green("drash was updated from v1.0.0 to v1.0.6") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -356,7 +356,7 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true); + assertEquals(newDepContent.indexOf("drash@v1.0.6") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); @@ -438,8 +438,8 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("drash was updated from v1.0.0 to v1.0.5") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.57.0") + "\n", + colours.green("drash was updated from v1.0.0 to v1.0.6") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.58.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -451,8 +451,8 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@v0.57.0/fmt") !== -1, true); - assertEquals(newDepContent.indexOf("drash@v1.0.5") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.58.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("drash@v1.0.6") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); @@ -488,7 +488,7 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.57.0") + "\n", + colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -500,7 +500,7 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.57.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); From 984b65b8faab36cac7f67f0dfe96c5e4d36f99c9 Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Sun, 28 Jun 2020 21:15:57 +0100 Subject: [PATCH 7/8] [issue-#3-update-tests] Updated dependencies that are supposed to be latest version --- tests/up-to-date-deps/deps.ts | 4 ++-- tests/up-to-date-deps/original_deps.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/up-to-date-deps/deps.ts b/tests/up-to-date-deps/deps.ts index 1a0651c..80e566f 100644 --- a/tests/up-to-date-deps/deps.ts +++ b/tests/up-to-date-deps/deps.ts @@ -1,7 +1,7 @@ import { Drash } from "https://deno.land/x/drash@v1.0.6/mod.ts"; // up to date -import * as fs from "https://deno.land/std@0.58.0/fs/mod.ts"; // up to date +import * as fs from "https://deno.land/std@0.59.0/fs/mod.ts"; // up to date -import * as colors from "https://deno.land/std@0.58.0/fmt/colors.ts"; // up to date +import * as colors from "https://deno.land/std@0.59.0/fmt/colors.ts"; // up to date export { Drash, fs, colors }; diff --git a/tests/up-to-date-deps/original_deps.ts b/tests/up-to-date-deps/original_deps.ts index 8ecbe35..80e566f 100644 --- a/tests/up-to-date-deps/original_deps.ts +++ b/tests/up-to-date-deps/original_deps.ts @@ -1,7 +1,7 @@ -import { Drash } from "https://deno.land/x/drash@v1.0.5/mod.ts"; // up to date +import { Drash } from "https://deno.land/x/drash@v1.0.6/mod.ts"; // up to date -import * as fs from "https://deno.land/std@0.57.0/fs/mod.ts"; // up to date +import * as fs from "https://deno.land/std@0.59.0/fs/mod.ts"; // up to date -import * as colors from "https://deno.land/std@0.57.0/fmt/colors.ts"; // up to date +import * as colors from "https://deno.land/std@0.59.0/fmt/colors.ts"; // up to date export { Drash, fs, colors }; From 5837bf3a5946b841ca47bf2a1fb3f594aa701ec5 Mon Sep 17 00:00:00 2001 From: Edward Bebbington Date: Sun, 28 Jun 2020 21:20:14 +0100 Subject: [PATCH 8/8] [issue-#3-update-tests] Fixed tests by updating latest version assertions --- tests/update_test.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/update_test.ts b/tests/update_test.ts index 4245766..a9aaa91 100644 --- a/tests/update_test.ts +++ b/tests/update_test.ts @@ -62,7 +62,7 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n", + colours.green("fs was updated from 0.53.0 to 0.59.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -74,7 +74,7 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.59.0/fs") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); @@ -156,8 +156,8 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.58.0") + "\n", + colours.green("fs was updated from 0.53.0 to 0.59.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.59.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -169,8 +169,8 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); - assertEquals(newDepContent.indexOf("std@v0.58.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.59.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.59.0/fmt") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, }); @@ -251,8 +251,8 @@ Deno.test({ "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + colours.green("drash was updated from v1.0.0 to v1.0.6") + "\n" + - colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.58.0") + "\n", + colours.green("fs was updated from 0.53.0 to 0.59.0") + "\n" + + colours.green("fmt was updated from v0.53.0 to v0.59.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -264,8 +264,8 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); - assertEquals(newDepContent.indexOf("std@v0.58.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.59.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.59.0/fmt") !== -1, true); assertEquals(newDepContent.indexOf("drash@v1.0.6") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, @@ -439,7 +439,7 @@ Deno.test({ "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + colours.green("drash was updated from v1.0.0 to v1.0.6") + "\n" + - colours.green("fmt was updated from v0.53.0 to v0.58.0") + "\n", + colours.green("fmt was updated from v0.53.0 to v0.59.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -451,7 +451,7 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@v0.58.0/fmt") !== -1, true); + assertEquals(newDepContent.indexOf("std@v0.59.0/fmt") !== -1, true); assertEquals(newDepContent.indexOf("drash@v1.0.6") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, @@ -488,7 +488,7 @@ Deno.test({ "Gathering facts...\n" + "Reading deps.ts to gather your dependencies...\n" + "Checking if your modules can be updated...\n" + - colours.green("fs was updated from 0.53.0 to 0.58.0") + "\n", + colours.green("fs was updated from 0.53.0 to 0.59.0") + "\n", ); assertEquals(stderr, ""); assertEquals(status.code, 0); @@ -500,7 +500,7 @@ Deno.test({ Deno.readFileSync("tests/out-of-date-deps/deps.ts"), ); assertEquals(newDepContent !== originalDepContent, true); - assertEquals(newDepContent.indexOf("std@0.58.0/fs") !== -1, true); + assertEquals(newDepContent.indexOf("std@0.59.0/fs") !== -1, true); defaultDepsBackToOriginal("out-of-date-deps"); }, });