Skip to content

Commit 911913b

Browse files
committed
Adding karma
1 parent 49c1470 commit 911913b

File tree

5 files changed

+4198
-436
lines changed

5 files changed

+4198
-436
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ yarn-error.log
99
# Root yarn.lock is used by Travis to use Yarn instead of npm
1010
packages/**/yarn.lock
1111
package-lock.json
12+
.cache

browser-tests/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom";
3+
4+
const Test = () => <div id="asd" style={{ background: "grey" }} />;
5+
6+
// todo figure out how to make async-await work in parcel
7+
// todo make sure parcel transpiles down to IE10
8+
it("should render", () => {
9+
const div = document.createElement("div");
10+
document.body.appendChild(div);
11+
12+
ReactDOM.render(<Test />, div);
13+
14+
const rendered = document.querySelector("#asd");
15+
16+
expect(rendered.style.backgroundColor).toBe("grey");
17+
});

karma.conf.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = function(config) {
2+
config.set({
3+
basePath: ".",
4+
frameworks: ["jasmine"],
5+
files: ["browser-tests/dist/index.js"],
6+
autoWatch: true,
7+
browsers: ["Chrome"],
8+
// browsers: process.env.CI ? Object.keys(customLaunchers) : ['Chrome'],
9+
10+
singleRun: true,
11+
12+
concurrency: 2 // SanceLabs free account for open source
13+
14+
// customLaunchers: customLaunchers,
15+
16+
// Saucelabs launcher
17+
// sauceLabs: {
18+
// testName: 'react-container-query',
19+
// public: 'public'
20+
// },
21+
});
22+
};

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,30 @@
1111
"url": "https://github.com/ZeeCoder/container-query/issues"
1212
},
1313
"devDependencies": {
14-
"@babel/core": "^7.1.6",
14+
"@babel/core": "^7.2.0",
1515
"babel-core": "^7.0.0-bridge.0",
1616
"babel-jest": "^23.6.0",
1717
"coveralls": "^3.0.2",
1818
"husky": "^1.1.4",
19+
"jasmine-core": "^3.3.0",
1920
"jest": "^23.6.0",
21+
"karma": "^3.1.3",
22+
"karma-chrome-launcher": "^2.2.0",
23+
"karma-firefox-launcher": "^1.1.0",
24+
"karma-jasmine": "^2.0.1",
2025
"lerna": "^3.4.3",
2126
"lint-staged": "^8.0.5",
27+
"parcel-bundler": "^1.10.3",
2228
"prettier": "^1.15.2",
29+
"react": "^16.6.3",
30+
"react-dom": "^16.6.3",
2331
"regenerator-runtime": "^0.13.1"
2432
},
2533
"scripts": {
2634
"test": "jest --coverage",
2735
"test:watch": "jest --watch",
36+
"browser-test:build": "parcel build browser-tests/index.js --out-dir browser-tests/dist",
37+
"browser-test:run": "karma start",
2838
"coveralls": "cat ./coverage/lcov.info | coveralls",
2939
"prettify": "prettier --write 'packages/**/*.js'",
3040
"bootstrap": "lerna bootstrap",

0 commit comments

Comments
 (0)