Skip to content

Commit

Permalink
chore: Use babel-register to run tests and bench
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Jun 2, 2021
1 parent fd96311 commit 8f332f0
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 28 deletions.
File renamed without changes.
5 changes: 2 additions & 3 deletions modules/web-mercator/test/node.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
require('@babel/register');

// Note: This script is started from root: cwd is not this folder
const SRC_DIR = './src';

// Enables ES2015 import/export in Node.js
require('reify');

// Registers an alias for this module
const path = require('path');
const moduleAlias = require('module-alias');
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"gl-matrix": "^3.0.0"
},
"devDependencies": {
"@babel/register": "^7.13.16",
"@probe.gl/bench": "^3.3.0",
"@probe.gl/test-utils": "^3.3.0",
"@turf/destination": "^6.0.1",
"babel-plugin-transform-builtin-extend": "^1.1.2",
"ocular-dev-tools": "1.0.0-alpha.4",
"pre-commit": "^1.2.2",
"reify": "^0.18.1"
"pre-commit": "^1.2.2"
},
"resolutions_notes": [
"Note: tape 4.12 and higher no longer compares 0 and -0 equally..."
Expand Down
2 changes: 0 additions & 2 deletions test/bench.js → test/bench/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

require('reify');

const {Bench} = require('@probe.gl/bench');
const addBenchmarks = require('./modules.bench').default;

Expand Down
8 changes: 4 additions & 4 deletions test/modules.bench.js → test/bench/modules.bench.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import coreBench from '../modules/core/test/bench';
import geospatialBench from '../modules/geospatial/test/bench';
import cullingBench from '../modules/culling/test/bench';
import polygonBench from '../modules/polygon/test/bench';
import coreBench from '../../modules/core/test/bench';
import geospatialBench from '../../modules/geospatial/test/bench';
import cullingBench from '../../modules/culling/test/bench';
import polygonBench from '../../modules/polygon/test/bench';

export default function addBenchmarks(suite, addReferenceBenchmarks) {
coreBench(suite, addReferenceBenchmarks);
Expand Down
25 changes: 25 additions & 0 deletions test/bench/node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) 2015 - 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

require('@babel/register')({
extensions: ['.js', '.jsx', '.ts', '.tsx']
});

require('./browser');
2 changes: 0 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

require('reify');

const {configure} = require('math.gl');

configure({debug: true});
Expand Down
6 changes: 6 additions & 0 deletions test/node.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
// const {resolve} = require('path');
// const ROOT_DIR = resolve(__dirname, '..')
require('@babel/register')({
extensions: ['.js', '.jsx', '.ts', '.tsx']
});

require('./index');
40 changes: 25 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,17 @@
"@babel/helper-validator-option" "^7.12.17"
"@babel/plugin-transform-typescript" "^7.13.0"

"@babel/register@^7.13.16":
version "7.13.16"
resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.13.16.tgz#ae3ab0b55c8ec28763877383c454f01521d9a53d"
integrity sha512-dh2t11ysujTwByQjXNgJ48QZ2zcXKQVdV8s0TbeMI0flmtGWCdTwK9tJiACHXPLmncm5+ktNn/diojA45JE4jg==
dependencies:
clone-deep "^4.0.1"
find-cache-dir "^2.0.0"
make-dir "^2.1.0"
pirates "^4.0.0"
source-map-support "^0.5.16"

"@babel/runtime-corejs3@^7.10.2":
version "7.14.0"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.14.0.tgz#6bf5fbc0b961f8e3202888cb2cd0fb7a0a9a3f66"
Expand Down Expand Up @@ -2411,11 +2422,6 @@ acorn@^4.0.4:
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
integrity sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=

acorn@^5.5.3:
version "5.7.4"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e"
integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==

acorn@^6.4.1:
version "6.4.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6"
Expand Down Expand Up @@ -5281,7 +5287,7 @@ finalhandler@~1.1.2:
statuses "~1.5.0"
unpipe "~1.0.0"

find-cache-dir@^2.1.0:
find-cache-dir@^2.0.0, find-cache-dir@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.1.0.tgz#8d0f94cd13fe43c6c7c261a0d86115ca918c05f7"
integrity sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==
Expand Down Expand Up @@ -7860,6 +7866,11 @@ node-libs-browser@^2.2.1:
util "^0.11.0"
vm-browserify "^1.0.1"

node-modules-regexp@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40"
integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA=

node-preload@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301"
Expand Down Expand Up @@ -8675,6 +8686,13 @@ pinkie@^2.0.0:
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=

pirates@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87"
integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA==
dependencies:
node-modules-regexp "^1.0.0"

pixelmatch@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/pixelmatch/-/pixelmatch-4.0.2.tgz#8f47dcec5011b477b67db03c243bc1f3085e8854"
Expand Down Expand Up @@ -9397,14 +9415,6 @@ regjsparser@^0.6.4:
dependencies:
jsesc "~0.5.0"

reify@^0.18.1:
version "0.18.1"
resolved "https://registry.yarnpkg.com/reify/-/reify-0.18.1.tgz#7e5fab2f4a33418ad42afded905cd0e78eef110b"
integrity sha512-eNiNGxo5Cz/s/7DOeQW5+lTAxMexZPFA8XW/ef6f8WBLtQfYAhDNXxva7ROFC/Wa3q91usYzqJYwC85OXaWUzA==
dependencies:
acorn "^5.5.3"
semver "^5.4.1"

relateurl@0.2.x:
version "0.2.7"
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
Expand Down Expand Up @@ -10021,7 +10031,7 @@ source-map-resolve@^0.5.0:
source-map-url "^0.4.0"
urix "^0.1.0"

source-map-support@~0.5.12:
source-map-support@^0.5.16, source-map-support@~0.5.12:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
Expand Down

0 comments on commit 8f332f0

Please sign in to comment.