Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit 9edd6e1

Browse files
watildecaridy
authored andcommitted
Fix the tests don't run correctly on CI (#167)
1 parent 1ffdbd8 commit 9edd6e1

8 files changed

+22
-16
lines changed

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ language: node_js
22
node_js:
33
- '0.10'
44
- '0.12'
5-
5+
before_install:
6+
- npm install -g npm@3
7+
- npm --version
68
addons:
79
sauce_connect:
810
username: andyearnshaw

Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = function (grunt) {
3030
dest : 'tests/test262',
3131
src : [
3232
'LICENSE',
33-
'test/intl402/*.js',
33+
'test/intl402/**/*.js',
3434
'harness/*.js',
3535
],
3636
},

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"cli-color": "^1.0.0",
4040
"clui": "^0.3.1",
4141
"eslint": "^2.2.0",
42+
"estraverse-fb": "^1.3.1",
4243
"finalhandler": "^0.4.0",
4344
"glob": "^5.0.3",
4445
"grunt": "^0.4.5",
@@ -51,7 +52,7 @@
5152
"mkdirp": "^0.5.1",
5253
"object.assign": "^1.1.1",
5354
"rimraf": "^2.4.2",
54-
"rollup": "^0.25.0",
55+
"rollup": "^0.26.0",
5556
"rollup-plugin-babel": "^2.3.9",
5657
"rollup-plugin-commonjs": "^2.2.0",
5758
"rollup-plugin-memory": "^1.0.0",

scripts/build-dist.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const bundleConfig = {
1717
format: 'umd',
1818
moduleName: 'IntlPolyfill',
1919
sourceMap: true,
20+
external: ['Intl'],
2021
};
2122

2223
let babelConfig = JSON.parse(fs.readFileSync('src/.babelrc', 'utf8'));

src/12.datetimeformat.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ function CreateDateTimeParts(dateTimeFormat, x) {
861861
let internal = dateTimeFormat.__getInternalProperties(secret);
862862

863863
// Creating restore point for properties on the RegExp object... please wait
864-
/* let regexpState = */createRegExpRestore(); // todo: review this
864+
/* let regexpState = */createRegExpRestore(); // ###TODO: review this
865865

866866
// 2. Let locale be the value of the [[locale]] internal property of dateTimeFormat.
867867
let locale = internal['[[locale]]'];
@@ -988,10 +988,10 @@ function CreateDateTimeParts(dateTimeFormat, x) {
988988
break;
989989

990990
case 'timeZoneName':
991-
fv = ''; // TODO
991+
fv = ''; // ###TODO
992992
break;
993993

994-
// TODO: Era
994+
// ###TODO: Era
995995
default:
996996
fv = tm['[['+ p +']]'];
997997
}

src/cldr.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ function expDTComponentsMeta($0, formatObj) {
108108
// day of the month
109109
formatObj.day = $0.length === 2 ? '2-digit' : 'numeric';
110110
return '{day}';
111-
case 'D':
112-
// day of the year
113-
case 'F':
114-
// day of the week
111+
case 'D': // day of the year
112+
case 'F': // day of the week
115113
case 'g':
116114
// 1..n: Modified Julian day
117115
formatObj.day = 'numeric';

src/main.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import IntlPolyfill from "./core.js";
22

33
// hack to export the polyfill as global Intl if needed
4-
if (typeof Intl !== undefined) {
5-
Intl = IntlPolyfill;
6-
IntlPolyfill.__applyLocaleSensitivePrototypes();
4+
if (typeof Intl !== 'undefined') {
5+
try {
6+
Intl = IntlPolyfill;
7+
IntlPolyfill.__applyLocaleSensitivePrototypes();
8+
} catch (e) {
9+
// can be read only property
10+
}
711
}
812

913
export default IntlPolyfill;

tests/noderunner.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ var LIBS = {
55
path: require('path'),
66
vm: require('vm'),
77
},
8-
POLYFILL_PATH = __dirname + '/../dist/Intl.js',
8+
POLYFILL_PATH = LIBS.path.resolve(__dirname + '/../dist/Intl.js'),
99
POLYFILL_CODE = LIBS.fs.readFileSync(POLYFILL_PATH).toString(),
10-
DATA_PATH = __dirname + '/../locale-data/complete.js',
10+
DATA_PATH = LIBS.path.resolve(__dirname + '/../locale-data/complete.js'),
1111
DATA_CODE = LIBS.fs.readFileSync(DATA_PATH).toString(),
12-
TEST_DIR = __dirname + '/test262/pages';
12+
TEST_DIR = LIBS.path.resolve(__dirname + '/test262/pages');
1313

1414

1515
// returns Error if test threw one

0 commit comments

Comments
 (0)