mirror of
https://github.com/denoland/deno
synced 2024-08-24 18:47:06 +00:00
chore: format files in tests/
This commit is contained in:
parent
87a061785e
commit
565a21eb0e
|
@ -344,30 +344,29 @@ class TypeScriptHost implements ts.LanguageServiceHost {
|
|||
containingFile: string
|
||||
): ts.ResolvedModule[] {
|
||||
//util.log("resolveModuleNames", { moduleNames, reusedNames });
|
||||
return moduleNames
|
||||
.map(name => {
|
||||
let resolvedFileName;
|
||||
if (name === "deno") {
|
||||
resolvedFileName = resolveModuleName("deno.d.ts", ASSETS);
|
||||
} else if (name === "typescript") {
|
||||
resolvedFileName = resolveModuleName("typescript.d.ts", ASSETS);
|
||||
} else {
|
||||
resolvedFileName = resolveModuleName(name, containingFile);
|
||||
}
|
||||
// According to the interface we shouldn't return `undefined` but if we
|
||||
// fail to return the same length of modules to those we cannot resolve
|
||||
// then TypeScript fails on an assertion that the lengths can't be
|
||||
// different, so we have to return an "empty" resolved module
|
||||
// TODO: all this does is push the problem downstream, and TypeScript
|
||||
// will complain it can't identify the type of the file and throw
|
||||
// a runtime exception, so we need to handle missing modules better
|
||||
resolvedFileName = resolvedFileName || "";
|
||||
// This flags to the compiler to not go looking to transpile functional
|
||||
// code, anything that is in `/$asset$/` is just library code
|
||||
const isExternalLibraryImport = resolvedFileName.startsWith(ASSETS);
|
||||
// TODO: we should be returning a ts.ResolveModuleFull
|
||||
return { resolvedFileName, isExternalLibraryImport };
|
||||
});
|
||||
return moduleNames.map(name => {
|
||||
let resolvedFileName;
|
||||
if (name === "deno") {
|
||||
resolvedFileName = resolveModuleName("deno.d.ts", ASSETS);
|
||||
} else if (name === "typescript") {
|
||||
resolvedFileName = resolveModuleName("typescript.d.ts", ASSETS);
|
||||
} else {
|
||||
resolvedFileName = resolveModuleName(name, containingFile);
|
||||
}
|
||||
// According to the interface we shouldn't return `undefined` but if we
|
||||
// fail to return the same length of modules to those we cannot resolve
|
||||
// then TypeScript fails on an assertion that the lengths can't be
|
||||
// different, so we have to return an "empty" resolved module
|
||||
// TODO: all this does is push the problem downstream, and TypeScript
|
||||
// will complain it can't identify the type of the file and throw
|
||||
// a runtime exception, so we need to handle missing modules better
|
||||
resolvedFileName = resolvedFileName || "";
|
||||
// This flags to the compiler to not go looking to transpile functional
|
||||
// code, anything that is in `/$asset$/` is just library code
|
||||
const isExternalLibraryImport = resolvedFileName.startsWith(ASSETS);
|
||||
// TODO: we should be returning a ts.ResolveModuleFull
|
||||
return { resolvedFileName, isExternalLibraryImport };
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const id = setInterval(function() {
|
||||
console.log("test")
|
||||
console.log("test");
|
||||
}, 200);
|
||||
|
||||
setTimeout(function() {
|
||||
clearInterval(id)
|
||||
}, 500)
|
||||
clearInterval(id);
|
||||
}, 500);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
console.log("hello");
|
||||
const foo = async () => {
|
||||
console.log("before error");
|
||||
throw Error("error");
|
||||
}
|
||||
};
|
||||
|
||||
foo();
|
||||
console.log("world");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
hello
|
||||
before error
|
||||
Error: error
|
||||
at foo ([WILDCARD]tests/async_error.ts:5:9)
|
||||
at eval ([WILDCARD]tests/async_error.ts:8:1)
|
||||
at foo ([WILDCARD]tests/async_error.ts:4:9)
|
||||
at eval ([WILDCARD]tests/async_error.ts:7:1)
|
||||
at eval (<anonymous>)
|
||||
at execute (deno/js/runtime.ts:[WILDCARD])
|
||||
at FileModule.compileAndRun (deno/js/runtime.ts:[WILDCARD])
|
||||
|
|
|
@ -3,7 +3,7 @@ function foo() {
|
|||
}
|
||||
|
||||
function bar() {
|
||||
foo()
|
||||
foo();
|
||||
}
|
||||
|
||||
bar()
|
||||
bar();
|
||||
|
|
|
@ -23,6 +23,7 @@ run(["yapf", "-i"] + find_exts("tools/", ".py") +
|
|||
find_exts("build_extra", ".py"))
|
||||
|
||||
run(["node", prettier, "--write"] + find_exts("js/", ".js", ".ts") +
|
||||
find_exts("tests/", ".js", ".ts") +
|
||||
["rollup.config.js", "tsconfig.json", "tslint.json"])
|
||||
|
||||
# Requires rustfmt 0.8.2 (flags were different in previous versions)
|
||||
|
|
Loading…
Reference in a new issue