dnt icon indicating copy to clipboard operation
dnt copied to clipboard

Deno test shim: Deno.TestContext.name is `undefined`

Open mfulton26 opened this issue 3 years ago • 0 comments

The following test passes with deno test but fails with deno run -A build-node-package.ts because t.name is undefined:

import { assertEquals } from "std/testing/asserts.ts";

Deno.test("example", (t) => {
  assertEquals(t.name, "example");
});
example build logs
[dnt] Transforming...
[dnt] Running npm install...

added 11 packages, and audited 12 packages in 2s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
[dnt] Building project...
[dnt] Type checking...
[dnt] Emitting declaration files...
[dnt] Emitting ESM package...
[dnt] Emitting script package...
[dnt] Running tests...

> test
> node test_runner.js

Running tests in ./script/mod.test.js...

test example ... fail

FAILURES

example
  AssertionError: Values are not equal:
  
  
      [Diff] Actual / Expected
  
  
  -   undefined
  +   'example'
  
      at assertEquals (/path/to/dnt-playground/node/script/deps/deno.land/[email protected]/testing/asserts.js:178:11)
      at Object.fn (/path/to/dnt-playground/node/script/mod.test.js:29:35)
      at runTestDefinitions (/path/to/dnt-playground/node/test_runner.js:54:30)
      at main (/path/to/dnt-playground/node/test_runner.js:31:15)
      at Object.<anonymous> (/path/to/dnt-playground/node/test_runner.js:200:1)
      at Module._compile (node:internal/modules/cjs/loader:1105:14)
      at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
      at Module.load (node:internal/modules/cjs/loader:981:32)
      at Function.Module._load (node:internal/modules/cjs/loader:822:12)
      at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)error: Uncaught (in promise) Error: npm run test failed with exit code 1
        throw new Error(
              ^
    at runCommand (https://deno.land/x/[email protected]/lib/utils.ts:56:15)
    at async build (https://deno.land/x/[email protected]/mod.ts:372:5)
    at async file:///path/to/dnt-playground/build-node-package.ts:5:1

mfulton26 avatar Sep 05 '22 18:09 mfulton26