Skip to content

Commit f40e13f

Browse files
committed
cleanup 1
1 parent faa2f61 commit f40e13f

File tree

7 files changed

+246
-266
lines changed

7 files changed

+246
-266
lines changed

.github/workflows/javascript.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
browser_tests:
4444
runs-on: macos-latest
4545
strategy:
46+
fail-fast: false
4647
matrix:
4748
browser: ['chrome', 'firefox', 'edge', 'safari']
4849
env:
4950
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
5051
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
51-
BROWSERSTACK_LOCAL: 'true'
5252
USE_LOCAL_BROWSER: 'false'
5353
TEST_BROWSER: ${{ matrix.browser }}
5454
steps:
@@ -63,7 +63,7 @@ jobs:
6363
working-directory: .
6464
run: |
6565
npm install
66-
npm run test-vitest-browser
66+
npm run test-browser
6767
6868
# crossbrowser_and_umd_unit_tests:
6969
# runs-on: ubuntu-latest

package-lock.json

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,9 @@
6161
"fix-platform-export": "./scripts/platform-validator.js --fix-export",
6262
"test-isolation-rules": "./scripts/test-validator.js",
6363
"test-vitest": "vitest run",
64-
"test-vitest-browser": "node ./scripts/run-browser-tests.js",
65-
"test-vitest-browser-local": "USE_LOCAL_BROWSER=true node ./scripts/run-browser-tests.js",
66-
"test-vitest-browser-chrome": "VITEST_BROWSER=chrome node ./scripts/run-browser-tests.js",
67-
"test-vitest-browser-chrome-local": "USE_LOCAL_BROWSER=true VITEST_BROWSER=chrome node ./scripts/run-browser-tests.js",
68-
"test-vitest-browser-firefox": "VITEST_BROWSER=firefox node ./scripts/run-browser-tests.js",
69-
"test-vitest-browser-firefox-local": "USE_LOCAL_BROWSER=true VITEST_BROWSER=firefox node ./scripts/run-browser-tests.js",
70-
"test-vitest-browser-edge": "VITEST_BROWSER=edge node ./scripts/run-browser-tests.js",
71-
"test-vitest-browser-edge-local": "USE_LOCAL_BROWSER=true VITEST_BROWSER=edge node ./scripts/run-browser-tests.js",
72-
"test-vitest-browser-safari": "VITEST_BROWSER=safari node ./scripts/run-browser-tests.js",
73-
"test-vitest-browser-opera": "VITEST_BROWSER=opera node ./scripts/run-browser-tests.js",
74-
"test-vitest-browser-playwright": "node ./scripts/run-browser-tests-playwright.js",
75-
"test-vitest-browser-playwright-chromium": "node ./scripts/run-browser-tests-playwright.js chromium",
76-
"test-vitest-browser-playwright-firefox": "node ./scripts/run-browser-tests-playwright.js firefox",
77-
"test-vitest-browser-playwright-webkit": "node ./scripts/run-browser-tests-playwright.js webkit",
78-
"test-vitest-browser-playwright-chromium-watch": "vitest --config vitest.browser.playwright.config.mts --browser.name=chromium --watch --ui",
79-
"test-vitest-browser-playwright-firefox-watch": "vitest --config vitest.browser.playwright.config.mts --browser.name=firefox --watch --ui",
80-
"test-vitest-browser-playwright-webkit-watch": "vitest --config vitest.browser.playwright.config.mts --browser.name=webkit --watch --ui",
81-
"test-vitest-browser-webdriverio": "node ./scripts/run-browser-tests-webdriverio.js",
82-
"test-vitest-browser-webdriverio-chrome": "node ./scripts/run-browser-tests-webdriverio.js chrome",
83-
"test-vitest-browser-webdriverio-firefox": "node ./scripts/run-browser-tests-webdriverio.js firefox",
84-
"test-vitest-browser-webdriverio-edge": "node ./scripts/run-browser-tests-webdriverio.js edge",
64+
"test-browser": "node ./scripts/run-browser-tests.js",
65+
"test-browser-local": "USE_LOCAL_BROWSER=true node ./scripts/run-browser-tests.js",
66+
"test-browser-browserstack": "USE_LOCAL_BROWSER=false node ./scripts/run-browser-tests.js",
8567
"test-mocha": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha -r ts-node/register -r tsconfig-paths/register -r lib/tests/exit_on_unhandled_rejection.js 'lib/**/*.tests.ts' 'lib/**/*.tests.js'",
8668
"test": "npm run test-mocha && npm run test-vitest",
8769
"posttest": "npm run lint",
@@ -136,7 +118,6 @@
136118
"@vitest/browser": "3.2.4",
137119
"chai": "^4.2.0",
138120
"coveralls-next": "^4.2.0",
139-
"dotenv": "^17.2.3",
140121
"eslint": "^8.21.0",
141122
"eslint-config-prettier": "^6.10.0",
142123
"eslint-plugin-local-rules": "^3.0.2",

scripts/run-browser-tests.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
19-
// Load environment variables from .env file
20-
require('dotenv').config();
21-
2218
const { execSync } = require('child_process');
2319
const browserstack = require('browserstack-local');
2420

@@ -68,11 +64,6 @@ const useBrowserStackLocal = process.env.BROWSERSTACK_LOCAL === 'true';
6864
let bs_local = null;
6965

7066
function startTunnel() {
71-
if (!useBrowserStackLocal) {
72-
console.log('BrowserStack Local tunnel disabled (tests run without local server access)');
73-
return Promise.resolve();
74-
}
75-
7667
const username = process.env.BROWSERSTACK_USERNAME || process.env.BROWSER_STACK_USERNAME;
7768
const accessKey = process.env.BROWSERSTACK_ACCESS_KEY || process.env.BROWSER_STACK_ACCESS_KEY;
7869

@@ -133,13 +124,22 @@ async function runTests() {
133124
// Get browser name from environment variable (default to chrome)
134125
const browserName = (process.env.TEST_BROWSER || 'chrome').toLowerCase();
135126

136-
// Get configs for this browser
137-
const configs = BROWSER_CONFIGS[browserName];
138-
if (!configs || configs.length === 0) {
139-
console.error(`Error: No configurations found for browser '${browserName}'`);
140-
console.error(`Available browsers: ${Object.keys(BROWSER_CONFIGS).join(', ')}`);
141-
exitCode = 1;
142-
return;
127+
let configs;
128+
129+
if (useLocalBrowser) {
130+
configs = [{
131+
name: `${browserName}`,
132+
}];
133+
console.log('Local browser mode: using local browser installation');
134+
} else {
135+
// For BrowserStack, use the defined configs
136+
configs = BROWSER_CONFIGS[browserName];
137+
if (!configs || configs.length === 0) {
138+
console.error(`Error: No configurations found for browser '${browserName}'`);
139+
console.error(`Available browsers: ${Object.keys(BROWSER_CONFIGS).join(', ')}`);
140+
exitCode = 1;
141+
return;
142+
}
143143
}
144144

145145
// Only start tunnel if using BrowserStack
@@ -167,9 +167,8 @@ async function runTests() {
167167
// Set environment variables for this config
168168
const env = {
169169
...process.env,
170-
USE_LOCAL_BROWSER: useLocalBrowser ? 'true' : 'false',
171170
TEST_BROWSER: browserName,
172-
TEST_BROWSER_VERSION: config.browserVersion || '',
171+
TEST_BROWSER_VERSION: config.browserVersion,
173172
TEST_OS_NAME: config.os,
174173
TEST_OS_VERSION: config.osVersion,
175174
};

0 commit comments

Comments
 (0)