The requested module 'npm:@jest/globals' does not provide an export named 'describe'
I am doing some exercies on exercism in the Typescript track, but I want to run my solutions locally on my machine using
deno
deno
.
So I have a folder, and in it I have two files (
two-fer.ts
two-fer.ts
and
two-fer.test.ts
two-fer.test.ts
):
export function twoFer(name: string = "you"): string { return `One for ${name}, one for me.`;}console.log(twoFer());console.log(twoFer("it"));
export function twoFer(name: string = "you"): string { return `One for ${name}, one for me.`;}console.log(twoFer());console.log(twoFer("it"));
import { describe, it, expect, xit } from "npm:@jest/globals";import { twoFer } from "./two-fer.ts";describe("TwoFer", () => { it("no name given", () => { const expected = "One for you, one for me."; expect(twoFer()).toEqual(expected); }); xit("a name given", () => { const expected = "One for Alice, one for me."; expect(twoFer("Alice")).toEqual(expected); }); xit("another name given", () => { const expected = "One for Bob, one for me."; expect(twoFer("Bob")).toEqual(expected); });});
import { describe, it, expect, xit } from "npm:@jest/globals";import { twoFer } from "./two-fer.ts";describe("TwoFer", () => { it("no name given", () => { const expected = "One for you, one for me."; expect(twoFer()).toEqual(expected); }); xit("a name given", () => { const expected = "One for Alice, one for me."; expect(twoFer("Alice")).toEqual(expected); }); xit("another name given", () => { const expected = "One for Bob, one for me."; expect(twoFer("Bob")).toEqual(expected); });});
I ran
deno add --allow-scripts npm:@jest/globals
deno add --allow-scripts npm:@jest/globals
, but when I run
deno test
deno test
, I get the error:
./twofer.test.ts (uncaught error)error: SyntaxError: The requested module 'npm:@jest/globals' does not provide an export named 'describe'import { describe, it, expect, xit } from "npm:@jest/globals"; ^ at <anonymous> (file:///home/bzm3r/learn-ts/two-fer.test.ts:1:10)This error was not caught from a test and caused the test runner to fail on the referenced module.It most likely originated from a dangling promise, event/timeout handler or top-level code. FAILURES./twofer.test.ts (uncaught error)
./twofer.test.ts (uncaught error)error: SyntaxError: The requested module 'npm:@jest/globals' does not provide an export named 'describe'import { describe, it, expect, xit } from "npm:@jest/globals"; ^ at <anonymous> (file:///home/bzm3r/learn-ts/two-fer.test.ts:1:10)This error was not caught from a test and caused the test runner to fail on the referenced module.It most likely originated from a dangling promise, event/timeout handler or top-level code. FAILURES./twofer.test.ts (uncaught error)