Repository: Modernizr/Modernizr
Pull request #2598 (2020-09-03 17:18:36)

Require changes for codecov comment
[I know you like the comment from codecov](https://github.com/Modernizr/Modernizr/pull/2554#issuecomment-623045044) but I don't know, I find the idea of adding a comment to a PR which does not change the coverage at all to be a little bit annoying (specially because it counts as a notification to Github). This PR adds the necessity of having a coverage change for the comment to be posted. 


Patch:
diff --git a/README.md b/README.md
index a7fd1d9d..ee87ff2f 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,7 @@ Modernizr tests which native CSS3 and HTML5 features are available in the curren
     - `touchevents`: [discussion](https://github.com/Modernizr/Modernizr/pull/2432) 
     - `unicode`: [discussion](https://github.com/Modernizr/Modernizr/issues/2468) 
     - `templatestrings`: duplicate of the es6 detect `stringtemplate`
+    - `contains`: duplicate of the es6 detect `es6string`
     - `datalistelem`: A dupe of Modernizr.input.list
 
 ## New Asynchronous Event Listeners
diff --git a/appveyor.yml b/appveyor.yml
index 94282258..882c0856 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -5,7 +5,7 @@ environment:
     - nodejs_version: 14
 
 install:
-  - ps: Install-Product node $env:nodejs_version
+  - ps: Install-Product node $env:nodejs_version x64
   - npm install
 
 build: off
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 00000000..ba6f0b2b
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,2 @@
+comment:
+  require_changes: true
diff --git a/feature-detects/es6/contains.js b/feature-detects/es6/contains.js
deleted file mode 100644
index f8e8493b..00000000
--- a/feature-detects/es6/contains.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*!
-{
-  "name": "ES5 String.prototype.contains",
-  "property": "contains",
-  "authors": ["Robert Kowalski"],
-  "tags": ["es6"]
-}
-!*/
-/* DOC
-Check if browser implements ECMAScript 6 `String.prototype.contains` per specification.
-*/
-define(['Modernizr', 'is'], function(Modernizr, is) {
-  Modernizr.addTest('contains', is(String.prototype.contains, 'function'));
-});
diff --git a/feature-detects/webrtc/datachannel.js b/feature-detects/webrtc/datachannel.js
index 7c601c4b..3ce16096 100644
--- a/feature-detects/webrtc/datachannel.js
+++ b/feature-detects/webrtc/datachannel.js
@@ -19,8 +19,12 @@ define(['Modernizr', 'prefixed', 'domPrefixesAll', 'test/webrtc/peerconnection']
     for (var i = 0, len = domPrefixesAll.length; i < len; i++) {
       var PeerConnectionConstructor = window[domPrefixesAll[i] + 'RTCPeerConnection'];
       if (PeerConnectionConstructor) {
-        var peerConnection = new PeerConnectionConstructor(null);
-        return 'createDataChannel' in peerConnection;
+        // Wrapped in a try catch to avoid "Error creating RTCPeerConnection" #2599 & #2221
+        try {
+          var peerConnection = new PeerConnectionConstructor({});
+          return 'createDataChannel' in peerConnection;
+        } catch (e) {
+        }
       }
     }
     return false;
diff --git a/lib/config-all.json b/lib/config-all.json
index 80508c47..afa6afa5 100644
--- a/lib/config-all.json
+++ b/lib/config-all.json
@@ -170,7 +170,6 @@
     "es6/arrow",
     "es6/class",
     "es6/collections",
-    "es6/contains",
     "es6/generators",
     "es6/math",
     "es6/number",
diff --git a/lib/metadata.js b/lib/metadata.js
index 6ff5474b..453d7406 100644
--- a/lib/metadata.js
+++ b/lib/metadata.js
@@ -85,6 +85,14 @@ function metadata(cb) {
       }
       metadata.polyfills = pfs;
 
+      //metadata.property can only have lowercase alphanumeric and dashes
+      const properties = Array.isArray(metadata.property) ? metadata.property : [metadata.property];
+      properties.forEach(function (property) {
+        if (!property.match(/^[a-z0-9-]+$/)) {
+          throw new Error(metadata.name + ' : ' + property + ': Property can only have lowercase alphanumeric characters and dashes ' )
+        }
+      })
+
       if (!metadata.async) {
         metadata.async = false;
       }


Test patch:
diff --git a/test/node/lib/metadata.js b/test/node/lib/metadata.js
index e9041387..fdc5ced3 100644
--- a/test/node/lib/metadata.js
+++ b/test/node/lib/metadata.js
@@ -102,6 +102,18 @@ describe('cli/metadata', function() {
     expect(metadata).to.throw(/Minimal metadata not found/);
   });
 
+  it('should throw if property contains uppercase characters and/or special symbols except dashes', function() {
+
+    var metadata = proxyquire(root + 'lib/metadata', {
+      'fs': {
+        'readFileSync': function() {
+          return '/*! { "name": "fake", "property": "U_pper-case123"}!*/ define([],';
+        }
+      }
+    });
+    expect(metadata).to.throw(/Property can only have lowercase alphanumeric characters and dashes/);
+  });
+
   it('should throw if polyfill is incorrectly configured', function() {
 
     var metadata = proxyquire(root + 'lib/metadata', {