DenoDDeno
Powered by
bzm3rB
Denoβ€’12mo ago
bzm3r

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)


Any ideas on what might be casuing this problem?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

The requested module does not provide an export named 'default'
WillduneWWilldune / help
3y ago
does not provide an export named... module import
ChilliSniffCChilliSniff / help
4y ago
The requested module 'test/jsx-runtime' does not provide an export named 'jsxs'
taiwannumberoneTtaiwannumberone / help
3y ago
error: module 'node:fs' does not provide an export named 'globSync'
OxooxoOOxooxo / help
15mo ago