Remove chai dependency (#136052)

* Remove chai dependency

This replaces tests sill using chai with @kbn/expect

* fix missing test

* a->an(Error)
This commit is contained in:
Jonathan Budzenski 2022-07-11 11:14:18 -05:00 committed by GitHub
parent 6200837594
commit e815df9c08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 40 additions and 73 deletions

View file

@ -959,7 +959,6 @@
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"backport": "^8.8.0",
"callsites": "^3.1.0",
"chai": "3.5.0",
"chance": "1.0.18",
"chokidar": "^3.4.3",
"chromedriver": "^103.0.0",

View file

@ -8,7 +8,7 @@
import fn from './average';
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import _ from 'lodash';
describe('average.js', function () {

View file

@ -8,7 +8,7 @@
import fn from './carry';
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import _ from 'lodash';
describe('carry.js', function () {
@ -71,7 +71,7 @@ describe('carry.js', function () {
fn(data, target);
expect.fail('Success. Doh.');
} catch (e) {
expect(e).to.be.an('error');
expect(e).to.be.an(Error);
}
});
});

View file

@ -8,7 +8,7 @@
const parseSheet = require('./parse_sheet');
const expect = require('chai').expect;
import expect from '@kbn/expect';
describe('timelion parse_sheet function', function () {
it(`doesn't split expressions on whitespace`, async function () {

View file

@ -8,7 +8,7 @@
const fn = require('./load_functions');
const expect = require('chai').expect;
import expect from '@kbn/expect';
describe('load_functions.js', () => {
it('exports a function', () => {

View file

@ -9,7 +9,7 @@
import fn from './abs';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
const seriesList = require('./fixtures/series_list')();
import invoke from './helpers/invoke_series_fn';

View file

@ -9,7 +9,7 @@
import fn from '.';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from '../helpers/invoke_series_fn';
describe('aggregate', () => {

View file

@ -9,7 +9,7 @@
import fn from './bars';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('bars.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './color';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('color.js', () => {

View file

@ -8,7 +8,7 @@
import fn from './condition';
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
import getSeriesList from './helpers/get_single_series_list';
import _ from 'lodash';

View file

@ -9,7 +9,7 @@
import fn from './cusum';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('cusum.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './derivative';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('derivative.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './divide';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('divide.js', () => {

View file

@ -8,7 +8,7 @@
import fn from './first';
const expect = require('chai').expect;
import expect from '@kbn/expect';
const seriesList = require('./fixtures/series_list')();
import invoke from './helpers/invoke_series_fn';

View file

@ -8,7 +8,7 @@
const fn = require('./fit');
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
import getSeriesList from './helpers/get_single_series_list';
import _ from 'lodash';

View file

@ -9,7 +9,7 @@
import fn from './hide';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('hide.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './label';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('label.js', () => {

View file

@ -8,7 +8,7 @@
import fn from './legend';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('legend.js', () => {

View file

@ -8,7 +8,7 @@
import fn from './lines';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('lines.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './log';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('log.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './max';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('max.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './min';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('min.js', () => {

View file

@ -7,7 +7,7 @@
*/
import fn from './movingaverage';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import moment from 'moment';
import _ from 'lodash';

View file

@ -9,7 +9,7 @@
import fn from './movingstd';
import moment from 'moment';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
import getSeries from './helpers/get_series';
import getSeriesList from './helpers/get_series_list';

View file

@ -9,7 +9,7 @@
import fn from './multiply';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('multiply.js', () => {

View file

@ -9,8 +9,7 @@
import fn from './points';
import _ from 'lodash';
import assert from 'chai';
const expect = assert.expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('points.js', () => {
@ -63,7 +62,7 @@ describe('points.js', () => {
return invoke(fn, [seriesList, null, null, null, null, 'beer'])
.then(expect.fail)
.catch((e) => {
expect(e).to.be.an('error');
expect(e).to.be.an(Error);
});
});
});

View file

@ -9,7 +9,7 @@
import fn from './precision';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('precision.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './range';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('range.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './scale_interval';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('scale_interval.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './static';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('static.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './subtract';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('subtract.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './sum';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('sum.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './title';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('title.js', () => {

View file

@ -9,7 +9,7 @@
import fn from './trim';
import _ from 'lodash';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('trim.js', () => {

View file

@ -7,7 +7,7 @@
*/
import fn from './yaxis';
const expect = require('chai').expect;
import expect from '@kbn/expect';
import invoke from './helpers/invoke_series_fn';
describe('yaxis.js', () => {
@ -83,16 +83,16 @@ describe('yaxis.js', () => {
it('throws an error if currency is not three letter code', () => {
invoke(fn, [seriesList, 1, null, null, null, null, null, 'currency:abcde']).catch((e) => {
expect(e).to.be.an.instanceof(Error);
expect(e).to.be.an(Error);
});
invoke(fn, [seriesList, 1, null, null, null, null, null, 'currency:12']).catch((e) => {
expect(e).to.be.an.instanceof(Error);
expect(e).to.be.an(Error);
});
invoke(fn, [seriesList, 1, null, null, null, null, null, 'currency:$#']).catch((e) => {
expect(e).to.be.an.instanceof(Error);
expect(e).to.be.an(Error);
});
invoke(fn, [seriesList, 1, null, null, null, null, null, 'currency:ab']).catch((e) => {
expect(e).to.be.an.instanceof(Error);
expect(e).to.be.an(Error);
});
});
});

View file

@ -9302,11 +9302,6 @@ assert@^1.4.0:
object-assign "^4.1.1"
util "0.10.3"
assertion-error@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
assign-symbols@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
@ -10731,15 +10726,6 @@ ccount@^1.0.0:
resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.0.5.tgz#ac82a944905a65ce204eb03023157edf29425c17"
integrity sha512-MOli1W+nfbPLlKEhInaxhRdp7KVLFxLN5ykwzHgLsLI3H3gs5jjFAK4Eoj3OzzcxCtumDaI8onoVDeQyWaNTkw==
chai@3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247"
integrity sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=
dependencies:
assertion-error "^1.0.1"
deep-eql "^0.1.3"
type-detect "^1.0.0"
chalk@4.1.0, chalk@^4.0.0, chalk@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
@ -12896,13 +12882,6 @@ deep-diff@^0.3.5:
resolved "https://registry.yarnpkg.com/deep-diff/-/deep-diff-0.3.8.tgz#c01de63efb0eec9798801d40c7e0dae25b582c84"
integrity sha1-wB3mPvsO7JeYgB1Ax+Da4ltYLIQ=
deep-eql@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2"
integrity sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=
dependencies:
type-detect "0.1.1"
deep-equal@^1.0.0, deep-equal@^1.0.1, deep-equal@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.1.tgz#b5c98c942ceffaf7cb051e24e1434a25a2e6076a"
@ -28581,21 +28560,11 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"
type-detect@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822"
integrity sha1-C6XsKohWQORw6k6FBZcZANrFiCI=
type-detect@4.0.8, type-detect@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
type-detect@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2"
integrity sha1-diIXzAbbJY7EiQihKY6LlRIejqI=
type-fest@^0.18.0:
version "0.18.1"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.18.1.tgz#db4bc151a4a2cf4eebf9add5db75508db6cc841f"