diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..c13c5f6 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/MiniBase.js b/MiniBase.js index 5048002..6b70e3a 100644 --- a/MiniBase.js +++ b/MiniBase.js @@ -24,7 +24,7 @@ */ 'use strict'; -import { $A } from 'miniprototype.js'; +import { $A } from './miniprototype.js'; // Non-Lively Compatibility export var Global = {}; diff --git a/package.json b/package.json index 7a7342e..e48dfbd 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "test": "tests" }, "scripts": { - "test": "karma start --single-run", + "test": "npm run test-node && npm run test-karma", + "test-karma": "karma start --single-run", + "test-node": "mocha tests --compilers js:babel-core/register --require tests/globalChai.js", "test-chrome-only": "karma start --single-run --browsers Chrome", "test-continuously": "karma start", "test-continuously-chrome-only": "karma start --browsers Chrome", diff --git a/tests/LayerInliningTests.js b/tests/LayerInliningTests.js index 2db78cf..9a9528a 100644 --- a/tests/LayerInliningTests.js +++ b/tests/LayerInliningTests.js @@ -1,6 +1,7 @@ 'use strict'; -import { default as cop } from 'copv2/Layers.js'; +import { default as cop } from '../copv2/Layers.js'; +import '../MiniBase.js' cop.tests = {}; cop.tests.LayerInliningTests = {}; diff --git a/tests/LayerTests.js b/tests/LayerTests.js index 59a1e5d..147ec95 100644 --- a/tests/LayerTests.js +++ b/tests/LayerTests.js @@ -23,7 +23,7 @@ */ 'use strict'; -import { default as cop, Layer, LayerableObject, Global } from 'copv2/Layers.js'; +import { default as cop, Layer, LayerableObject, Global } from '../copv2/Layers.js'; // COP Example from: Hirschfeld, Costanza, Nierstrasz. 2008. // Context-oriented Programming. JOT) @@ -827,9 +827,11 @@ describe('cop', function () { .refineObject(o, { say: function(a) {return cop.proceed(a + " World") + "!"}}) assert.equal(o.say("Hello"), "Say: Hello", "test is broken"); cop.withLayers([l], function() { - console.group("SayHello"); + if (typeof console.group !== 'undefined') + console.group("SayHello"); var result = o.say("Hello") - console.groupEnd("SayHello"); + if (typeof console.group !== 'undefined') + console.groupEnd("SayHello"); assert.equal(result, "Say: Hello World!", "adapting arguments is broken"); }.bind(this)); }); diff --git a/tests/TracingTests.js b/tests/TracingTests.js index 8bdddf8..177736c 100644 --- a/tests/TracingTests.js +++ b/tests/TracingTests.js @@ -1,4 +1,4 @@ -import { default as cop } from 'copv2/Layers'; +import { default as cop } from '../copv2/Layers'; function TestCase() {}; // TODO: get rid of this TestCase.subclass('cop.tests.TracingTests.TracerTest', diff --git a/tests/globalChai.js b/tests/globalChai.js new file mode 100644 index 0000000..03e17ad --- /dev/null +++ b/tests/globalChai.js @@ -0,0 +1,3 @@ +// only to be run with node (or rather mocha), not in a browser + +global.chai = require('chai');