@cubejs-backend/testing 0.29.43 → 0.29.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.29.48](https://github.com/cube-js/cube.js/compare/v0.29.47...v0.29.48) (2022-04-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * **query-language:** "total" flag support ([#4134](https://github.com/cube-js/cube.js/issues/4134)) ([51aef5e](https://github.com/cube-js/cube.js/commit/51aef5ede6e9b0c0e0e8749119e98102f168b8ca))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.29.43](https://github.com/cube-js/cube.js/compare/v0.29.42...v0.29.43) (2022-04-07)
7
18
 
8
19
  **Note:** Version bump only for package @cubejs-backend/testing
@@ -25,7 +25,15 @@ services:
25
25
  CUBEJS_API_SECRET: mysupersecret
26
26
  volumes:
27
27
  - ./postgresql/single/cube.js:/cube/conf/cube.js
28
+ - ./postgresql/schema/Orders.js:/cube/conf/schema/Orders.js
28
29
  - ./postgresql/schema/OrdersPA.js:/cube/conf/schema/OrdersPA.js
30
+ - ./postgresql/schema/CAST.js:/cube/conf/schema/CAST.js
31
+ - ./postgresql/schema/Customers.js:/cube/conf/schema/Customers.js
32
+ - ./postgresql/schema/Customers.sql.js:/cube/conf/schema/Customers.sql.js
33
+ - ./postgresql/schema/ECommerce.js:/cube/conf/schema/ECommerce.js
34
+ - ./postgresql/schema/ECommerce.sql.js:/cube/conf/schema/ECommerce.sql.js
35
+ - ./postgresql/schema/Products.js:/cube/conf/schema/Products.js
36
+ - ./postgresql/schema/Products.sql.js:/cube/conf/schema/Products.sql.js
29
37
  ports:
30
38
  - "4000:4000"
31
39
  restart: always
@@ -23,7 +23,15 @@ services:
23
23
  CUBEJS_API_SECRET: mysupersecret
24
24
  volumes:
25
25
  - ./postgresql/single/cube.js:/cube/conf/cube.js
26
+ - ./postgresql/schema/Orders.js:/cube/conf/schema/Orders.js
26
27
  - ./postgresql/schema/OrdersPA.js:/cube/conf/schema/OrdersPA.js
28
+ - ./postgresql/schema/CAST.js:/cube/conf/schema/CAST.js
29
+ - ./postgresql/schema/Customers.js:/cube/conf/schema/Customers.js
30
+ - ./postgresql/schema/Customers.sql.js:/cube/conf/schema/Customers.sql.js
31
+ - ./postgresql/schema/ECommerce.js:/cube/conf/schema/ECommerce.js
32
+ - ./postgresql/schema/ECommerce.sql.js:/cube/conf/schema/ECommerce.sql.js
33
+ - ./postgresql/schema/Products.js:/cube/conf/schema/Products.js
34
+ - ./postgresql/schema/Products.sql.js:/cube/conf/schema/Products.sql.js
27
35
  ports:
28
36
  - "4000:4000"
29
37
  restart: always
@@ -0,0 +1,36 @@
1
+ export const DB_CAST = {
2
+ athena: {
3
+ SELECT_PREFIX: '',
4
+ SELECT_SUFFIX: '',
5
+ },
6
+ bigquery: {
7
+ SELECT_PREFIX: '',
8
+ SELECT_SUFFIX: '',
9
+ },
10
+ postgres: {
11
+ SELECT_PREFIX: '',
12
+ SELECT_SUFFIX: '',
13
+ },
14
+ questdb: {
15
+ SELECT_PREFIX: 'with tmp_tbl as (\n',
16
+ SELECT_SUFFIX: ')\nselect * from tmp_tbl',
17
+ },
18
+ };
19
+ export const DATE_CAST = {
20
+ athena: {
21
+ DATE_PREFIX: 'date_parse(',
22
+ DATE_SUFFIX: ', \'%Y-%m-%d\')',
23
+ },
24
+ bigquery: {
25
+ DATE_PREFIX: 'parse_date(\'%Y-%m-%d\', ',
26
+ DATE_SUFFIX: ')',
27
+ },
28
+ postgres: {
29
+ DATE_PREFIX: 'to_date(',
30
+ DATE_SUFFIX: ', \'YYYY-MM-DD\')',
31
+ },
32
+ questdb: {
33
+ DATE_PREFIX: 'to_date(',
34
+ DATE_SUFFIX: ', \'YYYY-MM-DD\')',
35
+ },
36
+ };
@@ -0,0 +1,15 @@
1
+ import { sql } from './Customers.sql';
2
+
3
+ cube(`Customers`, {
4
+ sql: sql('_type_'),
5
+ dimensions: {
6
+ customerId: {
7
+ sql: 'customer_id',
8
+ type: 'string',
9
+ },
10
+ customerName: {
11
+ sql: 'customer_name',
12
+ type: 'string',
13
+ },
14
+ },
15
+ });
@@ -0,0 +1,49 @@
1
+ import { DB_CAST } from './CAST';
2
+
3
+ export const sql = (type) => {
4
+ const { SELECT_PREFIX, SELECT_SUFFIX } = DB_CAST[type];
5
+ const select = `
6
+ select 'AH-10465' as customer_id, 'Customer 1' as customer_name union all
7
+ select 'AJ-10780' as customer_id, 'Customer 2' as customer_name union all
8
+ select 'AS-10225' as customer_id, 'Customer 3' as customer_name union all
9
+ select 'AW-10840' as customer_id, 'Customer 4' as customer_name union all
10
+ select 'BB-11545' as customer_id, 'Customer 5' as customer_name union all
11
+ select 'BF-11020' as customer_id, 'Customer 6' as customer_name union all
12
+ select 'BF-11170' as customer_id, 'Customer 7' as customer_name union all
13
+ select 'BM-11650' as customer_id, 'Customer 8' as customer_name union all
14
+ select 'BS-11380' as customer_id, 'Customer 9' as customer_name union all
15
+ select 'BS-11755' as customer_id, 'Customer 10' as customer_name union all
16
+ select 'CA-12775' as customer_id, 'Customer 11' as customer_name union all
17
+ select 'CC-12475' as customer_id, 'Customer 12' as customer_name union all
18
+ select 'CD-12280' as customer_id, 'Customer 13' as customer_name union all
19
+ select 'CS-12355' as customer_id, 'Customer 14' as customer_name union all
20
+ select 'DB-13405' as customer_id, 'Customer 15' as customer_name union all
21
+ select 'DG-13300' as customer_id, 'Customer 16' as customer_name union all
22
+ select 'DW-13480' as customer_id, 'Customer 17' as customer_name union all
23
+ select 'EM-14140' as customer_id, 'Customer 18' as customer_name union all
24
+ select 'GA-14725' as customer_id, 'Customer 19' as customer_name union all
25
+ select 'GZ-14470' as customer_id, 'Customer 20' as customer_name union all
26
+ select 'HH-15010' as customer_id, 'Customer 21' as customer_name union all
27
+ select 'HK-14890' as customer_id, 'Customer 22' as customer_name union all
28
+ select 'JH-15430' as customer_id, 'Customer 23' as customer_name union all
29
+ select 'JO-15550' as customer_id, 'Customer 24' as customer_name union all
30
+ select 'JS-16030' as customer_id, 'Customer 25' as customer_name union all
31
+ select 'JW-15220' as customer_id, 'Customer 26' as customer_name union all
32
+ select 'KL-16555' as customer_id, 'Customer 27' as customer_name union all
33
+ select 'KN-16705' as customer_id, 'Customer 28' as customer_name union all
34
+ select 'LC-17050' as customer_id, 'Customer 29' as customer_name union all
35
+ select 'LR-16915' as customer_id, 'Customer 30' as customer_name union all
36
+ select 'MC-17605' as customer_id, 'Customer 31' as customer_name union all
37
+ select 'MG-17650' as customer_id, 'Customer 32' as customer_name union all
38
+ select 'ML-17755' as customer_id, 'Customer 33' as customer_name union all
39
+ select 'MM-18280' as customer_id, 'Customer 34' as customer_name union all
40
+ select 'NP-18670' as customer_id, 'Customer 35' as customer_name union all
41
+ select 'PF-19165' as customer_id, 'Customer 36' as customer_name union all
42
+ select 'SB-20185' as customer_id, 'Customer 37' as customer_name union all
43
+ select 'SS-20140' as customer_id, 'Customer 38' as customer_name union all
44
+ select 'TB-21175' as customer_id, 'Customer 39' as customer_name union all
45
+ select 'TS-21205' as customer_id, 'Customer 40' as customer_name union all
46
+ select 'WB-21850' as customer_id, 'Customer 41' as customer_name
47
+ `;
48
+ return SELECT_PREFIX + select + SELECT_SUFFIX;
49
+ };
@@ -0,0 +1,94 @@
1
+ import { sql } from './ECommerce.sql';
2
+ import { Products } from './Products';
3
+ import { Customers } from './Customers';
4
+
5
+ cube(`ECommerce`, {
6
+ sql: sql('_type_'),
7
+ extends: Products,
8
+ preAggregations: {
9
+ productAnalys: {
10
+ dimensions: [
11
+ CUBE.productName,
12
+ ],
13
+ measures: [
14
+ CUBE.totalQuantity,
15
+ CUBE.avgDiscount,
16
+ CUBE.totalSales,
17
+ CUBE.totalProfit,
18
+ ],
19
+ refreshKey: {
20
+ every: `1 hour`,
21
+ },
22
+ },
23
+ },
24
+ joins: {
25
+ Customers: {
26
+ relationship: 'belongsTo',
27
+ sql: `${CUBE}.customer_id = ${Customers}.customer_id`,
28
+ },
29
+ },
30
+ measures: {
31
+ count: {
32
+ type: `count`,
33
+ },
34
+ totalQuantity: {
35
+ sql: 'quantity',
36
+ type: 'sum',
37
+ },
38
+ avgDiscount: {
39
+ sql: 'discount',
40
+ type: 'avg',
41
+ },
42
+ totalSales: {
43
+ sql: 'sales',
44
+ type: 'sum',
45
+ },
46
+ totalProfit: {
47
+ sql: 'profit',
48
+ type: 'sum',
49
+ },
50
+ },
51
+ dimensions: {
52
+ rowId: {
53
+ sql: 'row_id',
54
+ type: 'number',
55
+ primaryKey: true,
56
+ },
57
+ orderId: {
58
+ sql: 'order_id',
59
+ type: 'string',
60
+ },
61
+ orderDate: {
62
+ sql: 'order_date',
63
+ type: 'time',
64
+ },
65
+ customerId: {
66
+ sql: 'customer_id',
67
+ type: 'string',
68
+ },
69
+ customerName: {
70
+ sql: `${Customers.customerName}`,
71
+ type: 'string',
72
+ },
73
+ city: {
74
+ sql: 'city',
75
+ type: 'string',
76
+ },
77
+ sales: {
78
+ sql: 'sales',
79
+ type: 'number',
80
+ },
81
+ quantity: {
82
+ sql: 'quantity',
83
+ type: 'number',
84
+ },
85
+ discount: {
86
+ sql: 'discount',
87
+ type: 'number',
88
+ },
89
+ profit: {
90
+ sql: 'profit',
91
+ type: 'number',
92
+ },
93
+ },
94
+ });
@@ -0,0 +1,53 @@
1
+ import { DB_CAST, DATE_CAST } from './CAST';
2
+
3
+ export const sql = (type) => {
4
+ const { SELECT_PREFIX, SELECT_SUFFIX } = DB_CAST[type];
5
+ const { DATE_PREFIX, DATE_SUFFIX } = DATE_CAST[type];
6
+ const select = `
7
+ select 3060 as row_id, 'CA-2017-131492' as order_id, ${DATE_PREFIX}'2020-10-19'${DATE_SUFFIX} as order_date, 'HH-15010' as customer_id, 'San Francisco' as city, 'Furniture' as category, 'Tables' as sub_category, 'Anderson Hickey Conga Table Tops & Accessories' as product_name, 24.36800 as sales, 2 as quantity, 0.20000 as discount, -3.35060 as profit union all
8
+ select 523 as row_id, 'CA-2017-145142' as order_id, ${DATE_PREFIX}'2020-01-23'${DATE_SUFFIX} as order_date, 'MC-17605' as customer_id, 'Detroit' as city, 'Furniture' as category, 'Tables' as sub_category, 'Balt Solid Wood Rectangular Table' as product_name, 210.98000 as sales, 2 as quantity, 0.00000 as discount, 21.09800 as profit union all
9
+ select 9584 as row_id, 'CA-2017-116127' as order_id, ${DATE_PREFIX}'2020-06-25'${DATE_SUFFIX} as order_date, 'SB-20185' as customer_id, 'New York City' as city, 'Furniture' as category, 'Bookcases' as sub_category, 'DMI Eclipse Executive Suite Bookcases' as product_name, 400.78400 as sales, 1 as quantity, 0.20000 as discount, -5.00980 as profit union all
10
+ select 8425 as row_id, 'CA-2017-150091' as order_id, ${DATE_PREFIX}'2020-10-12'${DATE_SUFFIX} as order_date, 'NP-18670' as customer_id, 'Lakewood' as city, 'Furniture' as category, 'Bookcases' as sub_category, 'Global Adaptabilites Bookcase, Cherry/Storm Gray Finish' as product_name, 2154.90000 as sales, 5 as quantity, 0.00000 as discount, 129.29400 as profit union all
11
+ select 2655 as row_id, 'CA-2017-112515' as order_id, ${DATE_PREFIX}'2020-09-17'${DATE_SUFFIX} as order_date, 'AS-10225' as customer_id, 'Provo' as city, 'Furniture' as category, 'Bookcases' as sub_category, 'Global Adaptabilites Bookcase, Cherry/Storm Gray Finish' as product_name, 1292.94000 as sales, 3 as quantity, 0.00000 as discount, 77.57640 as profit union all
12
+ select 2952 as row_id, 'CA-2017-134915' as order_id, ${DATE_PREFIX}'2020-11-12'${DATE_SUFFIX} as order_date, 'EM-14140' as customer_id, 'Glendale' as city, 'Furniture' as category, 'Chairs' as sub_category, 'Harbour Creations 67200 Series Stacking Chairs' as product_name, 113.88800 as sales, 2 as quantity, 0.20000 as discount, 9.96520 as profit union all
13
+ select 9473 as row_id, 'CA-2017-102925' as order_id, ${DATE_PREFIX}'2020-11-05'${DATE_SUFFIX} as order_date, 'CD-12280' as customer_id, 'New York City' as city, 'Furniture' as category, 'Chairs' as sub_category, 'Harbour Creations 67200 Series Stacking Chairs' as product_name, 128.12400 as sales, 2 as quantity, 0.10000 as discount, 24.20120 as profit union all
14
+ select 5220 as row_id, 'CA-2017-145653' as order_id, ${DATE_PREFIX}'2020-09-01'${DATE_SUFFIX} as order_date, 'CA-12775' as customer_id, 'Detroit' as city, 'Furniture' as category, 'Chairs' as sub_category, 'Harbour Creations 67200 Series Stacking Chairs' as product_name, 498.26000 as sales, 7 as quantity, 0.00000 as discount, 134.53020 as profit union all
15
+ select 4031 as row_id, 'CA-2017-124296' as order_id, ${DATE_PREFIX}'2020-12-24'${DATE_SUFFIX} as order_date, 'CS-12355' as customer_id, 'Lafayette' as city, 'Furniture' as category, 'Chairs' as sub_category, 'Iceberg Nesting Folding Chair, 19w x 6d x 43h' as product_name, 232.88000 as sales, 4 as quantity, 0.00000 as discount, 60.54880 as profit union all
16
+ select 8621 as row_id, 'US-2017-119319' as order_id, ${DATE_PREFIX}'2020-11-06'${DATE_SUFFIX} as order_date, 'LC-17050' as customer_id, 'Dallas' as city, 'Furniture' as category, 'Furnishings' as sub_category, 'Linden 10 Round Wall Clock, Black' as product_name, 30.56000 as sales, 5 as quantity, 0.60000 as discount, -19.86400 as profit union all
17
+ select 3059 as row_id, 'CA-2017-131492' as order_id, ${DATE_PREFIX}'2020-10-19'${DATE_SUFFIX} as order_date, 'HH-15010' as customer_id, 'San Francisco' as city, 'Furniture' as category, 'Furnishings' as sub_category, 'Linden 10 Round Wall Clock, Black' as product_name, 30.56000 as sales, 2 as quantity, 0.00000 as discount, 10.39040 as profit union all
18
+ select 7425 as row_id, 'CA-2017-135069' as order_id, ${DATE_PREFIX}'2020-04-10'${DATE_SUFFIX} as order_date, 'BS-11755' as customer_id, 'Philadelphia' as city, 'Furniture' as category, 'Furnishings' as sub_category, 'Linden 10 Round Wall Clock, Black' as product_name, 36.67200 as sales, 3 as quantity, 0.20000 as discount, 6.41760 as profit union all
19
+ select 849 as row_id, 'CA-2017-107503' as order_id, ${DATE_PREFIX}'2020-01-01'${DATE_SUFFIX} as order_date, 'GA-14725' as customer_id, 'Lorain' as city, 'Furniture' as category, 'Furnishings' as sub_category, 'Linden 10 Round Wall Clock, Black' as product_name, 48.89600 as sales, 4 as quantity, 0.20000 as discount, 8.55680 as profit union all
20
+ select 6205 as row_id, 'CA-2017-145660' as order_id, ${DATE_PREFIX}'2020-12-01'${DATE_SUFFIX} as order_date, 'MG-17650' as customer_id, 'Marion' as city, 'Furniture' as category, 'Furnishings' as sub_category, 'Magna Visual Magnetic Picture Hangers' as product_name, 7.71200 as sales, 2 as quantity, 0.20000 as discount, 1.73520 as profit union all
21
+ select 1494 as row_id, 'CA-2017-139661' as order_id, ${DATE_PREFIX}'2020-10-30'${DATE_SUFFIX} as order_date, 'JW-15220' as customer_id, 'Vancouver' as city, 'Furniture' as category, 'Furnishings' as sub_category, 'Magna Visual Magnetic Picture Hangers' as product_name, 9.64000 as sales, 2 as quantity, 0.00000 as discount, 3.66320 as profit union all
22
+ select 3934 as row_id, 'CA-2017-123001' as order_id, ${DATE_PREFIX}'2020-09-02'${DATE_SUFFIX} as order_date, 'AW-10840' as customer_id, 'Bakersfield' as city, 'Office Supplies' as category, 'Art' as sub_category, 'OIC #2 Pencils, Medium Soft' as product_name, 9.40000 as sales, 5 as quantity, 0.00000 as discount, 2.72600 as profit union all
23
+ select 3448 as row_id, 'CA-2017-102554' as order_id, ${DATE_PREFIX}'2020-06-11'${DATE_SUFFIX} as order_date, 'KN-16705' as customer_id, 'Auburn' as city, 'Office Supplies' as category, 'Art' as sub_category, 'OIC #2 Pencils, Medium Soft' as product_name, 3.76000 as sales, 2 as quantity, 0.00000 as discount, 1.09040 as profit union all
24
+ select 6459 as row_id, 'US-2017-133361' as order_id, ${DATE_PREFIX}'2020-05-14'${DATE_SUFFIX} as order_date, 'AJ-10780' as customer_id, 'Baltimore' as city, 'Office Supplies' as category, 'Art' as sub_category, 'OIC #2 Pencils, Medium Soft' as product_name, 3.76000 as sales, 2 as quantity, 0.00000 as discount, 1.09040 as profit union all
25
+ select 6272 as row_id, 'CA-2017-102379' as order_id, ${DATE_PREFIX}'2020-12-02'${DATE_SUFFIX} as order_date, 'BB-11545' as customer_id, 'Oakland' as city, 'Office Supplies' as category, 'Art' as sub_category, 'Panasonic KP-380BK Classic Electric Pencil Sharpener' as product_name, 179.90000 as sales, 5 as quantity, 0.00000 as discount, 44.97500 as profit union all
26
+ select 9619 as row_id, 'CA-2017-160633' as order_id, ${DATE_PREFIX}'2020-11-16'${DATE_SUFFIX} as order_date, 'BS-11380' as customer_id, 'Bowling' as city, 'Office Supplies' as category, 'Art' as sub_category, 'Panasonic KP-380BK Classic Electric Pencil Sharpener' as product_name, 86.35200 as sales, 3 as quantity, 0.20000 as discount, 5.39700 as profit union all
27
+ select 1013 as row_id, 'CA-2017-118437' as order_id, ${DATE_PREFIX}'2020-06-17'${DATE_SUFFIX} as order_date, 'PF-19165' as customer_id, 'Olympia' as city, 'Office Supplies' as category, 'Storage' as sub_category, 'Project Tote Personal File' as product_name, 14.03000 as sales, 1 as quantity, 0.00000 as discount, 4.06870 as profit union all
28
+ select 4012 as row_id, 'CA-2017-100811' as order_id, ${DATE_PREFIX}'2020-11-21'${DATE_SUFFIX} as order_date, 'CC-12475' as customer_id, 'Philadelphia' as city, 'Office Supplies' as category, 'Storage' as sub_category, 'Recycled Eldon Regeneration Jumbo File' as product_name, 39.29600 as sales, 4 as quantity, 0.20000 as discount, 3.92960 as profit union all
29
+ select 2595 as row_id, 'CA-2017-149048' as order_id, ${DATE_PREFIX}'2020-05-13'${DATE_SUFFIX} as order_date, 'BM-11650' as customer_id, 'Columbus' as city, 'Office Supplies' as category, 'Envelopes' as sub_category, 'Tyvek Side-Opening Peel & Seel Expanding Envelopes' as product_name, 180.96000 as sales, 2 as quantity, 0.00000 as discount, 81.43200 as profit union all
30
+ select 2329 as row_id, 'CA-2017-138422' as order_id, ${DATE_PREFIX}'2020-09-23'${DATE_SUFFIX} as order_date, 'KN-16705' as customer_id, 'Columbus' as city, 'Office Supplies' as category, 'Envelopes' as sub_category, 'Wausau Papers Astrobrights Colored Envelopes' as product_name, 14.35200 as sales, 3 as quantity, 0.20000 as discount, 5.20260 as profit union all
31
+ select 4227 as row_id, 'CA-2017-120327' as order_id, ${DATE_PREFIX}'2020-11-11'${DATE_SUFFIX} as order_date, 'WB-21850' as customer_id, 'Columbus' as city, 'Office Supplies' as category, 'Fasteners' as sub_category, 'Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box' as product_name, 45.92000 as sales, 4 as quantity, 0.00000 as discount, 21.58240 as profit union all
32
+ select 6651 as row_id, 'US-2017-124779' as order_id, ${DATE_PREFIX}'2020-09-08'${DATE_SUFFIX} as order_date, 'BF-11020' as customer_id, 'Arlington' as city, 'Office Supplies' as category, 'Fasteners' as sub_category, 'Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box' as product_name, 45.92000 as sales, 5 as quantity, 0.20000 as discount, 15.49800 as profit union all
33
+ select 8673 as row_id, 'CA-2017-163265' as order_id, ${DATE_PREFIX}'2020-02-16'${DATE_SUFFIX} as order_date, 'JS-16030' as customer_id, 'Decatur' as city, 'Office Supplies' as category, 'Fasteners' as sub_category, 'Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box' as product_name, 18.36800 as sales, 2 as quantity, 0.20000 as discount, 6.19920 as profit union all
34
+ select 1995 as row_id, 'CA-2017-133648' as order_id, ${DATE_PREFIX}'2020-06-25'${DATE_SUFFIX} as order_date, 'ML-17755' as customer_id, 'Columbus' as city, 'Office Supplies' as category, 'Fasteners' as sub_category, 'Plymouth Boxed Rubber Bands by Plymouth' as product_name, 11.30400 as sales, 3 as quantity, 0.20000 as discount, -2.11950 as profit union all
35
+ select 7310 as row_id, 'CA-2017-112172' as order_id, ${DATE_PREFIX}'2020-06-10'${DATE_SUFFIX} as order_date, 'MM-18280' as customer_id, 'New York City' as city, 'Office Supplies' as category, 'Fasteners' as sub_category, 'Plymouth Boxed Rubber Bands by Plymouth' as product_name, 14.13000 as sales, 3 as quantity, 0.00000 as discount, 0.70650 as profit union all
36
+ select 3717 as row_id, 'CA-2017-144568' as order_id, ${DATE_PREFIX}'2020-05-29'${DATE_SUFFIX} as order_date, 'JO-15550' as customer_id, 'Omaha' as city, 'Office Supplies' as category, 'Fasteners' as sub_category, 'Plymouth Boxed Rubber Bands by Plymouth' as product_name, 23.55000 as sales, 5 as quantity, 0.00000 as discount, 1.17750 as profit union all
37
+ select 4882 as row_id, 'CA-2017-143567' as order_id, ${DATE_PREFIX}'2020-11-02'${DATE_SUFFIX} as order_date, 'TB-21175' as customer_id, 'Columbus' as city, 'Technology' as category, 'Accessories' as sub_category, 'Logitech diNovo Edge Keyboard' as product_name, 2249.91000 as sales, 9 as quantity, 0.00000 as discount, 517.47930 as profit union all
38
+ select 5277 as row_id, 'CA-2017-147333' as order_id, ${DATE_PREFIX}'2020-12-14'${DATE_SUFFIX} as order_date, 'KL-16555' as customer_id, 'Columbus' as city, 'Technology' as category, 'Accessories' as sub_category, 'Kingston Digital DataTraveler 16GB USB 2.0' as product_name, 44.75000 as sales, 5 as quantity, 0.00000 as discount, 8.50250 as profit union all
39
+ select 6125 as row_id, 'CA-2017-145772' as order_id, ${DATE_PREFIX}'2020-06-03'${DATE_SUFFIX} as order_date, 'SS-20140' as customer_id, 'Los Angeles' as city, 'Technology' as category, 'Accessories' as sub_category, 'Kingston Digital DataTraveler 16GB USB 2.1' as product_name, 44.75000 as sales, 5 as quantity, 0.00000 as discount, 8.50250 as profit union all
40
+ select 2455 as row_id, 'CA-2017-140949' as order_id, ${DATE_PREFIX}'2020-03-17'${DATE_SUFFIX} as order_date, 'DB-13405' as customer_id, 'New York City' as city, 'Technology' as category, 'Accessories' as sub_category, 'Kingston Digital DataTraveler 16GB USB 2.2' as product_name, 71.60000 as sales, 8 as quantity, 0.00000 as discount, 13.60400 as profit union all
41
+ select 2661 as row_id, 'CA-2017-123372' as order_id, ${DATE_PREFIX}'2020-11-28'${DATE_SUFFIX} as order_date, 'DG-13300' as customer_id, 'Columbus' as city, 'Technology' as category, 'Phones' as sub_category, 'Google Nexus 5' as product_name, 1979.89000 as sales, 11 as quantity, 0.00000 as discount, 494.97250 as profit union all
42
+ select 3083 as row_id, 'US-2017-132297' as order_id, ${DATE_PREFIX}'2020-05-27'${DATE_SUFFIX} as order_date, 'DW-13480' as customer_id, 'Louisville' as city, 'Technology' as category, 'Phones' as sub_category, 'Google Nexus 6' as product_name, 539.97000 as sales, 3 as quantity, 0.00000 as discount, 134.99250 as profit union all
43
+ select 4161 as row_id, 'CA-2017-115546' as order_id, ${DATE_PREFIX}'2020-05-14'${DATE_SUFFIX} as order_date, 'AH-10465' as customer_id, 'New York City' as city, 'Technology' as category, 'Phones' as sub_category, 'Google Nexus 7' as product_name, 539.97000 as sales, 3 as quantity, 0.00000 as discount, 134.99250 as profit union all
44
+ select 8697 as row_id, 'CA-2017-119284' as order_id, ${DATE_PREFIX}'2020-06-15'${DATE_SUFFIX} as order_date, 'TS-21205' as customer_id, 'Columbus' as city, 'Technology' as category, 'Phones' as sub_category, 'HTC One' as product_name, 239.97600 as sales, 3 as quantity, 0.20000 as discount, 26.99730 as profit union all
45
+ select 7698 as row_id, 'CA-2017-151799' as order_id, ${DATE_PREFIX}'2020-12-14'${DATE_SUFFIX} as order_date, 'BF-11170' as customer_id, 'Columbus' as city, 'Technology' as category, 'Copiers' as sub_category, 'Canon PC1080F Personal Copier' as product_name, 1199.98000 as sales, 2 as quantity, 0.00000 as discount, 467.99220 as profit union all
46
+ select 7174 as row_id, 'US-2017-141677' as order_id, ${DATE_PREFIX}'2020-03-26'${DATE_SUFFIX} as order_date, 'HK-14890' as customer_id, 'Houston' as city, 'Technology' as category, 'Copiers' as sub_category, 'Canon PC1080F Personal Copier' as product_name, 2399.96000 as sales, 5 as quantity, 0.20000 as discount, 569.99050 as profit union all
47
+ select 9618 as row_id, 'CA-2017-160633' as order_id, ${DATE_PREFIX}'2020-11-16'${DATE_SUFFIX} as order_date, 'BS-11380' as customer_id, 'Columbus' as city, 'Technology' as category, 'Copiers' as sub_category, 'Hewlett Packard 610 Color Digital Copier / Printer' as product_name, 899.98200 as sales, 3 as quantity, 0.40000 as discount, 74.99850 as profit union all
48
+ select 8958 as row_id, 'CA-2017-105620' as order_id, ${DATE_PREFIX}'2020-12-25'${DATE_SUFFIX} as order_date, 'JH-15430' as customer_id, 'Columbus' as city, 'Technology' as category, 'Machines' as sub_category, 'Lexmark 20R1285 X6650 Wireless All-in-One Printer' as product_name, 120.00000 as sales, 2 as quantity, 0.50000 as discount, -7.20000 as profit union all
49
+ select 8878 as row_id, 'CA-2017-126928' as order_id, ${DATE_PREFIX}'2020-09-17'${DATE_SUFFIX} as order_date, 'GZ-14470' as customer_id, 'Morristown' as city, 'Technology' as category, 'Machines' as sub_category, 'Lexmark 20R1285 X6650 Wireless All-in-One Printer' as product_name, 480.00000 as sales, 4 as quantity, 0.00000 as discount, 225.60000 as profit union all
50
+ select 7293 as row_id, 'CA-2017-109183' as order_id, ${DATE_PREFIX}'2020-12-04'${DATE_SUFFIX} as order_date, 'LR-16915' as customer_id, 'Columbus' as city, 'Technology' as category, 'Machines' as sub_category, 'Okidata C610n Printer' as product_name, 649.00000 as sales, 2 as quantity, 0.50000 as discount, -272.58000 as profit
51
+ `;
52
+ return SELECT_PREFIX + select + SELECT_SUFFIX;
53
+ };
@@ -0,0 +1,19 @@
1
+ import { sql } from './Products.sql';
2
+
3
+ cube(`Products`, {
4
+ sql: sql('_type_'),
5
+ dimensions: {
6
+ category: {
7
+ sql: 'category',
8
+ type: 'string',
9
+ },
10
+ subCategory: {
11
+ sql: 'sub_category',
12
+ type: 'string',
13
+ },
14
+ productName: {
15
+ sql: 'product_name',
16
+ type: 'string',
17
+ },
18
+ },
19
+ });
@@ -0,0 +1,36 @@
1
+ import { DB_CAST } from './CAST';
2
+
3
+ export const sql = (type) => {
4
+ const { SELECT_PREFIX, SELECT_SUFFIX } = DB_CAST[type];
5
+ const select = `
6
+ select 'Furniture' as category, 'Tables' as sub_category, 'Anderson Hickey Conga Table Tops & Accessories' as product_name union all
7
+ select 'Furniture' as category, 'Tables' as sub_category, 'Balt Solid Wood Rectangular Table' as product_name union all
8
+ select 'Furniture' as category, 'Bookcases' as sub_category, 'DMI Eclipse Executive Suite Bookcases' as product_name union all
9
+ select 'Furniture' as category, 'Bookcases' as sub_category, 'Global Adaptabilites Bookcase, Cherry/Storm Gray Finish' as product_name union all
10
+ select 'Furniture' as category, 'Chairs' as sub_category, 'Harbour Creations 67200 Series Stacking Chairs' as product_name union all
11
+ select 'Furniture' as category, 'Chairs' as sub_category, 'Iceberg Nesting Folding Chair, 19w x 6d x 43h' as product_name union all
12
+ select 'Furniture' as category, 'Furnishings' as sub_category, 'Linden 10 Round Wall Clock, Black' as product_name union all
13
+ select 'Furniture' as category, 'Furnishings' as sub_category, 'Magna Visual Magnetic Picture Hangers' as product_name union all
14
+ select 'Office Supplies' as category, 'Art' as sub_category, 'OIC #2 Pencils, Medium Soft' as product_name union all
15
+ select 'Office Supplies' as category, 'Art' as sub_category, 'Panasonic KP-380BK Classic Electric Pencil Sharpener' as product_name union all
16
+ select 'Office Supplies' as category, 'Storage' as sub_category, 'Project Tote Personal File' as product_name union all
17
+ select 'Office Supplies' as category, 'Storage' as sub_category, 'Recycled Eldon Regeneration Jumbo File' as product_name union all
18
+ select 'Office Supplies' as category, 'Envelopes' as sub_category, 'Tyvek Side-Opening Peel & Seel Expanding Envelopes' as product_name union all
19
+ select 'Office Supplies' as category, 'Envelopes' as sub_category, 'Wausau Papers Astrobrights Colored Envelopes' as product_name union all
20
+ select 'Office Supplies' as category, 'Fasteners' as sub_category, 'Vinyl Coated Wire Paper Clips in Organizer Box, 800/Box' as product_name union all
21
+ select 'Office Supplies' as category, 'Fasteners' as sub_category, 'Plymouth Boxed Rubber Bands by Plymouth' as product_name union all
22
+ select 'Technology' as category, 'Accessories' as sub_category, 'Logitech diNovo Edge Keyboard' as product_name union all
23
+ select 'Technology' as category, 'Accessories' as sub_category, 'Kingston Digital DataTraveler 16GB USB 2.0' as product_name union all
24
+ select 'Technology' as category, 'Accessories' as sub_category, 'Kingston Digital DataTraveler 16GB USB 2.1' as product_name union all
25
+ select 'Technology' as category, 'Accessories' as sub_category, 'Kingston Digital DataTraveler 16GB USB 2.2' as product_name union all
26
+ select 'Technology' as category, 'Phones' as sub_category, 'Google Nexus 5' as product_name union all
27
+ select 'Technology' as category, 'Phones' as sub_category, 'Google Nexus 6' as product_name union all
28
+ select 'Technology' as category, 'Phones' as sub_category, 'Google Nexus 7' as product_name union all
29
+ select 'Technology' as category, 'Phones' as sub_category, 'HTC One' as product_name union all
30
+ select 'Technology' as category, 'Copiers' as sub_category, 'Canon PC1080F Personal Copier' as product_name union all
31
+ select 'Technology' as category, 'Copiers' as sub_category, 'Hewlett Packard 610 Color Digital Copier / Printer' as product_name union all
32
+ select 'Technology' as category, 'Machines' as sub_category, 'Lexmark 20R1285 X6650 Wireless All-in-One Printer' as product_name union all
33
+ select 'Technology' as category, 'Machines' as sub_category, 'Okidata C610n Printer' as product_name
34
+ `;
35
+ return SELECT_PREFIX + select + SELECT_SUFFIX;
36
+ };
@@ -20,6 +20,13 @@ services:
20
20
  volumes:
21
21
  - ./postgresql:/cube/conf
22
22
  - ./postgresql/single/cube.js:/cube/conf/cube.js
23
+ - ./postgresql/schema/CAST.js:/cube/conf/schema/CAST.js
24
+ - ./postgresql/schema/Customers.js:/cube/conf/schema/Customers.js
25
+ - ./postgresql/schema/Customers.sql.js:/cube/conf/schema/Customers.sql.js
26
+ - ./postgresql/schema/ECommerce.js:/cube/conf/schema/ECommerce.js
27
+ - ./postgresql/schema/ECommerce.sql.js:/cube/conf/schema/ECommerce.sql.js
28
+ - ./postgresql/schema/Products.js:/cube/conf/schema/Products.js
29
+ - ./postgresql/schema/Products.sql.js:/cube/conf/schema/Products.sql.js
23
30
  ports:
24
31
  - "4000"
25
32
  restart: always
@@ -19,8 +19,15 @@ services:
19
19
  links:
20
20
  - db
21
21
  volumes:
22
- - ./questdb/schema:/cube/conf/schema
23
22
  - ./postgresql/dbt-project:/cube/conf/dbt-project
23
+ - ./questdb/schema:/cube/conf/schema
24
+ - ./postgresql/schema/CAST.js:/cube/conf/schema/CAST.js
25
+ - ./postgresql/schema/Customers.js:/cube/conf/schema/Customers.js
26
+ - ./postgresql/schema/Customers.sql.js:/cube/conf/schema/Customers.sql.js
27
+ - ./postgresql/schema/ECommerce.js:/cube/conf/schema/ECommerce.js
28
+ - ./postgresql/schema/ECommerce.sql.js:/cube/conf/schema/ECommerce.sql.js
29
+ - ./postgresql/schema/Products.js:/cube/conf/schema/Products.js
30
+ - ./postgresql/schema/Products.sql.js:/cube/conf/schema/Products.sql.js
24
31
  ports:
25
32
  - "4000"
26
33
  restart: always
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Required environment variables per datasource.
3
+ */
4
+ export declare const REQ_ENV_VARS: {
5
+ [key: string]: string[];
6
+ };
7
+ //# sourceMappingURL=REQ_ENV_VARS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"REQ_ENV_VARS.d.ts","sourceRoot":"","sources":["../../src/REQ_ENV_VARS.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAmBlD,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REQ_ENV_VARS = void 0;
4
+ /**
5
+ * Required environment variables per datasource.
6
+ */
7
+ exports.REQ_ENV_VARS = {
8
+ athena: [
9
+ 'CUBEJS_AWS_KEY',
10
+ 'CUBEJS_AWS_SECRET',
11
+ 'CUBEJS_AWS_REGION',
12
+ 'CUBEJS_AWS_S3_OUTPUT_LOCATION',
13
+ 'CUBEJS_DB_EXPORT_BUCKET'
14
+ ],
15
+ bigquery: [
16
+ 'CUBEJS_DB_BQ_PROJECT_ID',
17
+ 'CUBEJS_DB_EXPORT_BUCKET',
18
+ 'CUBEJS_DB_BQ_CREDENTIALS',
19
+ ],
20
+ postgres: [
21
+ 'CUBEJS_DB_USER',
22
+ 'CUBEJS_DB_PASS',
23
+ 'CUBEJS_DB_TYPE',
24
+ ],
25
+ questdb: [],
26
+ };
27
+ //# sourceMappingURL=REQ_ENV_VARS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"REQ_ENV_VARS.js","sourceRoot":"","sources":["../../src/REQ_ENV_VARS.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,YAAY,GAA8B;IACrD,MAAM,EAAE;QACN,gBAAgB;QAChB,mBAAmB;QACnB,mBAAmB;QACnB,+BAA+B;QAC/B,yBAAyB;KAC1B;IACD,QAAQ,EAAE;QACR,yBAAyB;QACzB,yBAAyB;QACzB,0BAA0B;KAC3B;IACD,QAAQ,EAAE;QACR,gBAAgB;QAChB,gBAAgB;QAChB,gBAAgB;KACjB;IACD,OAAO,EAAE,EAAE;CACZ,CAAC"}
@@ -1,8 +1,41 @@
1
- export interface BirdBoxTestCaseOptions {
2
- name: string;
3
- loadScript?: string;
1
+ /**
2
+ * Logging options defined in CLI.
3
+ */
4
+ declare enum Log {
5
+ NONE = "ignore",
6
+ PIPE = "pipe"
7
+ }
8
+ /**
9
+ * Birdbox options for container mode.
10
+ */
11
+ export interface ContainerOptions {
12
+ type: string;
4
13
  env?: Record<string, string>;
14
+ log?: Log;
15
+ loadScript?: string;
16
+ }
17
+ /**
18
+ * Birdbox options for local/cli mode.
19
+ */
20
+ export interface LocalOptions extends ContainerOptions {
21
+ cubejsConfig?: string;
22
+ useCubejsServerBinary?: boolean;
5
23
  }
24
+ /**
25
+ * Birdbox environments for cube.js passed for testcase.
26
+ */
27
+ export interface Env {
28
+ CUBEJS_DEV_MODE: string;
29
+ CUBEJS_WEB_SOCKETS: string;
30
+ CUBEJS_EXTERNAL_DEFAULT: string;
31
+ CUBEJS_SCHEDULED_REFRESH_DEFAULT: string;
32
+ CUBEJS_REFRESH_WORKER: string;
33
+ CUBEJS_ROLLUP_ONLY: string;
34
+ [key: string]: string;
35
+ }
36
+ /**
37
+ * Birdbox object interface.
38
+ */
6
39
  export interface BirdBox {
7
40
  stop: () => Promise<void>;
8
41
  configuration: {
@@ -12,13 +45,17 @@ export interface BirdBox {
12
45
  env?: Record<string, string>;
13
46
  };
14
47
  }
15
- export declare function startBirdBoxFromContainer(options: BirdBoxTestCaseOptions): Promise<BirdBox>;
16
- export interface StartCliWithEnvOptions {
17
- dbType: string;
18
- useCubejsServerBinary?: boolean;
19
- loadScript?: string;
20
- cubejsConfig?: string;
21
- env?: Record<string, string>;
22
- }
23
- export declare function startBirdBoxFromCli(options: StartCliWithEnvOptions): Promise<BirdBox>;
48
+ /**
49
+ * Returns Birdbox with container mode.
50
+ */
51
+ export declare function startBirdBoxFromContainer(options: ContainerOptions): Promise<BirdBox>;
52
+ /**
53
+ * Returns Birdbox in cli/local mode.
54
+ */
55
+ export declare function startBirdBoxFromCli(options: LocalOptions): Promise<BirdBox>;
56
+ /**
57
+ * Returns birdbox.
58
+ */
59
+ export declare function getBirdbox(type: string, env: Env): Promise<BirdBox>;
60
+ export {};
24
61
  //# sourceMappingURL=birdbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"birdbox.d.ts","sourceRoot":"","sources":["../../src/birdbox.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,aAAa,EAAE;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,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AkB,EAAE,MAAM,CAAC;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAwED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,aAAa,EAAE;QACb,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,OAAO,CAAC,CAmKlB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,OAAO,CAAC,CAqKlB;AAED;;GAEG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,GAAG,oBAgGT"}
@@ -3,15 +3,83 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.startBirdBoxFromCli = exports.startBirdBoxFromContainer = void 0;
6
+ exports.getBirdbox = exports.startBirdBoxFromCli = exports.startBirdBoxFromContainer = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- const fs_1 = __importDefault(require("fs"));
8
+ const fs_extra_1 = __importDefault(require("fs-extra"));
9
+ const yargs_1 = __importDefault(require("yargs/yargs"));
9
10
  const child_process_1 = require("child_process");
10
11
  const http_proxy_1 = __importDefault(require("http-proxy"));
11
12
  const testcontainers_1 = require("testcontainers");
12
13
  const shared_1 = require("@cubejs-backend/shared");
13
14
  const testing_shared_1 = require("@cubejs-backend/testing-shared");
14
- const fs_extra_1 = __importDefault(require("fs-extra"));
15
+ const REQ_ENV_VARS_1 = require("./REQ_ENV_VARS");
16
+ /**
17
+ * Logging options defined in CLI.
18
+ */
19
+ var Log;
20
+ (function (Log) {
21
+ Log["NONE"] = "ignore";
22
+ Log["PIPE"] = "pipe";
23
+ })(Log || (Log = {}));
24
+ /**
25
+ * Birdbox modes defined in CLI.
26
+ */
27
+ var Mode;
28
+ (function (Mode) {
29
+ Mode["CLI"] = "cli";
30
+ Mode["LOC"] = "local";
31
+ Mode["DOCKER"] = "docker";
32
+ })(Mode || (Mode = {}));
33
+ /**
34
+ * List of permanent test data files.
35
+ */
36
+ const files = [
37
+ 'CAST.js',
38
+ 'Customers.sql.js',
39
+ 'ECommerce.sql.js',
40
+ 'Products.sql.js',
41
+ ];
42
+ /**
43
+ * List of test schemas needs to be patched for certain datasource.
44
+ */
45
+ const schemas = [
46
+ 'Customers.js',
47
+ 'ECommerce.js',
48
+ 'Products.js',
49
+ ];
50
+ /**
51
+ * Test data files source folder.
52
+ */
53
+ const source = path_1.default.join(process.cwd(), 'birdbox-fixtures', 'driver-test-data');
54
+ /**
55
+ * Test data files target source.
56
+ */
57
+ const target = path_1.default.join(process.cwd(), 'birdbox-fixtures', 'postgresql', 'schema');
58
+ /**
59
+ * Remove test data files from target directory.
60
+ */
61
+ function clearTestData() {
62
+ files.concat(schemas).forEach((name) => {
63
+ if (fs_extra_1.default.existsSync(path_1.default.join(target, name))) {
64
+ fs_extra_1.default.removeSync(path_1.default.join(target, name));
65
+ }
66
+ });
67
+ }
68
+ /**
69
+ * Prepare and copy test data files.
70
+ */
71
+ function prepareTestData(type) {
72
+ clearTestData();
73
+ files.forEach((name) => {
74
+ fs_extra_1.default.copySync(path_1.default.join(source, name), path_1.default.join(target, name));
75
+ });
76
+ schemas.forEach((name) => {
77
+ fs_extra_1.default.writeFileSync(path_1.default.join(target, name), fs_extra_1.default.readFileSync(path_1.default.join(source, name), 'utf8').replace('_type_', type));
78
+ });
79
+ }
80
+ /**
81
+ * Returns Birdbox with container mode.
82
+ */
15
83
  async function startBirdBoxFromContainer(options) {
16
84
  var _a;
17
85
  if (process.env.TEST_CUBE_HOST) {
@@ -19,7 +87,7 @@ async function startBirdBoxFromContainer(options) {
19
87
  const port = process.env.TEST_CUBE_PORT || '8888';
20
88
  return {
21
89
  stop: async () => {
22
- console.log('[Birdbox] Closed');
90
+ process.stdout.write('[Birdbox] Closed\n');
23
91
  },
24
92
  configuration: {
25
93
  playgroundUrl: `http://${host}:${port}`,
@@ -41,14 +109,16 @@ async function startBirdBoxFromContainer(options) {
41
109
  if (process.env.BIRDBOX_CUBESTORE_VERSION === undefined) {
42
110
  process.env.BIRDBOX_CUBESTORE_VERSION = 'latest';
43
111
  }
44
- const composeFile = `${options.name}.yml`;
112
+ const composeFile = `${options.type}.yml`;
45
113
  let dc = new testcontainers_1.DockerComposeEnvironment(path_1.default.resolve(path_1.default.dirname(__filename), '../../birdbox-fixtures/'), composeFile);
46
114
  if (options.env) {
47
115
  for (const k of Object.keys(options.env)) {
48
116
  dc = dc.withEnv(k, options.env[k]);
49
117
  }
50
118
  }
51
- console.log(`[Birdbox] Using ${composeFile} compose file`);
119
+ if (options.log === Log.PIPE) {
120
+ process.stdout.write(`[Birdbox] Using ${composeFile} compose file\n`);
121
+ }
52
122
  const env = await dc
53
123
  .withStartupTimeout(30 * 1000)
54
124
  .withEnv('BIRDBOX_CUBEJS_VERSION', process.env.BIRDBOX_CUBEJS_VERSION)
@@ -59,11 +129,17 @@ async function startBirdBoxFromContainer(options) {
59
129
  const playgroundPort = (_a = process.env.TEST_PLAYGROUND_PORT) !== null && _a !== void 0 ? _a : port;
60
130
  let proxyServer = null;
61
131
  if (process.env.TEST_PLAYGROUND_PORT) {
62
- console.log(`[Birdbox] Creating a proxy server 4000->${port} for local testing`);
132
+ if (options.log === Log.PIPE) {
133
+ process.stdout.write(`[Birdbox] Creating a proxy server 4000->${port} for local testing\n`);
134
+ }
63
135
  // As local Playground proxies requests to the 4000 port
64
- proxyServer = http_proxy_1.default.createProxyServer({ target: `http://localhost:${port}` }).listen(4000);
136
+ proxyServer = http_proxy_1.default.createProxyServer({
137
+ target: `http://localhost:${port}`
138
+ }).listen(4000);
65
139
  proxyServer.on('error', async (err, req, res) => {
66
- console.log('[Proxy Server] error:', err);
140
+ if (options.log === Log.PIPE) {
141
+ process.stderr.write(`[Proxy Server] error: ${err}\n`);
142
+ }
67
143
  if (!res.headersSent) {
68
144
  res.writeHead(500, { 'content-type': 'application/json' });
69
145
  }
@@ -72,38 +148,57 @@ async function startBirdBoxFromContainer(options) {
72
148
  }
73
149
  if (options.loadScript) {
74
150
  const { loadScript } = options;
75
- console.log(`[Birdbox] Executing ${loadScript} script`);
76
- const { output, exitCode } = await env.getContainer('birdbox-db').exec([`/scripts/${loadScript}`]);
151
+ if (options.log === Log.PIPE) {
152
+ process.stdout.write(`[Birdbox] Executing ${loadScript} script\n`);
153
+ }
154
+ const { output, exitCode, } = await env
155
+ .getContainer('birdbox-db')
156
+ .exec([`/scripts/${loadScript}`]);
77
157
  if (exitCode === 0) {
78
- console.log(`[Birdbox] Script ${loadScript} finished successfully`);
158
+ if (options.log === Log.PIPE) {
159
+ process.stdout.write(`[Birdbox] Script ${loadScript} finished successfully\n`);
160
+ }
79
161
  }
80
162
  else {
81
- console.log(output);
82
- console.log(`[Birdbox] Script ${loadScript} finished with error: ${exitCode}`);
163
+ if (options.log === Log.PIPE) {
164
+ process.stdout.write(`${output}\n`);
165
+ process.stderr.write(`[Birdbox] Script ${loadScript} finished with error: ${exitCode}\n`);
166
+ }
83
167
  await env.down();
84
168
  process.exit(1);
85
169
  }
86
170
  }
87
171
  return {
88
172
  stop: async () => {
89
- console.log('[Birdbox] Closing');
173
+ clearTestData();
174
+ if (options.log === Log.PIPE) {
175
+ process.stdout.write('[Birdbox] Closing\n');
176
+ }
90
177
  await env.down();
91
178
  proxyServer === null || proxyServer === void 0 ? void 0 : proxyServer.close();
92
- console.log('[Birdbox] Closed');
179
+ if (options.log === Log.PIPE) {
180
+ process.stdout.write('[Birdbox] Closed\n');
181
+ }
93
182
  },
94
183
  configuration: {
95
184
  playgroundUrl: `http://${host}:${playgroundPort}`,
96
185
  apiUrl: `http://${host}:${port}/cubejs-api/v1`,
97
186
  wsUrl: `ws://${host}:${port}`,
98
187
  env: {
99
- ...(process.env.TEST_PLAYGROUND_PORT ? { CUBEJS_DB_HOST: testing_shared_1.getLocalHostnameByOs() } : null),
188
+ ...(process.env.TEST_PLAYGROUND_PORT
189
+ ? { CUBEJS_DB_HOST: testing_shared_1.getLocalHostnameByOs() }
190
+ : null),
100
191
  },
101
192
  },
102
193
  };
103
194
  }
104
195
  exports.startBirdBoxFromContainer = startBirdBoxFromContainer;
196
+ /**
197
+ * Returns Birdbox in cli/local mode.
198
+ */
105
199
  async function startBirdBoxFromCli(options) {
106
200
  let db;
201
+ let cli;
107
202
  if (options.loadScript) {
108
203
  db = await testing_shared_1.PostgresDBRunner.startContainer({
109
204
  volumes: [
@@ -119,75 +214,101 @@ async function startBirdBoxFromCli(options) {
119
214
  },
120
215
  ],
121
216
  });
122
- console.log('[Birdbox] Executing load script');
217
+ if (options.log === Log.PIPE) {
218
+ process.stdout.write('[Birdbox] Executing load script\n');
219
+ }
123
220
  const loadScript = `/scripts/${options.loadScript}`;
124
221
  const { output, exitCode } = await db.exec([loadScript]);
125
- if (exitCode === 0) {
126
- console.log(`[Birdbox] Script ${loadScript} finished successfully`);
222
+ if (exitCode === 0 && options.log === Log.PIPE) {
223
+ process.stdout.write(`[Birdbox] Script ${loadScript} finished successfully\n`);
127
224
  }
128
225
  else {
129
- console.log(output);
130
- console.log(`[Birdbox] Script ${loadScript} finished with error: ${exitCode}`);
226
+ if (options.log === Log.PIPE) {
227
+ process.stdout.write(`${output}\n`);
228
+ process.stdout.write(`[Birdbox] Script ${loadScript} finished with error: ${exitCode}\n`);
229
+ }
131
230
  await db.stop();
132
231
  process.exit(1);
133
232
  }
134
233
  }
135
234
  const testDir = path_1.default.join(process.cwd(), 'birdbox-test-project');
136
235
  // Do not remove whole dir as it contains node_modules
137
- if (fs_1.default.existsSync(path_1.default.join(testDir, '.env'))) {
138
- fs_1.default.unlinkSync(path_1.default.join(testDir, '.env'));
236
+ if (fs_extra_1.default.existsSync(path_1.default.join(testDir, '.env'))) {
237
+ fs_extra_1.default.unlinkSync(path_1.default.join(testDir, '.env'));
139
238
  }
140
- if (fs_1.default.existsSync(path_1.default.join(testDir, '.cubestore'))) {
239
+ if (fs_extra_1.default.existsSync(path_1.default.join(testDir, '.cubestore'))) {
141
240
  fs_extra_1.default.removeSync(path_1.default.join(testDir, '.cubestore'));
142
241
  }
143
242
  fs_extra_1.default.copySync(path_1.default.join(process.cwd(), 'birdbox-fixtures', 'postgresql'), path_1.default.join(testDir));
144
243
  if (options.cubejsConfig) {
145
244
  fs_extra_1.default.copySync(path_1.default.join(process.cwd(), 'birdbox-fixtures', 'postgresql', options.cubejsConfig), path_1.default.join(testDir, 'cube.js'));
146
245
  }
147
- const cli = child_process_1.spawn(options.useCubejsServerBinary ? path_1.default.resolve(process.cwd(), '../cubejs-server/bin/server') : 'npm', options.useCubejsServerBinary ? [] : ['run', 'dev'], {
148
- cwd: testDir,
149
- shell: true,
150
- // Show output of Cube.js process in console
151
- stdio: ['pipe', 'pipe', 'pipe'],
152
- env: {
153
- ...process.env,
154
- CUBEJS_DB_TYPE: options.dbType === 'postgresql' ? 'postgres' : options.dbType,
155
- CUBEJS_DEV_MODE: 'true',
156
- CUBEJS_API_SECRET: 'mysupersecret',
157
- CUBEJS_WEB_SOCKETS: 'true',
158
- CUBEJS_PLAYGROUND_AUTH_SECRET: 'mysupersecret',
159
- ...options.env
160
- ? options.env
161
- : {
162
- CUBEJS_DB_HOST: db.getHost(),
163
- CUBEJS_DB_PORT: `${db.getMappedPort(5432)}`,
164
- CUBEJS_DB_NAME: 'test',
165
- CUBEJS_DB_USER: 'test',
166
- CUBEJS_DB_PASS: 'test',
167
- }
168
- },
169
- });
170
- cli.stdout.on('data', (msg) => {
171
- console.log(msg.toString());
172
- });
173
- cli.stderr.on('data', (msg) => {
174
- console.log(msg.toString());
175
- });
176
- // cli.on('exit', (code) => {
177
- // throw new Error(
178
- // `Cube.js exited with ${code}`
179
- // );
180
- // });
181
- await shared_1.pausePromise(10 * 1000);
246
+ try {
247
+ cli = child_process_1.spawn(options.useCubejsServerBinary
248
+ ? path_1.default.resolve(process.cwd(), '../cubejs-server/bin/server')
249
+ : 'npm', options.useCubejsServerBinary
250
+ ? []
251
+ : ['run', 'dev'], {
252
+ cwd: testDir,
253
+ shell: true,
254
+ detached: true,
255
+ stdio: [
256
+ options.log,
257
+ options.log,
258
+ options.log,
259
+ ],
260
+ env: {
261
+ ...process.env,
262
+ CUBEJS_DB_TYPE: options.type === 'postgresql'
263
+ ? 'postgres'
264
+ : options.type,
265
+ CUBEJS_DEV_MODE: 'true',
266
+ CUBEJS_API_SECRET: 'mysupersecret',
267
+ CUBEJS_WEB_SOCKETS: 'true',
268
+ CUBEJS_PLAYGROUND_AUTH_SECRET: 'mysupersecret',
269
+ ...options.env
270
+ ? options.env
271
+ : {
272
+ CUBEJS_DB_HOST: db.getHost(),
273
+ CUBEJS_DB_PORT: `${db.getMappedPort(5432)}`,
274
+ CUBEJS_DB_NAME: 'test',
275
+ CUBEJS_DB_USER: 'test',
276
+ CUBEJS_DB_PASS: 'test',
277
+ }
278
+ },
279
+ });
280
+ if (cli.stdout) {
281
+ cli.stdout.on('data', (msg) => {
282
+ process.stdout.write(msg);
283
+ });
284
+ }
285
+ if (cli.stderr) {
286
+ cli.stderr.on('data', (msg) => {
287
+ process.stdout.write(msg);
288
+ });
289
+ }
290
+ await shared_1.pausePromise(10 * 1000);
291
+ }
292
+ catch (e) {
293
+ // @ts-ignore
294
+ db.stop();
295
+ }
182
296
  return {
183
297
  stop: async () => {
184
- console.log('[Birdbox] Closing');
298
+ clearTestData();
299
+ if (options.log === Log.PIPE) {
300
+ process.stdout.write('[Birdbox] Closing\n');
301
+ }
185
302
  if (db) {
186
303
  await db.stop();
187
304
  }
188
- console.log('[Birdbox] Done with DB');
189
- cli.kill();
190
- console.log('[Birdbox] Closed');
305
+ if (options.log === Log.PIPE) {
306
+ process.stdout.write('[Birdbox] Done with DB\n');
307
+ }
308
+ process.kill(-cli.pid, 'SIGINT');
309
+ if (options.log === Log.PIPE) {
310
+ process.stdout.write('[Birdbox] Closed\n');
311
+ }
191
312
  },
192
313
  configuration: {
193
314
  playgroundUrl: 'http://127.0.0.1:4000',
@@ -197,4 +318,96 @@ async function startBirdBoxFromCli(options) {
197
318
  };
198
319
  }
199
320
  exports.startBirdBoxFromCli = startBirdBoxFromCli;
321
+ /**
322
+ * Returns birdbox.
323
+ */
324
+ async function getBirdbox(type, env) {
325
+ // extract mode
326
+ const args = yargs_1.default(process.argv.slice(2))
327
+ .exitProcess(false)
328
+ .options({
329
+ mode: {
330
+ describe: 'Determines Birdbox mode.',
331
+ choices: [
332
+ Mode.CLI,
333
+ Mode.LOC,
334
+ Mode.DOCKER,
335
+ ],
336
+ default: Mode.LOC,
337
+ },
338
+ log: {
339
+ describe: 'Determines Birdbox logging.',
340
+ choices: [
341
+ Log.NONE,
342
+ Log.PIPE,
343
+ ],
344
+ default: Log.PIPE,
345
+ }
346
+ })
347
+ .argv;
348
+ const { mode, log } = args;
349
+ // extract/assert env variables
350
+ if (REQ_ENV_VARS_1.REQ_ENV_VARS[type] === undefined) {
351
+ if (log === Log.PIPE) {
352
+ process.stderr.write(`List of required environment variables is missing for ${type}\n`);
353
+ }
354
+ process.exit(1);
355
+ }
356
+ else {
357
+ REQ_ENV_VARS_1.REQ_ENV_VARS[type].forEach((key) => {
358
+ if (process.env[key] === undefined) {
359
+ if (log === Log.PIPE) {
360
+ process.stderr.write(`${key} is required environment variable for ${type}\n`);
361
+ }
362
+ process.exit(1);
363
+ }
364
+ else {
365
+ // @ts-ignore
366
+ env[key] = process.env[key];
367
+ }
368
+ });
369
+ }
370
+ // prepare test data
371
+ prepareTestData(type);
372
+ // birdbox instantiation
373
+ let birdbox;
374
+ try {
375
+ switch (mode) {
376
+ case Mode.CLI:
377
+ case Mode.LOC: {
378
+ birdbox = await startBirdBoxFromCli({
379
+ type,
380
+ env,
381
+ log,
382
+ cubejsConfig: 'single/cube.js',
383
+ useCubejsServerBinary: mode === Mode.LOC,
384
+ });
385
+ break;
386
+ }
387
+ case Mode.DOCKER: {
388
+ birdbox = await startBirdBoxFromContainer({
389
+ type: type === 'postgres' ? 'postgresql' : type,
390
+ log,
391
+ env
392
+ });
393
+ break;
394
+ }
395
+ default: {
396
+ if (log === Log.PIPE) {
397
+ process.stderr.write(`Unsupported Birdbox mode: ${mode}\n`);
398
+ }
399
+ process.exit(1);
400
+ }
401
+ }
402
+ }
403
+ catch (e) {
404
+ if (log === Log.PIPE) {
405
+ process.stderr.write(e);
406
+ }
407
+ clearTestData();
408
+ process.exit(1);
409
+ }
410
+ return birdbox;
411
+ }
412
+ exports.getBirdbox = getBirdbox;
200
413
  //# sourceMappingURL=birdbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"birdbox.js","sourceRoot":"","sources":["../../src/birdbox.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,iDAAsC;AACtC,4DAAmC;AACnC,mDAAgF;AAChF,mDAAiE;AACjE,mEAAwF;AACxF,wDAA+B;AAkBxB,KAAK,UAAU,yBAAyB,CAAC,OAA+B;;IAC7E,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,WAAW,CAAC;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,MAAM,CAAC;QAElD,OAAO;YACL,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAClC,CAAC;YACD,aAAa,EAAE;gBACb,aAAa,EAAE,UAAU,IAAI,IAAI,IAAI,EAAE;gBACvC,MAAM,EAAE,UAAU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,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,6BAA6B,IAAI,IAAI,CACtC,CAAC;iBACH;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;SACF;KACF;IAAC,OAAO,CAAC,EAAE;QACV,IAAI,GAAG,KAAK,GAAG,CAAC,IAAI,EAAE;YACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAW,CAAC,CAAC;SACnC;QACD,aAAa,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAlGD,gCAkGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubejs-backend/testing",
3
- "version": "0.29.43",
3
+ "version": "0.29.48",
4
4
  "description": "Cube.js e2e tests",
5
5
  "author": "Cube Dev, Inc.",
6
6
  "license": "Apache-2.0",
@@ -28,18 +28,28 @@
28
28
  "birdbox:postgresql-cubestore:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-postgresql-cubestore.test.js",
29
29
  "birdbox:questdb": "jest --verbose -i dist/test/birdbox-questdb.test.js",
30
30
  "birdbox:questdb:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-questdb.test.js",
31
- "birdbox:cli:postgresql": "jest --forceExit --verbose -i dist/test/cli-postgresql.test.js",
32
- "birdbox:cli:postgresql:snapshot": "jest --forceExit --verbose --updateSnapshot -i dist/test/cli-postgresql.test.js",
33
- "birdbox:local:postgresql": "USE_LOCAL_CUBEJS_BINARY=true jest --forceExit --verbose -i dist/test/cli-postgresql.test.js",
34
- "birdbox:local:postgresql:snapshot": "USE_LOCAL_CUBEJS_BINARY=true jest --forceExit --verbose --updateSnapshot -i dist/test/cli-postgresql.test.js",
35
- "birdbox:local:postgresql-pre-aggregations": "jest --forceExit --verbose -i dist/test/cli-postgresql-pre-aggregations.test.js",
36
- "birdbox:local:postgresql-pre-aggregations:snapshot": "jest --forceExit --verbose --updateSnapshot -i dist/test/cli-postgresql-pre-aggregations.test.js",
31
+ "birdbox:cli:postgresql": "jest --verbose -i dist/test/cli-postgresql.test.js",
32
+ "birdbox:cli:postgresql:snapshot": "jest --verbose --updateSnapshot -i dist/test/cli-postgresql.test.js",
33
+ "birdbox:local:postgresql": "USE_LOCAL_CUBEJS_BINARY=true jest --verbose -i dist/test/cli-postgresql.test.js",
34
+ "birdbox:local:postgresql:snapshot": "USE_LOCAL_CUBEJS_BINARY=true jest --verbose --updateSnapshot -i dist/test/cli-postgresql.test.js",
35
+ "birdbox:local:postgresql-pre-aggregations": "USE_LOCAL_CUBEJS_BINARY=true jest --verbose -i dist/test/cli-postgresql-pre-aggregations.test.js",
36
+ "birdbox:local:postgresql-pre-aggregations:snapshot": "USE_LOCAL_CUBEJS_BINARY=true jest --verbose --updateSnapshot -i dist/test/cli-postgresql-pre-aggregations.test.js",
37
+ "cypress:install": "cypress install",
38
+ "cypress:birdbox": "node dist/test/bin/cypress-birdbox.js",
39
+ "birdbox:postgre": "jest --verbose -i dist/test/birdbox-postgre.test.js",
40
+ "birdbox:postgre:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-postgre.test.js",
37
41
  "birdbox:athena": "jest --verbose -i dist/test/birdbox-athena.test.js",
38
42
  "birdbox:athena:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-athena.test.js",
39
43
  "birdbox:bigquery": "jest --verbose -i dist/test/birdbox-bigquery.test.js",
40
44
  "birdbox:bigquery:snapshot": "jest --verbose --updateSnapshot -i dist/test/birdbox-bigquery.test.js",
41
- "cypress:install": "cypress install",
42
- "cypress:birdbox": "node dist/test/bin/cypress-birdbox.js"
45
+ "driver:athena": "jest --verbose -i dist/test/driver-athena.test.js",
46
+ "driver:athena:snap": "jest --verbose --updateSnapshot -i dist/test/driver-athena.test.js",
47
+ "driver:bigquery": "jest --verbose -i dist/test/driver-bigquery.test.js",
48
+ "driver:bigquery:snap": "jest --verbose --updateSnapshot -i dist/test/driver-bigquery.test.js",
49
+ "driver:postgres": "jest --verbose -i dist/test/driver-postgres.test.js",
50
+ "driver:postgres:snap": "jest --verbose --updateSnapshot -i dist/test/driver-postgres.test.js",
51
+ "driver:questdb": "jest --verbose -i dist/test/driver-questdb.test.js",
52
+ "driver:questdb:snap": "jest --verbose --updateSnapshot -i dist/test/driver-questdb.test.js"
43
53
  },
44
54
  "files": [
45
55
  "dist/src",
@@ -47,11 +57,11 @@
47
57
  ],
48
58
  "dependencies": {
49
59
  "@cubejs-backend/dotenv": "^9.0.2",
50
- "@cubejs-backend/query-orchestrator": "^0.29.37",
51
- "@cubejs-backend/schema-compiler": "^0.29.42",
52
- "@cubejs-backend/shared": "^0.29.37",
53
- "@cubejs-backend/testing-shared": "^0.29.42",
54
- "@cubejs-client/ws-transport": "^0.29.43",
60
+ "@cubejs-backend/query-orchestrator": "^0.29.48",
61
+ "@cubejs-backend/schema-compiler": "^0.29.48",
62
+ "@cubejs-backend/shared": "^0.29.48",
63
+ "@cubejs-backend/testing-shared": "^0.29.48",
64
+ "@cubejs-client/ws-transport": "^0.29.48",
55
65
  "dedent": "^0.7.0",
56
66
  "fs-extra": "^8.1.0",
57
67
  "http-proxy": "^1.18.1",
@@ -63,7 +73,7 @@
63
73
  "devDependencies": {
64
74
  "@4tw/cypress-drag-drop": "^1.6.0",
65
75
  "@cubejs-backend/linter": "^0.29.23",
66
- "@cubejs-client/core": "^0.29.43",
76
+ "@cubejs-client/core": "^0.29.48",
67
77
  "@jest/globals": "^26.6.2",
68
78
  "@types/dedent": "^0.7.0",
69
79
  "@types/http-proxy": "^1.17.5",
@@ -85,7 +95,7 @@
85
95
  ],
86
96
  "testEnvironment": "node",
87
97
  "testMatch": [
88
- "<rootDir>/dist/test/*.(test|spec).(ts|js)"
98
+ "<rootDir>/dist/test/**/*.(test|spec).(ts|js)"
89
99
  ],
90
100
  "snapshotResolver": "<rootDir>/test/snapshotResolver.js"
91
101
  },
@@ -95,5 +105,5 @@
95
105
  "eslintConfig": {
96
106
  "extends": "../cubejs-linter"
97
107
  },
98
- "gitHead": "4fde50fecf7e642e73d363a9cdd9126a3533fa43"
108
+ "gitHead": "1fa9b5fe1c15ae2e790c101381d127d691c944ac"
99
109
  }