summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-03-08 15:22:27 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-03-08 16:53:01 +0200
commitc6598fc5da063f9b60204639cd619647cbbc89da (patch)
tree7f86fe914cec9a97205583e15c3f4e4c7ef74390
parent79f3307c4be67ee1f9be1e90e4d5d2031e27ab8e (diff)
downloadqtlocation-mapboxgl-c6598fc5da063f9b60204639cd619647cbbc89da.tar.gz
[core] Use ES6 import / export syntax for node test harness
-rw-r--r--package.json2
-rw-r--r--platform/node/index.js2
-rw-r--r--platform/node/test/js/cancel.test.js6
-rw-r--r--platform/node/test/js/map.test.js10
-rw-r--r--platform/node/test/js/request.test.js6
5 files changed, 13 insertions, 13 deletions
diff --git a/package.json b/package.json
index 7462ab751e..cc51245ba1 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,7 @@
},
"scripts": {
"install": "node-pre-gyp install --fallback-to-build=false || make node",
- "test": "tape platform/node/test/js/**/*.test.js",
+ "test": "tape -r esm platform/node/test/js/**/*.test.js",
"test-memory": "node --expose-gc platform/node/test/memory.test.js",
"test-suite": "run-s test-render test-query test-expressions",
"test-expressions": "node -r esm platform/node/test/expression.test.js",
diff --git a/platform/node/index.js b/platform/node/index.js
index 7ac44dd705..b5003c69eb 100644
--- a/platform/node/index.js
+++ b/platform/node/index.js
@@ -48,4 +48,4 @@ var Map = function(options) {
Map.prototype = mbgl.Map.prototype;
Map.prototype.constructor = Map;
-module.exports = Object.assign(mbgl, { Map: Map });
+export default Object.assign(mbgl, { Map: Map });
diff --git a/platform/node/test/js/cancel.test.js b/platform/node/test/js/cancel.test.js
index 17525fb863..d7d3ce2999 100644
--- a/platform/node/test/js/cancel.test.js
+++ b/platform/node/test/js/cancel.test.js
@@ -1,8 +1,8 @@
'use strict';
-var mockfs = require('./../mockfs');
-var mbgl = require('../../index');
-var test = require('tape');
+import mockfs from './../mockfs';
+import mbgl from '../../index';
+import test from'tape';
var options = {
request: function(req, callback) {
diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js
index b21c1519e3..a1290ca761 100644
--- a/platform/node/test/js/map.test.js
+++ b/platform/node/test/js/map.test.js
@@ -1,10 +1,10 @@
'use strict';
-var test = require('tape');
-var mbgl = require('../../index');
-var fs = require('fs');
-var path = require('path');
-var style = require('../fixtures/style.json');
+import test from 'tape';
+import mbgl from '../../index';
+import fs from 'fs';
+import path from 'path';
+import style from '../fixtures/style.json';
test('Map', function(t) {
// This test is skipped because of the req.respond shim in index.js
diff --git a/platform/node/test/js/request.test.js b/platform/node/test/js/request.test.js
index 4f8d1cabb0..3762ccd434 100644
--- a/platform/node/test/js/request.test.js
+++ b/platform/node/test/js/request.test.js
@@ -1,8 +1,8 @@
'use strict';
-var mockfs = require('../mockfs');
-var mbgl = require('../../index');
-var test = require('tape');
+import mockfs from '../mockfs';
+import mbgl from '../../index';
+import test from 'tape';
[ 'sprite_png', 'sprite_json', 'source_vector', 'glyph' ].forEach(function (resource) {
test(`render reports an error when the request function responds with an error (${resource})`, function(t) {