Skip to content

Commit a314597

Browse files
committed
Setup browser tests
1 parent 392a0cb commit a314597

File tree

7 files changed

+2439
-38
lines changed

7 files changed

+2439
-38
lines changed

CHANGELOG.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
unreleased:
22
fixed bugs:
33
- Fixed a bug where `encoder.encodeHost` throws in the browser
4+
chores:
5+
- Setup browser tests
46

57
3.0.4:
68
date: 2021-08-09

npm/test-browser.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env node
2+
// ---------------------------------------------------------------------------------------------------------------------
3+
// This script is intended to execute all unit tests in the Chrome Browser.
4+
// ---------------------------------------------------------------------------------------------------------------------
5+
6+
const path = require('path'),
7+
8+
chalk = require('chalk'),
9+
KarmaServer = require('karma').Server,
10+
11+
KARMA_CONFIG_PATH = path.join(__dirname, '..', 'test', 'karma.conf');
12+
13+
module.exports = function (exit) {
14+
if (process.env.TRAVIS_OS_NAME === 'windows') { // eslint-disable-line no-process-env
15+
return console.info(chalk.yellow.bold('Skipping browser tests on windows...'));
16+
}
17+
18+
console.info(chalk.yellow.bold('Running unit tests within browser...'));
19+
20+
(new KarmaServer({ // eslint-disable no-new
21+
cmd: 'start',
22+
configFile: KARMA_CONFIG_PATH
23+
}, exit)).start();
24+
};
25+
26+
// ensure we run this script exports if this is a direct stdin.tty run
27+
!module.parent && module.exports(process.exit);

0 commit comments

Comments
 (0)