Skip to content

Commit

Permalink
Merge pull request #19373 from munrocket/unit
Browse files Browse the repository at this point in the history
Tests: unit refactor
  • Loading branch information
munrocket authored May 16, 2020
2 parents b7a25a6 + d068dd0 commit c9e5983
Show file tree
Hide file tree
Showing 30 changed files with 31 additions and 36 deletions.
9 changes: 2 additions & 7 deletions test/unit/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
## Setup

- Install [Node.js](https://nodejs.org/)
- Execute `npm install`

## Build

- Execute `npm run build-test`
- Execute `npm i --prefix test` from root folder

## Run

You can run the unit tests in two environments:

- Node.js: Execute `npm run test`
- Node.js: Execute `npm run test-unit` from root folder
- Browser: Execute `npm run dev-test` and call `http://localhost:8080/test/unit/UnitTests.html` (see [How to run things locally](https://threejs.org/docs/#manual/introduction/How-to-run-things-locally))
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<div id="qunit-fixture"></div>

<script src="../node_modules/qunit/qunit/qunit.js"></script>
<script src="qunit-utils.js"></script>
<script src="SmartComparer.js"></script>
<script src="utils/qunit-utils.js"></script>
<script src="utils/SmartComparer.js"></script>

<!-- add sources to test below -->
<script src="../../build/three.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/BoxGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
BoxBufferGeometry
} from '../../../../src/geometries/BoxGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/CircleGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
CircleBufferGeometry
} from '../../../../src/geometries/CircleGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/ConeGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
ConeBufferGeometry
} from '../../../../src/geometries/ConeGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/CylinderGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
CylinderBufferGeometry
} from '../../../../src/geometries/CylinderGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/DodecahedronGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
DodecahedronBufferGeometry
} from '../../../../src/geometries/DodecahedronGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/IcosahedronGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
IcosahedronBufferGeometry
} from '../../../../src/geometries/IcosahedronGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/LatheGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
LatheBufferGeometry
} from '../../../../src/geometries/LatheGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/OctahedronGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
OctahedronBufferGeometry
} from '../../../../src/geometries/OctahedronGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/PlaneGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
PlaneBufferGeometry
} from '../../../../src/geometries/PlaneGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/PolyhedronGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
PolyhedronBufferGeometry
} from '../../../../src/geometries/PolyhedronGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/RingGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
RingBufferGeometry
} from '../../../../src/geometries/RingGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/SphereGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
SphereBufferGeometry
} from '../../../../src/geometries/SphereGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/TetrahedronGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
TetrahedronBufferGeometry
} from '../../../../src/geometries/TetrahedronGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/TorusGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
TorusBufferGeometry
} from '../../../../src/geometries/TorusGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/geometries/TorusKnotGeometry.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import {
TorusKnotBufferGeometry
} from '../../../../src/geometries/TorusKnotGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/helpers/BoxHelper.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdGeometryTests } from '../../qunit-utils';
import { runStdGeometryTests } from '../../utils/qunit-utils';
import { BoxHelper } from '../../../../src/helpers/BoxHelper';
import { BoxGeometry } from '../../../../src/geometries/BoxGeometry';
import { SphereGeometry } from '../../../../src/geometries/SphereGeometry';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/lights/AmbientLight.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdLightTests } from '../../qunit-utils';
import { runStdLightTests } from '../../utils/qunit-utils';
import { AmbientLight } from '../../../../src/lights/AmbientLight';

export default QUnit.module( 'Lights', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/lights/DirectionalLight.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdLightTests } from '../../qunit-utils';
import { runStdLightTests } from '../../utils/qunit-utils';
import { DirectionalLight } from '../../../../src/lights/DirectionalLight';

export default QUnit.module( 'Lights', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/lights/HemisphereLight.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdLightTests } from '../../qunit-utils';
import { runStdLightTests } from '../../utils/qunit-utils';
import { HemisphereLight } from '../../../../src/lights/HemisphereLight';

export default QUnit.module( 'Lights', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/lights/Light.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
/* global QUnit */

import { runStdLightTests } from '../../qunit-utils';
import { runStdLightTests } from '../../utils/qunit-utils';
import { Light } from '../../../../src/lights/Light';

export default QUnit.module( 'Lights', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/lights/PointLight.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdLightTests } from '../../qunit-utils';
import { runStdLightTests } from '../../utils/qunit-utils';
import { PointLight } from '../../../../src/lights/PointLight';

export default QUnit.module( 'Lights', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/lights/RectAreaLight.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdLightTests } from '../../qunit-utils';
import { runStdLightTests } from '../../utils/qunit-utils';
import { RectAreaLight } from '../../../../src/lights/RectAreaLight';

export default QUnit.module( 'Lights', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/src/lights/SpotLight.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/* global QUnit */

import { runStdLightTests } from '../../qunit-utils';
import { runStdLightTests } from '../../utils/qunit-utils';
import { SpotLight } from '../../../../src/lights/SpotLight';

export default QUnit.module( 'Lights', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/three.editor.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// TODO (Itee) Editor is not es6 module so care to include order !!!
// TODO: all views could not be testable, waiting modular code before implement units tests on them

import './qunit-utils.js';
import './utils/qunit-utils.js';

//editor
import './editor/Command.tests';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/three.example.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @author TristanVALCKE / https://github.com/Itee
*/

import './qunit-utils.js';
import './utils/qunit-utils.js';

import './example/utils/BufferGeometryUtils.tests';
import './example/exporters/GLTFExporter.tests';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/three.source.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @author TristanVALCKE / https://github.com/Itee
*/

import './qunit-utils.js';
import './utils/qunit-utils.js';

//src
import './src/constants.tests';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* global QUnit */

import { SmartComparer } from './SmartComparer';
import { ObjectLoader } from '../../src/loaders/ObjectLoader';
import { ObjectLoader } from '../../../src/loaders/ObjectLoader';

QUnit.assert.success = function ( message ) {

Expand Down

0 comments on commit c9e5983

Please sign in to comment.