Skip to content

Commit

Permalink
add node based testing framework
Browse files Browse the repository at this point in the history
  • Loading branch information
Urs Hanselmann committed Sep 18, 2018
1 parent f38ad82 commit 1296559
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea/
addons/.idea/
addons/io_scene_gltf2/.idea/
mochawesome-report
2 changes: 1 addition & 1 deletion DOCKER.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
./docker_build.sh

# To run tests:
docker run --rm -t gltf-io-test run_tests.sh
docker run --rm -t gltf-io-test npm test

# To open blender shell:
docker run -i -t gltf-io-test blender -b --addons io_scene_gltf2 --python-console
Expand Down
9 changes: 8 additions & 1 deletion Dockerfile.testenv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ ENV DART_VERSION 2.0.0

RUN \
apt-get -q update && apt-get install --no-install-recommends -y -q \
apt-transport-https bzip2 curl git gnupg ca-certificates libfreetype6 libgl1-mesa-dev libglu1-mesa libxi6 libxrender1 openssh-client && \
apt-transport-https bzip2 curl git gnupg ca-certificates libfreetype6 \
libgl1-mesa-dev libglu1-mesa libxi6 libxrender1 openssh-client \
nodejs npm && \
curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_unstable.list > /etc/apt/sources.list.d/dart_unstable.list && \
Expand All @@ -30,3 +32,8 @@ RUN cd glTF-Validator && pub get && pub global activate --source path ./
ENV PATH $PATH:/root/.pub-cache/bin:/opt/blender

ADD addons/io_scene_gltf2 /opt/blender/$BLENDER_VERSION/scripts/addons/io_scene_gltf2

ADD tests/package.json /tests/
WORKDIR /tests

RUN npm install
9 changes: 9 additions & 0 deletions docker_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

docker build -t gltf-io-test -f Dockerfile.tests tests

# TODO: find a more elegant way to do this
docker run -t gltf-io-test npm test
ID=$(docker ps -l -q)
docker cp $ID:/tests/mochawesome-report/ .
docker rm $ID
13 changes: 13 additions & 0 deletions tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "gltftest",
"version": "1.0.0",
"description": "",
"dependencies": {},
"devDependencies": {
"mocha": "^5.2.0",
"mochawesome": "^3.0.3"
},
"scripts": {
"test": "mocha --reporter mochawesome"
}
}
8 changes: 8 additions & 0 deletions tests/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var assert = require('assert');
describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() {
assert.equal([1,2,3].indexOf(4), -1);
});
});
});

0 comments on commit 1296559

Please sign in to comment.