File tree Expand file tree Collapse file tree 7 files changed +16
-29
lines changed
Expand file tree Collapse file tree 7 files changed +16
-29
lines changed Original file line number Diff line number Diff line change 2424 - name : Run tests
2525 env :
2626 SERPAPI_TEST_KEY : ${{ secrets.SERPAPI_TEST_KEY }}
27- run : deno task test:ci
27+ run : deno task test
2828
2929 - name : Setup Node
3030 uses : actions/setup-node@v4
Original file line number Diff line number Diff line change 2828 - name : Run tests
2929 env :
3030 SERPAPI_TEST_KEY : ${{ secrets.SERPAPI_TEST_KEY }}
31- run : deno task test:ci
31+ run : deno task test
3232
3333 - name : Setup Node
3434 uses : actions/setup-node@v4
Original file line number Diff line number Diff line change @@ -66,8 +66,7 @@ and you're good to go.
6666
6767### Tests that require an API key
6868
69- - When testing functionality that hits either ` localhost ` or
70- ` https://serpapi.com ` , and requires an API key, you need to ensure your API
69+ - When testing functionality that requires an API key, you need to ensure your API
7170 key is specified as an environment variable.
7271- Create a ` .env ` file with the following contents, replacing ` YOUR_API_KEY `
7372 with your API key for the appropriate environment.
@@ -91,10 +90,9 @@ it("getJson with api key from config", {
9190## Run tests
9291
9392``` bash
94- deno task test # Run tests that hit "localhost"
95- deno task test:watch # Run tests that hit "localhost" and in watch mode: https://deno.land/manual/getting_started/command_line_interface#watch-mode
96- deno task test:cov # Get test coverage by running tests that hit "localhost"
97- deno task test:ci # Run tests that hit "https://serpapi.com"
93+ deno task test # Run tests
94+ deno task test:watch # Run tests and in watch mode: https://deno.land/manual/getting_started/command_line_interface#watch-mode
95+ deno task test:cov # Get test coverage by running tests
9896```
9997
10098## Run examples on local source files
Original file line number Diff line number Diff line change 11{
22 "tasks" : {
33 "docs:gen" : " npx documentation readme src/serpapi.ts --section=Functions --shallow && deno fmt" ,
4- "test" : " ENV_TYPE=local deno test tests/ --allow-env --allow-read --allow-net --fail-fast " ,
4+ "test" : " deno test tests/ --allow-env --allow-read --allow-net" ,
55 "test:watch" : " deno task test --watch" ,
66 "test:cov" : " rm -rf cov_profile && deno task test --coverage=cov_profile && deno coverage cov_profile" ,
7- "test:ci" : " deno test tests/ --allow-env --allow-read --allow-net" ,
87 "npm" : " deno run -A scripts/build_npm.ts"
98 },
109 "fmt" : {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export const _internals = {
1818 getHostnameAndPort : getHostnameAndPort ,
1919} ;
2020
21- /** Facilitates stubbing in tests, e.g. localhost as the base url */
21+ /** Facilitates stubbing in tests */
2222function getHostnameAndPort ( ) {
2323 return {
2424 hostname : "serpapi.com" ,
Original file line number Diff line number Diff line change @@ -40,15 +40,10 @@ import {
4040loadSync ( { export : true } ) ;
4141const SERPAPI_TEST_KEY = Deno . env . get ( "SERPAPI_TEST_KEY" ) ?? "" ;
4242const HAS_API_KEY = SERPAPI_TEST_KEY . length > 0 ;
43- const BASE_OPTIONS = Deno . env . get ( "ENV_TYPE" ) === "local"
44- ? {
45- hostname : "localhost" ,
46- port : 3000 ,
47- }
48- : {
49- hostname : "serpapi.com" ,
50- port : 443 ,
51- } ;
43+ const BASE_OPTIONS = {
44+ hostname : "serpapi.com" ,
45+ port : 443 ,
46+ } ;
5247
5348describe (
5449 "getAccount" ,
Original file line number Diff line number Diff line change @@ -23,15 +23,10 @@ import http from "node:http";
2323import qs from "node:querystring" ;
2424
2525loadSync ( { export : true } ) ;
26- const BASE_OPTIONS = Deno . env . get ( "ENV_TYPE" ) === "local"
27- ? {
28- hostname : "localhost" ,
29- port : 3000 ,
30- }
31- : {
32- hostname : "serpapi.com" ,
33- port : 443 ,
34- } ;
26+ const BASE_OPTIONS = {
27+ hostname : "serpapi.com" ,
28+ port : 443 ,
29+ } ;
3530
3631describe ( "getSource" , ( ) => {
3732 it ( "use runtime version" , async ( ) => {
You can’t perform that action at this time.
0 commit comments