Skip to content

Commit

Permalink
Add karma browser tests for es5 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
skovhus committed Jun 2, 2017
1 parent e412288 commit 5861ddb
Show file tree
Hide file tree
Showing 5 changed files with 1,290 additions and 38 deletions.
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test:
- nvm alias default 4
- yarn run test-ci-partial
- nvm alias default 8
- yarn run test-ci-es5-build-in-browser
- yarn run test-ci-partial
- DANGER_GITHUB_API_TOKEN="ab0c4d396c935d3abce""fc213176da6bb7b2996ff" yarn run danger
- cd website && yarn run test
Expand Down
16 changes: 16 additions & 0 deletions integration_tests/browser-support/browser-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
var expect = require('../../packages/jest-matchers/build-es5/index.js');
var mock = require('../../packages/jest-mock/build-es5/index.js');

describe('es5 builds in browser', function() {
it('runs assertions', function() {
expect(1).toBe(1);
});

it('runs mocks', function() {
var someMockFunction = mock.fn();
expect(someMockFunction.mock.calls.length).toBe(0);
someMockFunction();
expect(someMockFunction.mock.calls.length).toBe(1);
});
});
14 changes: 14 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = config => {
config.set({
// browsers: ['Chrome'],
browsers: ['ChromeHeadless'],
files: [
'integration_tests/browser-support/browser-test.js',
],
frameworks: ['mocha', 'browserify'],
plugins: ['karma-browserify', 'karma-chrome-launcher', 'karma-mocha'],
preprocessors: {
'integration_tests/browser-support/browser-test.js': ['browserify'],
},
});
};
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"babel-preset-env": "^1.4.0",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native": "^1.9.1",
"browserify": "^14.4.0",
"chalk": "^1.1.3",
"codecov": "^1.0.1",
"cross-spawn": "^5.1.0",
Expand All @@ -35,10 +36,15 @@
"jasmine-reporters": "^2.2.0",
"jquery": "^3.2.1",
"jsdom": "^9.12.0",
"karma": "^1.7.0",
"karma-browserify": "^5.1.1",
"karma-chrome-launcher": "^2.1.1",
"karma-mocha": "^1.3.0",
"left-pad": "^1.1.1",
"lerna": "2.0.0-rc.4",
"micromatch": "^2.3.11",
"mkdirp": "^0.5.1",
"mocha": "^3.4.2",
"prettier": "1.3.1",
"progress": "^1.1.8",
"react": "15.4.2",
Expand Down Expand Up @@ -73,6 +79,7 @@
"prettier": "node scripts/prettier.js write",
"postinstall": "node ./scripts/postinstall.js && yarn run build --silent && (cd packages/eslint-plugin-jest && yarn link --silent) && yarn link eslint-plugin-jest --silent",
"publish": "yarn run build-clean --silent && yarn run build --silent && lerna publish --silent",
"test-ci-es5-build-in-browser": "karma start --single-run",
"test-ci": "yarn run typecheck --silent && yarn run lint --silent && yarn run lint-es5-build && yarn run jest-coverage --silent -- -i && yarn run test-examples --silent && node scripts/mapCoverage.js && codecov",
"test-ci-partial": "yarn run jest --silent -- -i && yarn run test-examples --silent",
"test-examples": "node scripts/test_examples.js",
Expand Down
Loading

0 comments on commit 5861ddb

Please sign in to comment.