Questions tagged [node-test-runner]

The inbuilt test runner in node.js.

Use this tag for questions about the inbuilt test runner in node.js, eg what happens when you run node --test.

7 questions
1
vote
1 answer

Node Test Runner & the TAP protocol. How to log/print the vals, desc & results of successful tests

Node.js Test-runner / TAP Protocol So I really like the idea of Node.js using its own test-runner, and I like the idea of it using the Tap protocol. The only issue I have, is sometimes while developing my tests (using Mocha &/or Jest) I like to view…
JΛYDΞV
  • 8,532
  • 3
  • 51
  • 77
0
votes
1 answer

Problems using NodeJS test runner in a NestJS project

I'm trying to run tests in my NestJS application using NodeJS native test runner, but I'm having some trouble. 1 - I can't run multiple test files with this script "test": "node -r tsconfig-paths/register -r ts-node/register --test ./test". It only…
0
votes
0 answers

Cannot create server in before hook in node test runner

I need to test a socket server and a socket client made with socket.io, i was following the official documentation, in the example they created the server and client before each test, so for individual testing (previous client or server) I adapted…
0
votes
1 answer

How can I exclude an ambient module declaration like node:test from VS Code's auto import suggestions?

I'm aware of the VS Code setting named typescript.preferences.autoImportFileExcludePatterns (ref), and my local VS Code is using a recent TypeScript version which support that setting: Yet I'm not able to prevent VS Code from suggesting to import…
superjos
  • 12,189
  • 6
  • 89
  • 134
0
votes
0 answers

Node test runner, group multiple tests together

I've multiple tests that I'd like to group together. I'm currently using require to group them under a common describe ancestor: // all tests describe('Some feature',() => { require('some_use_case'); …
Ced
  • 15,847
  • 14
  • 87
  • 146
0
votes
0 answers

How to get output of console.log when using node:test?

I am using node:test test runner. The test simply prints to stdout using console.log. console.log({ foo: JSON.stringify(choices) }); I expect the output to include the result of JSON.stringify, but instead I am getting: node --test…
Luc Gagan
  • 301
  • 9
0
votes
0 answers

Native Node Test Runner with tap-* formatter

I am using node:test as a substitute for mocha. package.json script is a simple "node --test" which looks in my 'test' directory and executes all files there. All files are executed, and I get activity printouts to the terminal when I do not…
Energetic Pixels
  • 349
  • 3
  • 15