mirror of
https://github.com/denoland/deno.git
synced 2024-12-11 01:58:05 -05:00
fix format (#140)
This commit is contained in:
parent
0d2429cdf2
commit
61a3911be7
4 changed files with 21 additions and 27 deletions
|
@ -31,7 +31,7 @@ test(function parseDateTime() {
|
||||||
test(function invalidParseDateTimeFormatThrows() {
|
test(function invalidParseDateTimeFormatThrows() {
|
||||||
try {
|
try {
|
||||||
(datetime as any).parseDateTime("2019-01-01 00:00", "x-y-z");
|
(datetime as any).parseDateTime("2019-01-01 00:00", "x-y-z");
|
||||||
assert(false, 'no exception was thrown');
|
assert(false, "no exception was thrown");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assertEqual(e.message, "Invalid datetime format!");
|
assertEqual(e.message, "Invalid datetime format!");
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ test(function parseDate() {
|
||||||
test(function invalidParseDateFormatThrows() {
|
test(function invalidParseDateFormatThrows() {
|
||||||
try {
|
try {
|
||||||
(datetime as any).parseDate("2019-01-01", "x-y-z");
|
(datetime as any).parseDate("2019-01-01", "x-y-z");
|
||||||
assert(false, 'no exception was thrown');
|
assert(false, "no exception was thrown");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assertEqual(e.message, "Invalid date format!");
|
assertEqual(e.message, "Invalid date format!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,11 +27,7 @@ async function main() {
|
||||||
await checkVersion();
|
await checkVersion();
|
||||||
|
|
||||||
const prettier = run({
|
const prettier = run({
|
||||||
args: [
|
args: ["bash", "-c", "prettier --write '**/*.ts' '**/*.md'"]
|
||||||
"bash",
|
|
||||||
"-c",
|
|
||||||
"prettier --write *.ts */*.ts */**/*.ts *.md */*.md */**/*.md"
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
const s = await prettier.status();
|
const s = await prettier.status();
|
||||||
exit(s.code);
|
exit(s.code);
|
||||||
|
|
|
@ -73,10 +73,7 @@ export class FileHandler extends WriterHandler {
|
||||||
private _file: File;
|
private _file: File;
|
||||||
private _filename: string;
|
private _filename: string;
|
||||||
|
|
||||||
constructor(
|
constructor(levelName: string, options: FileHandlerOptions) {
|
||||||
levelName: string,
|
|
||||||
options: FileHandlerOptions,
|
|
||||||
) {
|
|
||||||
super(levelName, options);
|
super(levelName, options);
|
||||||
this._filename = options.filename;
|
this._filename = options.filename;
|
||||||
}
|
}
|
||||||
|
|
29
log/test.ts
29
log/test.ts
|
@ -32,15 +32,15 @@ test(function testDefaultlogMethods() {
|
||||||
test(async function testDefaultFormatter() {
|
test(async function testDefaultFormatter() {
|
||||||
await log.setup({
|
await log.setup({
|
||||||
handlers: {
|
handlers: {
|
||||||
test: new TestHandler("DEBUG"),
|
test: new TestHandler("DEBUG")
|
||||||
},
|
},
|
||||||
|
|
||||||
loggers: {
|
loggers: {
|
||||||
test: {
|
test: {
|
||||||
level: "DEBUG",
|
level: "DEBUG",
|
||||||
handlers: ["test"],
|
handlers: ["test"]
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const logger = log.getLogger("test");
|
const logger = log.getLogger("test");
|
||||||
|
@ -53,16 +53,16 @@ test(async function testFormatterAsString() {
|
||||||
await log.setup({
|
await log.setup({
|
||||||
handlers: {
|
handlers: {
|
||||||
test: new TestHandler("DEBUG", {
|
test: new TestHandler("DEBUG", {
|
||||||
formatter: "test {levelName} {msg}",
|
formatter: "test {levelName} {msg}"
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
loggers: {
|
loggers: {
|
||||||
test: {
|
test: {
|
||||||
level: "DEBUG",
|
level: "DEBUG",
|
||||||
handlers: ["test"],
|
handlers: ["test"]
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const logger = log.getLogger("test");
|
const logger = log.getLogger("test");
|
||||||
|
@ -75,16 +75,17 @@ test(async function testFormatterAsFunction() {
|
||||||
await log.setup({
|
await log.setup({
|
||||||
handlers: {
|
handlers: {
|
||||||
test: new TestHandler("DEBUG", {
|
test: new TestHandler("DEBUG", {
|
||||||
formatter: logRecord => `fn formmatter ${logRecord.levelName} ${logRecord.msg}`,
|
formatter: logRecord =>
|
||||||
}),
|
`fn formmatter ${logRecord.levelName} ${logRecord.msg}`
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
loggers: {
|
loggers: {
|
||||||
test: {
|
test: {
|
||||||
level: "DEBUG",
|
level: "DEBUG",
|
||||||
handlers: ["test"],
|
handlers: ["test"]
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const logger = log.getLogger("test");
|
const logger = log.getLogger("test");
|
||||||
|
|
Loading…
Reference in a new issue