I was Building an app with Node . So I used Deno for some unit testing in Node.馃槀
So for Deno intellisense
/// <reference path="E:/deno/lib.deno.d.ts" />
import {
assert,
assertEquals,
//@ts-ignore
} from "https://deno.land/[email protected]/testing/asserts.ts";
Deno.test("hello world", () => {
assertEquals(10, 10);
});
By using this /// <reference path="E:/deno/lib.deno.d.ts" /> I got
E:\BackEnd> deno test -A e:\BackEnd\route.test.ts
error: Unsupported scheme "e" for module "E:/deno/lib.deno.d.ts". Supported schemes: [
"http",
"https",
"file",
]
Looks like Deno doesn't see that reference as a filesystem path but rather an URL
What if you reference it with relative import? Does it work for you?
Also, I have no idea why it resolves to .vscode, makes no sense. Are you sure that snippet is right?
There is no mistake.I just want to make is simple.So I change the original file path...that's all.
I think Deno test don't understand Triple-Slash Directives (///
It does, it's in the manual
What doesn't seem to work (don't have Windows to try it out though) is using an absolute path (drive:/path, local disk E in your case) with an import
That's why I asked you if you could use a relative route instead of an absolute one to reference that file (doing ../path/deno.d.ts)
The error message is giving you some crucial context; "i don't know what the heck kind of URL e:/deno... is - change the scheme to http(s)|file; in your case file:///E:/deno/lib.deno.d.ts should work, or the relative path suggestion Soremwar suggested
@Soremwar ... I Got new Error.
///<reference path="../.vscode/lib.deno.d.ts" />
Deno.chdir("E:/BackEnd/test"); // also change current working directory for fun 馃槀
//@ts-ignore
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
Deno.test("hello world #1", () => assertEquals(4, 4));
This time I got this. ( I am Windows 10 user )
E:\BackEnd>deno test -A e:\BackEnd\test\route.test.ts
Check file:///E:/BackEnd/.deno.test.ts
error: TS2345 [ERROR]: Argument of type '{ depth: number; sorted: boolean; trailingComma: boolean; compact: boolean; iterableLimit: number; }' is not assignable to parameter of type 'InspectOptions'.
Object literal may only specify known properties, and 'sorted' does not exist in type 'InspectOptions'.
sorted: true,
~~~~~~~~~~~~
at https://deno.land/[email protected]/testing/asserts.ts:26:7
Without Triple-Slash Directives///<reference path="..." /> There is no Error.
I think there is nothing wrong with resolving file . VsCode didn't complain about file Path ( relative path or absolute path )
What lib deno are you using? Make sure it aligns with your Deno version (that is a 1.1 issue I think)
What lib deno are you using? Make sure it aligns with your Deno version (that is a 1.1 issue I think)
I am using Deno v1.3.0 and lib.deno.d.ts (https://github.com/denoland/deno/releases/download/v1.3.0/lib.deno.d.ts)
The problem is with Triple-Slash Directives. not for specific any file.d.ts
You should not use triple-slash reference path in TypeScript files in Deno. They are really only supported in JavaScript files. Deno automatically loads all the types it needs itself. I agree the error message is confusing though.
You should not use triple-slash reference path in TypeScript files in Deno. They are really only supported in JavaScript files. Deno automatically loads all the types it needs itself. I agree the error message is confusing though.
Don't mind,But this is also not working with javascript file for me though.
They don't do what I suspect you think they do in JavaScript files: https://deno.land/manual/getting_started/typescript#triple-slash-reference-directive-in-javascript-files
Basically you shouldn't never ever need to load lib.deno.d.ts in Deno. If you find yourself doing that, you are likely doing something wrong.
Most helpful comment
They don't do what I suspect you think they do in JavaScript files: https://deno.land/manual/getting_started/typescript#triple-slash-reference-directive-in-javascript-files
Basically you shouldn't never ever need to load
lib.deno.d.tsin Deno. If you find yourself doing that, you are likely doing something wrong.