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 27, 2017
1 parent c63b0a3 commit 503a03d
Show file tree
Hide file tree
Showing 6 changed files with 1,302 additions and 33 deletions.
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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
- cd website && yarn run test

Expand Down
24 changes: 24 additions & 0 deletions integration_tests/browser-support/browser-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

/* 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);
});
});
21 changes: 21 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

module.exports = config => {
config.set({
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 @@ -17,6 +17,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 @@ -36,10 +37,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
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ if (files.length) {
process.stdout.write('\n');

process.stdout.write(chalk.inverse(' Building browser packages \n'));
packages.forEach(buildBrowserPackage); >>>
packages.forEach(buildBrowserPackage);
}
Loading

0 comments on commit 503a03d

Please sign in to comment.