Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rsp committed Nov 18, 2019
1 parent 22780bc commit 8405762
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions std/node/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const version = `v${Deno.version.deno}`;

export const versions = {
node: Deno.version.deno,
...Deno.version,
...Deno.version
};

const osToPlatform = (os: Deno.OperatingSystem): string =>
Expand All @@ -12,7 +12,7 @@ export const platform = osToPlatform(Deno.build.os);

export const { arch } = Deno.build;

export const argv = [ Deno.execPath(), ...Deno.args ];
export const argv = [Deno.execPath(), ...Deno.args];

// TODO(rsp): currently setting env seems to be working by modifying the object
// that is returnd by Deno.env(). Need to make sure that this is the final API
Expand Down
34 changes: 18 additions & 16 deletions std/node/process_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,26 @@ test({
assert(process.cwd().match(/\Wnode$/));
process.chdir("..");
assert(process.cwd().match(/\Wstd$/));
},
}
});

test({
name: "process.chdir failure",
fn() {
assertThrows(() => {
process.chdir("non-existent-directory-name");
}, Deno.DenoError, "No such file");
},
assertThrows(
() => {
process.chdir("non-existent-directory-name");
},
Deno.DenoError,
"No such file"
);
}
});

test({
name: "process.version",
fn() {
assertEquals(typeof process, "object")
assertEquals(typeof process, "object");
assertEquals(typeof process.version, "string");
assertEquals(typeof process.versions, "object");
assertEquals(typeof process.versions.node, "string");
Expand All @@ -40,7 +44,7 @@ test({
name: "process.platform",
fn() {
assertEquals(typeof process.platform, "string");
},
}
});

test({
Expand All @@ -49,24 +53,23 @@ test({
assertEquals(typeof process.arch, "string");
// TODO(rsp): make sure that the arch strings should be the same in Node and Deno:
assertEquals(process.arch, Deno.build.arch);
},
}
});

test({
name: "process.pid",
fn() {
assertEquals(typeof process.pid, "number");
assertEquals(process.pid, Deno.pid);
},
}
});

test({
name: "process.on",
fn() {
assertEquals(typeof process.on, "function");
process.on("uncaughtException", (_err: Error) => {
});
},
process.on("uncaughtException", (_err: Error) => {});
}
});

test({
Expand All @@ -75,13 +78,12 @@ test({
assert(Array.isArray(process.argv));
assert(process.argv[0].match(/[^/\\]*deno[^/\\]*$/));
assert(process.argv.slice(-1)[0].match(/process_test[.]ts$/));
},
}
});

test({
name: "process.env",
fn() {
assertEquals(typeof process.env.PATH, 'string');
},
assertEquals(typeof process.env.PATH, "string");
}
});

0 comments on commit 8405762

Please sign in to comment.