-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathts-tests.sh
More file actions
executable file
·53 lines (44 loc) · 1.6 KB
/
ts-tests.sh
File metadata and controls
executable file
·53 lines (44 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
cd ts-tests ## Go to typescript tests folder
echo "Installing dependencies for TypeScript declarations testing..."
npm install ## Install dependencies
echo "Dependencies installed, linking the package."
npm link @splitsoftware/splitio-browserjs ## Link to the cloned code
echo "Running tsc compiler."
../node_modules/.bin/tsc ## Run typescript compiler. No need for flags as we have a tsconfig.json file
if [ $? -eq 0 ]
then
echo "✅ Successfully compiled TS tests."
npm run test-cjs-and-umd
if [ $? -ne 0 ]
then
echo "☠️ Error testing modules in CJS and UMD builds."
npm unlink @splitsoftware/splitio-browserjs
exit 1
fi
npm run test-esm
if [ $? -ne 0 ]
then
echo "☠️ Error testing modules in ESM build."
npm unlink @splitsoftware/splitio-browserjs
exit 1
fi
SIZE_FULL_BUNDLE=$(wc -c ./bundleESM.js | awk '{print $1}')
SIZE_SLIM_WITH_LOCALHOST_BUNDLE=$(wc -c ./bundleESM_TreeShaking.js | awk '{print $1}')
echo "Minified file with all modules shouldn't be larger than 120KB. Current size: $SIZE_FULL_BUNDLE"
if [[ $SIZE_FULL_BUNDLE > 120000 ]] ;then
npm unlink @splitsoftware/splitio-browserjs
exit 1
fi
echo "Minified file with tree-shaking shouldn't be larger than 90KB. Current size: $SIZE_SLIM_WITH_LOCALHOST_BUNDLE"
if [[ $SIZE_SLIM_WITH_LOCALHOST_BUNDLE > 90000 ]] ;then
npm unlink @splitsoftware/splitio-browserjs
exit 1
fi
echo "✅ Successfully run modules tests."
npm unlink @splitsoftware/splitio-browserjs
exit 0
fi
echo "☠️ Error compiling TS tests."
npm unlink @splitsoftware/splitio-browserjs
exit 1