question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unit tests on Node.js don't run locally (on Windows?)

See original GitHub issue

Describe the bug

The unit tests on Node.js don’t run locally. They seem to run on CI server, so it might be a platform specific issue? (Refer to the Platform section below for my environment.)

To Reproduce

Steps to reproduce the behavior:

  1. $ npm install
  2. $ npm install --prefix test
  3. $ npm run test-unit

Error log:

$ npm run test-unit

> three@0.137.5 test-unit
> npm run unit --prefix test


> test-deps-intaller@1.0.0 unit
> qunit -r failonlyreporter -f !-webonly unit/three.source.unit.js

not ok 1 global failure
  ---
  message: "No tests matched the filter \"!-webonly\"."
  severity: failed
  actual: undefined
  expected: undefined
  stack: "Error: No tests matched the filter \"!-webonly\".\n    at done (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:2074:17)\n    at advanceTestQueue (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:1985:7)\n    at Object.advance (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:1940:7)\n    at unblockAndAdvanceQueue (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:4321:21)"
  ...
1..2
# pass 0
# skip 0
# todo 0
# fail 2

-f !-webonly may be unrelated. Even if I remove that filter, the tests still don’t run.

$ npm run test-unit

> three@0.137.5 test-unit
> npm run unit --prefix test


> test-deps-intaller@1.0.0 unit
> qunit -r failonlyreporter unit/three.source.unit.js

not ok 1 global failure
  ---
  message: "No tests were run."
  severity: failed
  actual: undefined
  expected: undefined
  stack: "Error: No tests were run.\n    at done (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:2082:17)\n    at advanceTestQueue (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:1985:7)\n    at Object.advance (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:1940:7)\n    at unblockAndAdvanceQueue (C:\Users\Takahiro\Documents\three.js\test\node_modules\qunit\qunit\qunit.js:4321:21)"
  ...
1..2
# pass 0
# skip 0
# todo 0
# fail 2

Expected behavior

The tests run locally.

Platform:

  • Device: Desktop
  • OS: Windows 10
  • Three.js version: dev
  • Node.js (node.js v16.13.2, npm 8.1.2), Git Bash

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
marcofugarocommented, Apr 28, 2022

Or has the entry in the lock file a higher priority?

Yup, since the package-lock.json was introduced all package versions are locked so it’s the same on any machine 😊

1reaction
LeviPesincommented, Apr 28, 2022

It is written in https://github.com/mrdoob/three.js/blob/dev/test/README.md. I think it should be added to CONTRIBUTING.md but not be performed automatically…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test nodejs server code without running server - Stack Overflow
I have a nodejs server that runs some complex server side logic, and I'm looking at building a unit test runner for that...
Read more >
Unit testing JavaScript and TypeScript - Visual Studio (Windows)
Visual Studio provides support unit testing JavaScript and TypeScript code using the Node.js Tools for Visual Studio.
Read more >
Unit testing in Node.js - ticehurst.com
You can run the tests by clicking the Run All link in the Test Explorer window. Or, you can run tests by selecting...
Read more >
Node.js Unit Testing: Get Started Quickly With Examples
This post we'll show you how to get started with Node.js unit testing in practice, with examples. Think of this post as a...
Read more >
Testing Node.js | WebStorm Documentation - JetBrains
With WebStorm, you can test Node.js applications using numerous frameworks. ... npm install mocha for local installation in your project.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found