Commit 75afedc 1 parent c6629c3 commit 75afedc Copy full SHA for 75afedc
File tree 4 files changed +65
-1
lines changed
4 files changed +65
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ const config: JestConfigWithTsJest = {
17
17
'<rootDir>/deno/' ,
18
18
'<rootDir>/deno_tests/' ,
19
19
] ,
20
+ testPathIgnorePatterns : [ 'scripts' ] ,
20
21
} ;
21
22
22
23
export default config ;
Original file line number Diff line number Diff line change 14
14
],
15
15
"private" : false ,
16
16
"scripts" : {
17
- "test" : " bin/check- test-server && yarn jest " ,
17
+ "test" : " ./scripts/ test" ,
18
18
"build" : " bash ./build" ,
19
19
"prepack" : " echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1" ,
20
20
"prepublishOnly" : " echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1" ,
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ if [ -z " $1 " ]; then
4
+ URL=" $1 "
5
+ shift
6
+ else
7
+ URL=" $( grep ' openapi_spec_url' .stats.yml | cut -d' ' -f2) "
8
+ fi
9
+
10
+ # Check if the URL is empty
11
+ if [ -z " $URL " ]; then
12
+ echo " Error: No OpenAPI spec path/url provided or found in .stats.yml"
13
+ exit 1
14
+ fi
15
+
16
+ # Run prism mock on the given spec
17
+ if [ " $1 " == " --daemon" ]; then
18
+ npm exec prism mock " $URL " & > .prism.log &
19
+
20
+ # Wait for server to come online
21
+ while ! grep -q " ✖ fatal\|Prism is listening" " .prism.log" ; do
22
+ echo -n " ."
23
+ sleep 0.1
24
+ done
25
+
26
+ if grep -q " ✖ fatal" " .prism.log" ; then
27
+ cat .prism.log
28
+ exit 1
29
+ fi
30
+
31
+ echo
32
+ else
33
+ npm exec prism mock " $URL "
34
+ fi
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ function prism_is_running() {
4
+ curl --silent " http://localhost:4010" > /dev/null 2>&1
5
+ }
6
+
7
+ kill_server_on_port () {
8
+ pids=$( lsof -t -i tcp:" $1 " || echo " " )
9
+ if [ " $pids " != " " ]; then
10
+ kill " $pids "
11
+ echo " Stopped $pids ."
12
+ fi
13
+ }
14
+
15
+ if ! prism_is_running; then
16
+ # When we exit this script, make sure to kill the background mock server process
17
+ trap ' kill_server_on_port 4010' EXIT
18
+
19
+ # Start the dev server
20
+ ./scripts/mock --daemon
21
+
22
+ # Sanity check and print a nice error message
23
+ if ! ./bin/check-test-server; then
24
+ exit
25
+ fi
26
+ fi
27
+
28
+ # Run tests
29
+ ./node_modules/.bin/jest
You can’t perform that action at this time.
0 commit comments