mirror of https://github.com/zulip/zulip.git
frontend_tests: Switch from ts-node to Babel; add rewire-ts plugin.
This will let tests rewrite TypeScript/ES6 module bindings that would otherwise be read-only. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
72366c8deb
commit
173c9cee42
|
@ -1,19 +1,16 @@
|
|||
require('ts-node').register({
|
||||
project: 'static/js/tsconfig.json',
|
||||
compilerOptions: {
|
||||
typeRoots: ["node_modules/@types", "./js_typings"],
|
||||
// We don't have webpack to handle es6 modules here so directly
|
||||
// transpile to CommonJS format.
|
||||
module: "commonjs",
|
||||
},
|
||||
});
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var escapeRegExp = require("lodash/escapeRegExp");
|
||||
|
||||
require("@babel/register")({
|
||||
extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".ts"],
|
||||
only: [
|
||||
new RegExp("^" + escapeRegExp(path.resolve(__dirname, "../../static/js")) + path.sep),
|
||||
],
|
||||
plugins: ["rewire-ts"],
|
||||
});
|
||||
|
||||
global.assert = require('assert');
|
||||
require('core-js/features/string/code-point-at');
|
||||
|
||||
global._ = require('underscore/underscore.js');
|
||||
var _ = global._;
|
||||
const windowObj = {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
||||
"@babel/preset-env": "^7.5.5",
|
||||
"@babel/preset-typescript": "^7.3.3",
|
||||
"@babel/register": "^7.6.2",
|
||||
"@types/node": "^12.0.7",
|
||||
"@types/underscore": "^1.8.18",
|
||||
"@types/webpack": "^4.4.32",
|
||||
|
@ -60,7 +61,6 @@
|
|||
"style-loader": "^1.0.0",
|
||||
"terser-webpack-plugin": "^2.1.0",
|
||||
"to-markdown": "^3.1.0",
|
||||
"ts-node": "^8.4.1",
|
||||
"typescript": "^3.5.1",
|
||||
"underscore": "^1.9.1",
|
||||
"webfonts-loader": "^5.0.0",
|
||||
|
@ -75,6 +75,7 @@
|
|||
"@types/source-map": "0.5.2",
|
||||
"@typescript-eslint/eslint-plugin": "^1.12.0",
|
||||
"@typescript-eslint/parser": "^1.12.0",
|
||||
"babel-plugin-rewire-ts": "^1.3.3",
|
||||
"casperjs": "casperjs/casperjs",
|
||||
"difflib": "^0.2.4",
|
||||
"eslint": "^6.0.1",
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { basename, resolve } from 'path';
|
||||
import * as BundleTracker from 'webpack-bundle-tracker';
|
||||
import * as webpack from 'webpack';
|
||||
import BundleTracker from 'webpack-bundle-tracker';
|
||||
import webpack from 'webpack';
|
||||
// The devServer member of webpack.Configuration is managed by the
|
||||
// webpack-dev-server package. We are only importing the type here.
|
||||
import * as _webpackDevServer from 'webpack-dev-server';
|
||||
import _webpackDevServer from 'webpack-dev-server';
|
||||
import { getExposeLoaders, cacheLoader } from './webpack-helpers';
|
||||
import * as MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
import * as OptimizeCssAssetsPlugin from 'optimize-css-assets-webpack-plugin';
|
||||
import * as CleanCss from 'clean-css';
|
||||
import * as TerserPlugin from 'terser-webpack-plugin';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
import OptimizeCssAssetsPlugin from 'optimize-css-assets-webpack-plugin';
|
||||
import CleanCss from 'clean-css';
|
||||
import TerserPlugin from 'terser-webpack-plugin';
|
||||
|
||||
const assets = require('./webpack.assets.json');
|
||||
|
||||
|
|
|
@ -26,4 +26,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea
|
|||
# historical commits sharing the same major version, in which case a
|
||||
# minor version bump suffices.
|
||||
|
||||
PROVISION_VERSION = '58.2'
|
||||
PROVISION_VERSION = '59.0'
|
||||
|
|
61
yarn.lock
61
yarn.lock
|
@ -658,6 +658,17 @@
|
|||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
"@babel/plugin-transform-typescript" "^7.6.0"
|
||||
|
||||
"@babel/register@^7.6.2":
|
||||
version "7.6.2"
|
||||
resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.6.2.tgz#25765a922202cb06f8bdac5a3b1e70cd6bf3dd45"
|
||||
integrity sha512-xgZk2LRZvt6i2SAUWxc7ellk4+OYRgS3Zpsnr13nMS1Qo25w21Uu8o6vTOAqNaxiqrnv30KTYzh9YWY2k21CeQ==
|
||||
dependencies:
|
||||
find-cache-dir "^2.0.0"
|
||||
lodash "^4.17.13"
|
||||
mkdirp "^0.5.1"
|
||||
pirates "^4.0.0"
|
||||
source-map-support "^0.5.9"
|
||||
|
||||
"@babel/runtime@^7.3.1":
|
||||
version "7.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.0.tgz#4fc1d642a9fd0299754e8b5de62c631cf5568205"
|
||||
|
@ -1479,11 +1490,6 @@ are-we-there-yet@~1.1.2:
|
|||
delegates "^1.0.0"
|
||||
readable-stream "^2.0.6"
|
||||
|
||||
arg@^4.1.0:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.1.tgz#485f8e7c390ce4c5f78257dbea80d4be11feda4c"
|
||||
integrity sha512-SlmP3fEA88MBv0PypnXZ8ZfJhwmDeIE3SP71j37AiXQBXYosPV0x6uISAaHYSlSVhmHOVkomen0tbGk6Anlebw==
|
||||
|
||||
argparse@^1.0.6, argparse@^1.0.7:
|
||||
version "1.0.10"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
|
||||
|
@ -1694,6 +1700,11 @@ babel-plugin-dynamic-import-node@^2.3.0:
|
|||
dependencies:
|
||||
object.assign "^4.1.0"
|
||||
|
||||
babel-plugin-rewire-ts@^1.3.3:
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/babel-plugin-rewire-ts/-/babel-plugin-rewire-ts-1.3.3.tgz#84d5f65c622e39bd9cf289f3245e49406cd64eb3"
|
||||
integrity sha512-bCIfrhk/kHRRobofYnhGEUDmroZq/RxJ6d98M+9a1Ef70PhD0wgQUqizVQhTpT51dmx1GwPS9PXBE3sX1TUJDQ==
|
||||
|
||||
bail@^1.0.0:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.4.tgz#7181b66d508aa3055d3f6c13f0a0c720641dde9b"
|
||||
|
@ -3407,11 +3418,6 @@ detect-node@^2.0.4:
|
|||
resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c"
|
||||
integrity sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==
|
||||
|
||||
diff@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff"
|
||||
integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==
|
||||
|
||||
diffie-hellman@^5.0.0:
|
||||
version "5.0.3"
|
||||
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
|
||||
|
@ -6749,11 +6755,6 @@ make-dir@^3.0.0:
|
|||
dependencies:
|
||||
semver "^6.0.0"
|
||||
|
||||
make-error@^1.1.1:
|
||||
version "1.3.5"
|
||||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8"
|
||||
integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==
|
||||
|
||||
mamacro@^0.0.3:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.yarnpkg.com/mamacro/-/mamacro-0.0.3.tgz#ad2c9576197c9f1abf308d0787865bd975a3f3e4"
|
||||
|
@ -7477,6 +7478,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-pre-gyp@^0.12.0:
|
||||
version "0.12.0"
|
||||
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz#39ba4bb1439da030295f899e3b520b7785766149"
|
||||
|
@ -8258,6 +8264,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"
|
||||
|
||||
pkg-dir@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3"
|
||||
|
@ -10196,7 +10209,7 @@ source-map-resolve@^0.5.0:
|
|||
source-map-url "^0.4.0"
|
||||
urix "^0.1.0"
|
||||
|
||||
source-map-support@^0.5.6, source-map-support@~0.5.12:
|
||||
source-map-support@^0.5.9, source-map-support@~0.5.12:
|
||||
version "0.5.13"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932"
|
||||
integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==
|
||||
|
@ -11239,17 +11252,6 @@ trough@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.4.tgz#3b52b1f13924f460c3fbfd0df69b587dbcbc762e"
|
||||
integrity sha512-tdzBRDGWcI1OpPVmChbdSKhvSVurznZ8X36AYURAcl+0o2ldlCY2XPzyXNNxwJwwyIU+rIglTCG4kxtNKBQH7Q==
|
||||
|
||||
ts-node@^8.4.1:
|
||||
version "8.4.1"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.4.1.tgz#270b0dba16e8723c9fa4f9b4775d3810fd994b4f"
|
||||
integrity sha512-5LpRN+mTiCs7lI5EtbXmF/HfMeCjzt7DH9CZwtkr6SywStrNQC723wG+aOWFiLNn7zT3kD/RnFqi3ZUfr4l5Qw==
|
||||
dependencies:
|
||||
arg "^4.1.0"
|
||||
diff "^4.0.1"
|
||||
make-error "^1.1.1"
|
||||
source-map-support "^0.5.6"
|
||||
yn "^3.0.0"
|
||||
|
||||
tslib@^1.8.1, tslib@^1.9.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||
|
@ -12366,11 +12368,6 @@ yauzl@2.4.1:
|
|||
dependencies:
|
||||
fd-slicer "~1.0.1"
|
||||
|
||||
yn@^3.0.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
|
||||
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
|
||||
|
||||
z-schema-errors@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/z-schema-errors/-/z-schema-errors-0.0.1.tgz#e06270a4ca43925729f25764789ca9f46bff0f7d"
|
||||
|
|
Loading…
Reference in New Issue