Permalink
Browse files

Merge pull request #170 from josephfrazier/zuul-jasmine

Add automated browser testing
  • Loading branch information...
slevithan committed Apr 30, 2017
2 parents 0806f0e + 751e310 commit d83c5d278316fc3cca4a1f896ca1ea2f2b4b0704
View
@@ -1,3 +1,6 @@
language: node_js
node_js:
- node
+script:
+ - npm test
+ - '[ -z "$SAUCE_USERNAME" ] || [ -z "$SAUCE_ACCESS_KEY" ] || npm run test-saucelabs'
View
@@ -0,0 +1,40 @@
+ui: jasmine2
+
+scripts:
+ - "tests/vendor/jasmine/jasmine.js"
+ - "tests/vendor/jasmine/jasmine-html.js"
+ - "tests/vendor/jasmine/boot.js"
+
+ - "xregexp-all.js"
+
+ - "tests/helpers/h.js"
+ - "tests/helpers/h-matchers.js"
+ - "tests/helpers/h-unicode.js"
+
+browsers:
+ - name: chrome
+ version: [49, 55..latest]
+
+ - name: firefox
+ version: [45, 50..latest]
+
+ - name: safari
+ version: 9..latest
+
+ - name: opera
+ version: 12..latest
+
+ - name: ie
+ version: 10..latest
+
+ - name: microsoftedge
+ version: 13..latest
+
+ - name: android
+ version: '4.4..latest'
+
+ - name: iphone
+ version: '9.3..latest'
+
+ - name: ipad
+ version: '9.3..latest'
View
@@ -29,6 +29,8 @@
"build": "browserify lib/index.js --standalone XRegExp > xregexp-all.js",
"pretest": "npm run build",
"test": "jasmine JASMINE_CONFIG_PATH=tests/jasmine.json",
+ "test-saucelabs": "npm run pretest && zuul tests/spec/*.js",
+ "test-browser": "npm run test-saucelabs -- --local --open",
"prepublish": "npm test"
},
"devDependencies": {
@@ -39,6 +41,7 @@
"babel-preset-env": "^1.4.0",
"browserify": "^12.0.1",
"eslint": "^3.19.0",
- "jasmine": "^2.5.3"
+ "jasmine": "^2.5.3",
+ "zuul": "^3.11.1"
}
}
@@ -1,4 +1,8 @@
-beforeEach(function() {
+if (typeof global === 'undefined') {
+ global = window;
+}
+
+global.addToEqualMatchMatcher = function() {
jasmine.addMatchers({
// Similar to toEqual with arrays, but ignores custom properties of arrays. Useful when
// comparing regex matches with array literals.
@@ -30,4 +34,4 @@ beforeEach(function() {
};
}
});
-});
+}
View
@@ -5,9 +5,9 @@ if (typeof global === 'undefined') {
}
// Ensure that all opt-in features are disabled when each spec starts
-beforeEach(function() {
+global.disableOptInFeatures = function() {
XRegExp.uninstall('natives astral');
-});
+}
// Repeat a string the specified number of times
global.repeat = function (str, num) {
@@ -1,3 +1,8 @@
+beforeEach(function() {
+ global.disableOptInFeatures();
+ global.addToEqualMatchMatcher();
+});
+
describe('XRegExp.build addon:', function() {
describe('XRegExp.tag()', function() {
@@ -1,3 +1,8 @@
+beforeEach(function() {
+ global.disableOptInFeatures();
+ global.addToEqualMatchMatcher();
+});
+
describe('XRegExp.matchRecursive addon:', function() {
describe('XRegExp.matchRecursive()', function() {
@@ -1,3 +1,8 @@
+beforeEach(function() {
+ global.disableOptInFeatures();
+ global.addToEqualMatchMatcher();
+});
+
describe('Unicode Base addon:', function() {
/*
@@ -1,3 +1,8 @@
+beforeEach(function() {
+ global.disableOptInFeatures();
+ global.addToEqualMatchMatcher();
+});
+
describe('XRegExp.addToken()', function() {
it('should throw an exception if provided a non-RegExp object as the regex argument', function() {
@@ -1,3 +1,8 @@
+beforeEach(function() {
+ global.disableOptInFeatures();
+ global.addToEqualMatchMatcher();
+});
+
describe('When overridden, RegExp.prototype.exec()', function() {
beforeEach(function() {
View
@@ -1,3 +1,8 @@
+beforeEach(function() {
+ global.disableOptInFeatures();
+ global.addToEqualMatchMatcher();
+});
+
describe('XRegExp()', function() {
it('should create objects that pass RegExp type checks', function() {

0 comments on commit d83c5d2

Please sign in to comment.