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