Skip to content

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ebidel committed Jun 13, 2017
1 parent fc24436 commit 8e72cd2
Show file tree
Hide file tree
Showing 7 changed files with 1,748 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules
24 changes: 24 additions & 0 deletions .travis.yml
@@ -0,0 +1,24 @@
language: node_js
node_js:
- "7"
dist: trusty
sudo: false
#addons:
# chrome: stable
git:
depth: 1
cache:
directories:
- node_modules
# before_install:
# - # start your web application and listen on `localhost:3000`
# - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost:3000
install:
- npm install
script:
- npm run test
# after_success:
# - ./travis/deploy_pr_gae.sh
# - export LH_MIN_PASS_SCORE=96
# - export LH_TEST_URL=https://lighthouse-ci-staging-dot-cr-status.appspot.com/features
# - node node_modules/lighthouse-ci/runlighthouse.js --runner=wpt --score=$LH_MIN_PASS_SCORE $LH_TEST_URL
26 changes: 26 additions & 0 deletions karma.conf.js
@@ -0,0 +1,26 @@
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai'],
files: [
'test/**/*.js'
],
reporters: ['progress'],
port: 9876, // karma web server port
colors: true,
logLevel: config.LOG_INFO,

browsers: ['Chrome', 'ChromeHeadless', 'MyHeadlessChrome'],
customLaunchers: {
MyHeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--disable-translate', '--disable-extensions',
'--no-first-run', '--disable-background-networking',
'--remote-debugging-port=9223']
}
},

autoWatch: false,
// singleRun: false, // Karma captures browsers, runs the tests and exits
concurrency: Infinity
})
}
20 changes: 20 additions & 0 deletions package.json
@@ -0,0 +1,20 @@
{
"name": "headless-karma-travis",
"private": true,
"version": "0.0.1",
"main": "index.js",
"repository": "https://github.com/ebidel/headless-karma-travis",
"author": "Eric Bidelman <ebidel@gmail.com>",
"license": "Apache-2.0",
"scripts": {
"test": "karma start --single-run --browsers MyHeadlessChrome karma.conf.js"
},
"devDependencies": {
"chai": "^4.0.2",
"karma": "^1.7.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.1.1",
"karma-mocha": "^1.3.0",
"mocha": "^3.4.2"
}
}
17 changes: 17 additions & 0 deletions test/index.html
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>Mocha Tests</title>
<link rel="stylesheet" href="/node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="/node_modules/mocha/mocha.js"></script>
<script src="/node_modules/chai/chai.js"></script>
<script>mocha.setup('bdd');</script>
<script src="test.js"></script>
<script>
mocha.run();
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions test/test.js
@@ -0,0 +1,9 @@
// const assert = chai.assert;

describe('Array', () => {
describe('#indexOf()', () => {
it('should return -1 when the value is not present', () => {
assert.equal(-1, [1,2,3].indexOf(4));
});
});
});

0 comments on commit 8e72cd2

Please sign in to comment.