Skip to content

Commit e41f142

Browse files
committed
✅ Use karma.js to run browser specs
1 parent 60d66fb commit e41f142

21 files changed

+2144
-14385
lines changed

.github/workflows/browser.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,15 @@ on:
1111

1212
jobs:
1313
ci:
14-
runs-on: ubuntu-latest
14+
runs-on: macos-latest
1515
steps:
1616
- uses: actions/checkout@v2
1717
- uses: actions/setup-node@v3
1818
with:
1919
cache: 'npm'
20-
- name: BrowserStack Env Setup
21-
uses: 'browserstack/github-actions/setup-env@master'
22-
with:
23-
username: ${{ secrets.BROWSERSTACK_USERNAME }}
24-
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
25-
- name: BrowserStack Local Tunnel Setup
26-
uses: browserstack/github-actions/setup-local@master
27-
with:
28-
local-testing: start
29-
local-identifier: random
3020
- name: Install dependencies
3121
run: npm ci
3222
- name: Build
3323
run: npm run build
34-
- name: Browser tests
35-
run: npm run test:browsers
36-
- name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection
37-
uses: browserstack/github-actions/setup-local@master
38-
if: ${{ always() }}
39-
with:
40-
local-testing: stop
41-
24+
- name: Run browser tests
25+
run: npm run test:karma

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ npm install
2626
```bash
2727
npm start
2828
# To run browser specs
29-
npm run test:browsers:local
29+
npm run test:karma # same as the ci
30+
npm run test:karma:watch # in watch mode
3031
```
3132

3233
The code **must** pass the linter and specs.

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<a href="https://www.npmjs.com/package/wretch"><img alt="npm-badge" src="https://img.shields.io/npm/v/wretch.svg?colorB=ff733e" height="20"></a>
88
<a href="https://www.npmjs.com/package/wretch"><img alt="npm-downloads-badge" src="https://img.shields.io/npm/dm/wretch.svg?colorB=53aabb" height="20"></a>
99
<a href="https://coveralls.io/github/elbywan/wretch?branch=master"><img src="https://coveralls.io/repos/github/elbywan/wretch/badge.svg?branch=master" alt="Coverage Status"></a>
10-
<a href="https://automate.browserstack.com/public-build/R3dTcUtRNThKQjVGdStBL2xDMjIzOXpqY2lzTlZ2TmdnWC9JekpaNWJDYz0tLUsrWjE3WEM5NTVuWG9BdUhDMjVuRWc9PQ==--2146089f82a924d2a8091ea89f3cfbc74091595d"><img src='https://automate.browserstack.com/badge.svg?badge_key=R3dTcUtRNThKQjVGdStBL2xDMjIzOXpqY2lzTlZ2TmdnWC9JekpaNWJDYz0tLUsrWjE3WEM5NTVuWG9BdUhDMjVuRWc9PQ==--2146089f82a924d2a8091ea89f3cfbc74091595d'/></a>
1110
<a href="https://bundlephobia.com/result?p=wretch"><img src='https://img.shields.io/bundlephobia/minzip/wretch.svg'/></a>
1211
<a href="https://github.com/elbywan/wretch/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license-badge" height="20"></a>
1312
</h1>
@@ -761,8 +760,3 @@ wretch("https://base.com").get("/resource/1")
761760
762761
MIT
763762
764-
# Credits
765-
766-
This project uses automated node.js & browser unit tests. The latter are a provided courtesy of:
767-
768-
<a href="https://www.browserstack.com/"><img src="assets/browserstack-logo.png" alt="browserstack-logo" height="100"></a>

karma.conf.cjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = function (config) {
2+
config.set({
3+
files: [
4+
'dist/bundle/wretch.all.min.js',
5+
'test/browser/*.spec.js'
6+
],
7+
frameworks: ['jasmine'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-firefox-launcher'),
12+
// require('karma-safari-launcher'),
13+
require('karma-safarinative-launcher'),
14+
],
15+
reporters: ['progress'],
16+
port: 9877,
17+
colors: true,
18+
logLevel: config.LOG_INFO,
19+
browsers: ['ChromeHeadless', 'FirefoxHeadless', 'SafariNative'],
20+
autoWatch: false,
21+
concurrency: 1
22+
})
23+
}

0 commit comments

Comments
 (0)