Skip to content

Commit

Permalink
Remove artificial async and ** from polyfill tests since they don't s…
Browse files Browse the repository at this point in the history
…eem to be needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175367781
  • Loading branch information
shicks authored and Tyler Breisacher committed Nov 13, 2017
1 parent d480fee commit bcf3f9c
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 27 deletions.
Expand Up @@ -22,10 +22,8 @@ const userAgent = goog.require('goog.userAgent');

testSuite({
shouldRunTests() {
// NOTE: Using ** forces the compiler to see this code as ES7.
// We need this to guarantee the polyfill is provided.
// Disable tests for IE8 and below.
return 1 ** 1 && !userAgent.IE || userAgent.isVersionOrHigher(9);
return !userAgent.IE || userAgent.isVersionOrHigher(9);
},

testIncludes() {
Expand Down
Expand Up @@ -19,20 +19,12 @@ goog.setTestOnly();

const testSuite = goog.require('goog.testing.testSuite');
const testing = goog.require('jscomp.runtime_tests.polyfill_tests.testing');
//const userAgent = goog.require('goog.userAgent');

const assertPropertyListEquals = testing.assertPropertyListEquals;

const SYMBOL_IS_POLYFILLED = typeof Symbol('') === 'string';

testSuite({
shouldRunTests() {
// NOTE: Using an async function forces the compiler to consider this file
// as ES8 code, which guarantees the polyfill will be included.
(async () => 1)();
return true;
},

testEntries() {
assertPropertyListEquals(
[['1', 4], ['a', 1], ['c', 2], ['b', 3]],
Expand Down
Expand Up @@ -23,9 +23,6 @@ const userAgent = goog.require('goog.userAgent');

testSuite({
shouldRunTests() {
// NOTE: Using an async function forces the compiler to consider this file
// as ES8 code, which guarantees the polyfill will be included.
(async () => 1)();
// Not polyfilled to ES3
return !userAgent.IE || userAgent.isVersionOrHigher(9);
},
Expand Down
Expand Up @@ -19,20 +19,12 @@ goog.setTestOnly();

const testSuite = goog.require('goog.testing.testSuite');
const testing = goog.require('jscomp.runtime_tests.polyfill_tests.testing');
//const userAgent = goog.require('goog.userAgent');

const assertPropertyListEquals = testing.assertPropertyListEquals;

const SYMBOL_IS_POLYFILLED = typeof Symbol('') === 'string';

testSuite({
shouldRunTests() {
// NOTE: Using an async function forces the compiler to consider this file
// as ES8 code, which guarantees the polyfill will be included.
(async () => 1)();
return true;
},

testValues() {
assertPropertyListEquals(
[4, 1, 2, 3], Object.values({'a': 1, 'c': 2, 'b': 3, 1: 4}));
Expand Down
Expand Up @@ -26,9 +26,6 @@ const noCheck = testing.noCheck;

testSuite({
shouldRunTests() {
// NOTE: Using an async function forces the compiler to consider this file
// as ES8 code, which guarantees the polyfill will be included.
(async () => 1)();
// NOTE: padEnd is not present in all browsers we currently test under.
return !goog.global.NOT_TRANSPILED ||
userAgent.CHROME && userAgent.isVersionOrHigher(57) ||
Expand Down
Expand Up @@ -26,8 +26,6 @@ const noCheck = testing.noCheck;

testSuite({
shouldRunTests() {
// NOTE: we need this file to show up as ES8 to guarantee the polyfill.
(async () => 1)();
// NOTE: padStart is not present in all browsers we currently test under.
return !goog.global.NOT_TRANSPILED ||
userAgent.CHROME && userAgent.isVersionOrHigher(57) ||
Expand Down

0 comments on commit bcf3f9c

Please sign in to comment.