@babel/test262-stream 0.0.0-stage → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/.jshintignore +2 -0
  2. package/.jshintrc +6 -0
  3. package/.travis.yml +5 -0
  4. package/CONTRIBUTING.md +37 -0
  5. package/LICENSE-MICROSOFT.txt +27 -0
  6. package/LICENSE.txt +27 -0
  7. package/README.md +70 -2
  8. package/lib/builder.js +46 -0
  9. package/lib/compile.js +24 -0
  10. package/lib/create-scenarios.js +24 -0
  11. package/lib/index.js +187 -0
  12. package/lib/test-file.js +150 -0
  13. package/package.json +31 -4
  14. package/test/collateral/invalid-missing-harness/fake-test262/test/a-test-file.js +16 -0
  15. package/test/collateral/invalid-version-other-accepted/fake-test262/harness/assert.js +17 -0
  16. package/test/collateral/invalid-version-other-accepted/fake-test262/harness/doneprintHandle.js +6 -0
  17. package/test/collateral/invalid-version-other-accepted/fake-test262/harness/sta.js +12 -0
  18. package/test/collateral/invalid-version-other-accepted/fake-test262/package.json +3 -0
  19. package/test/collateral/invalid-version-other-accepted/fake-test262/test/strict.js +9 -0
  20. package/test/collateral/invalid-version-unsupported/fake-test262/harness/assert.js +17 -0
  21. package/test/collateral/invalid-version-unsupported/fake-test262/harness/doneprintHandle.js +6 -0
  22. package/test/collateral/invalid-version-unsupported/fake-test262/harness/sta.js +12 -0
  23. package/test/collateral/invalid-version-unsupported/fake-test262/package.json +3 -0
  24. package/test/collateral/invalid-version-unsupported/fake-test262/test/strict.js +9 -0
  25. package/test/collateral/valid-default/expected-content/test/asyncNegative_default.js +49 -0
  26. package/test/collateral/valid-default/expected-content/test/asyncNegative_strict_mode.js +50 -0
  27. package/test/collateral/valid-default/expected-content/test/async_default.js +48 -0
  28. package/test/collateral/valid-default/expected-content/test/async_strict_mode.js +49 -0
  29. package/test/collateral/valid-default/expected-content/test/bothStrict_default.js +46 -0
  30. package/test/collateral/valid-default/expected-content/test/bothStrict_strict_mode.js +47 -0
  31. package/test/collateral/valid-default/expected-content/test/error_default.js +39 -0
  32. package/test/collateral/valid-default/expected-content/test/error_strict_mode.js +40 -0
  33. package/test/collateral/valid-default/expected-content/test/module_default.js +37 -0
  34. package/test/collateral/valid-default/expected-content/test/module_strict_mode.js +38 -0
  35. package/test/collateral/valid-default/expected-content/test/negative-empty_default.js +37 -0
  36. package/test/collateral/valid-default/expected-content/test/negative-empty_strict_mode.js +38 -0
  37. package/test/collateral/valid-default/expected-content/test/noStrict_default.js +36 -0
  38. package/test/collateral/valid-default/expected-content/test/rawNoStrict_default.js +14 -0
  39. package/test/collateral/valid-default/expected-content/test/rawStrict_default.js +15 -0
  40. package/test/collateral/valid-default/expected-content/test/strict_strict_mode.js +41 -0
  41. package/test/collateral/valid-default/expected-metadata/test/asyncNegative_default.json +22 -0
  42. package/test/collateral/valid-default/expected-metadata/test/asyncNegative_strict_mode.json +22 -0
  43. package/test/collateral/valid-default/expected-metadata/test/async_default.json +18 -0
  44. package/test/collateral/valid-default/expected-metadata/test/async_strict_mode.json +18 -0
  45. package/test/collateral/valid-default/expected-metadata/test/bothStrict_default.json +24 -0
  46. package/test/collateral/valid-default/expected-metadata/test/bothStrict_strict_mode.json +24 -0
  47. package/test/collateral/valid-default/expected-metadata/test/error_default.json +19 -0
  48. package/test/collateral/valid-default/expected-metadata/test/error_strict_mode.json +19 -0
  49. package/test/collateral/valid-default/expected-metadata/test/module_default.json +17 -0
  50. package/test/collateral/valid-default/expected-metadata/test/module_strict_mode.json +17 -0
  51. package/test/collateral/valid-default/expected-metadata/test/negative-empty_default.json +19 -0
  52. package/test/collateral/valid-default/expected-metadata/test/negative-empty_strict_mode.json +19 -0
  53. package/test/collateral/valid-default/expected-metadata/test/noStrict_default.json +17 -0
  54. package/test/collateral/valid-default/expected-metadata/test/rawNoStrict_default.json +14 -0
  55. package/test/collateral/valid-default/expected-metadata/test/rawStrict_default.json +14 -0
  56. package/test/collateral/valid-default/expected-metadata/test/strict_strict_mode.json +21 -0
  57. package/test/collateral/valid-default/fake-test262/harness/assert.js +17 -0
  58. package/test/collateral/valid-default/fake-test262/harness/doneprintHandle.js +6 -0
  59. package/test/collateral/valid-default/fake-test262/harness/sta.js +12 -0
  60. package/test/collateral/valid-default/fake-test262/test/async.js +10 -0
  61. package/test/collateral/valid-default/fake-test262/test/asyncNegative.js +11 -0
  62. package/test/collateral/valid-default/fake-test262/test/bothStrict.js +15 -0
  63. package/test/collateral/valid-default/fake-test262/test/error.js +8 -0
  64. package/test/collateral/valid-default/fake-test262/test/module.js +6 -0
  65. package/test/collateral/valid-default/fake-test262/test/module_FIXTURE.js +2 -0
  66. package/test/collateral/valid-default/fake-test262/test/negative-empty.js +6 -0
  67. package/test/collateral/valid-default/fake-test262/test/noStrict.js +5 -0
  68. package/test/collateral/valid-default/fake-test262/test/rawNoStrict.js +14 -0
  69. package/test/collateral/valid-default/fake-test262/test/rawStrict.js +15 -0
  70. package/test/collateral/valid-default/fake-test262/test/strict.js +9 -0
  71. package/test/collateral/valid-extra-files/expected-content/test/bothStrict_default.js +46 -0
  72. package/test/collateral/valid-extra-files/expected-content/test/bothStrict_strict_mode.js +47 -0
  73. package/test/collateral/valid-extra-files/expected-metadata/test/bothStrict_default.json +24 -0
  74. package/test/collateral/valid-extra-files/expected-metadata/test/bothStrict_strict_mode.json +24 -0
  75. package/test/collateral/valid-extra-files/fake-test262/harness/assert.js +17 -0
  76. package/test/collateral/valid-extra-files/fake-test262/harness/doneprintHandle.js +6 -0
  77. package/test/collateral/valid-extra-files/fake-test262/harness/sta.js +12 -0
  78. package/test/collateral/valid-extra-files/fake-test262/test/bothStrict.js +15 -0
  79. package/test/collateral/valid-extra-files/fake-test262/test/zzz-0_FIXTURE.js +2 -0
  80. package/test/collateral/valid-extra-files/fake-test262/test/zzz-1_FIXTURE.js +2 -0
  81. package/test/collateral/valid-extra-files/fake-test262/test/zzz-2_FIXTURE.js +2 -0
  82. package/test/collateral/valid-extra-files/fake-test262/test/zzz-3_FIXTURE.js +2 -0
  83. package/test/collateral/valid-extra-files/fake-test262/test/zzz-4_FIXTURE.js +2 -0
  84. package/test/collateral/valid-extra-files/fake-test262/test/zzz-5_FIXTURE.js +2 -0
  85. package/test/collateral/valid-extra-files/fake-test262/test/zzz-6_FIXTURE.js +2 -0
  86. package/test/collateral/valid-extra-files/fake-test262/test/zzz-7_FIXTURE.js +2 -0
  87. package/test/collateral/valid-extra-files/fake-test262/test/zzz-8_FIXTURE.js +2 -0
  88. package/test/collateral/valid-extra-files/fake-test262/test/zzz-9_FIXTURE.txt +2 -0
  89. package/test/collateral/valid-insertionindex-with-copyright/expected-content/test/raw_default.js +15 -0
  90. package/test/collateral/valid-insertionindex-with-copyright/expected-content/test/runtime_default.js +38 -0
  91. package/test/collateral/valid-insertionindex-with-copyright/expected-content/test/runtime_strict_mode.js +39 -0
  92. package/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/raw_default.json +14 -0
  93. package/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/runtime_default.json +15 -0
  94. package/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/runtime_strict_mode.json +15 -0
  95. package/test/collateral/valid-insertionindex-with-copyright/fake-test262/harness/assert.js +17 -0
  96. package/test/collateral/valid-insertionindex-with-copyright/fake-test262/harness/sta.js +12 -0
  97. package/test/collateral/valid-insertionindex-with-copyright/fake-test262/test/raw.js +15 -0
  98. package/test/collateral/valid-insertionindex-with-copyright/fake-test262/test/runtime.js +7 -0
  99. package/test/collateral/valid-omit-runtime/expected-content/test/asyncNegative_default.js +11 -0
  100. package/test/collateral/valid-omit-runtime/expected-content/test/asyncNegative_strict_mode.js +12 -0
  101. package/test/collateral/valid-omit-runtime/expected-content/test/async_default.js +10 -0
  102. package/test/collateral/valid-omit-runtime/expected-content/test/async_strict_mode.js +11 -0
  103. package/test/collateral/valid-omit-runtime/expected-content/test/bothStrict_default.js +15 -0
  104. package/test/collateral/valid-omit-runtime/expected-content/test/bothStrict_strict_mode.js +16 -0
  105. package/test/collateral/valid-omit-runtime/expected-content/test/error_default.js +8 -0
  106. package/test/collateral/valid-omit-runtime/expected-content/test/error_strict_mode.js +9 -0
  107. package/test/collateral/valid-omit-runtime/expected-content/test/module_default.js +6 -0
  108. package/test/collateral/valid-omit-runtime/expected-content/test/module_strict_mode.js +7 -0
  109. package/test/collateral/valid-omit-runtime/expected-content/test/negative-empty_default.js +6 -0
  110. package/test/collateral/valid-omit-runtime/expected-content/test/negative-empty_strict_mode.js +7 -0
  111. package/test/collateral/valid-omit-runtime/expected-content/test/noStrict_default.js +5 -0
  112. package/test/collateral/valid-omit-runtime/expected-content/test/rawNoStrict_default.js +14 -0
  113. package/test/collateral/valid-omit-runtime/expected-content/test/rawStrict_default.js +15 -0
  114. package/test/collateral/valid-omit-runtime/expected-content/test/strict_strict_mode.js +10 -0
  115. package/test/collateral/valid-omit-runtime/expected-metadata/test/asyncNegative_default.json +18 -0
  116. package/test/collateral/valid-omit-runtime/expected-metadata/test/asyncNegative_strict_mode.json +18 -0
  117. package/test/collateral/valid-omit-runtime/expected-metadata/test/async_default.json +14 -0
  118. package/test/collateral/valid-omit-runtime/expected-metadata/test/async_strict_mode.json +14 -0
  119. package/test/collateral/valid-omit-runtime/expected-metadata/test/bothStrict_default.json +21 -0
  120. package/test/collateral/valid-omit-runtime/expected-metadata/test/bothStrict_strict_mode.json +21 -0
  121. package/test/collateral/valid-omit-runtime/expected-metadata/test/error_default.json +16 -0
  122. package/test/collateral/valid-omit-runtime/expected-metadata/test/error_strict_mode.json +16 -0
  123. package/test/collateral/valid-omit-runtime/expected-metadata/test/module_default.json +14 -0
  124. package/test/collateral/valid-omit-runtime/expected-metadata/test/module_strict_mode.json +14 -0
  125. package/test/collateral/valid-omit-runtime/expected-metadata/test/negative-empty_default.json +16 -0
  126. package/test/collateral/valid-omit-runtime/expected-metadata/test/negative-empty_strict_mode.json +16 -0
  127. package/test/collateral/valid-omit-runtime/expected-metadata/test/noStrict_default.json +14 -0
  128. package/test/collateral/valid-omit-runtime/expected-metadata/test/rawNoStrict_default.json +14 -0
  129. package/test/collateral/valid-omit-runtime/expected-metadata/test/rawStrict_default.json +14 -0
  130. package/test/collateral/valid-omit-runtime/expected-metadata/test/strict_strict_mode.json +18 -0
  131. package/test/collateral/valid-omit-runtime/fake-test262/harness/assert.js +17 -0
  132. package/test/collateral/valid-omit-runtime/fake-test262/harness/doneprintHandle.js +6 -0
  133. package/test/collateral/valid-omit-runtime/fake-test262/harness/sta.js +12 -0
  134. package/test/collateral/valid-omit-runtime/fake-test262/test/async.js +10 -0
  135. package/test/collateral/valid-omit-runtime/fake-test262/test/asyncNegative.js +11 -0
  136. package/test/collateral/valid-omit-runtime/fake-test262/test/bothStrict.js +15 -0
  137. package/test/collateral/valid-omit-runtime/fake-test262/test/error.js +8 -0
  138. package/test/collateral/valid-omit-runtime/fake-test262/test/module.js +6 -0
  139. package/test/collateral/valid-omit-runtime/fake-test262/test/module_FIXTURE.js +2 -0
  140. package/test/collateral/valid-omit-runtime/fake-test262/test/negative-empty.js +6 -0
  141. package/test/collateral/valid-omit-runtime/fake-test262/test/noStrict.js +5 -0
  142. package/test/collateral/valid-omit-runtime/fake-test262/test/rawNoStrict.js +14 -0
  143. package/test/collateral/valid-omit-runtime/fake-test262/test/rawStrict.js +15 -0
  144. package/test/collateral/valid-omit-runtime/fake-test262/test/strict.js +9 -0
  145. package/test/collateral/valid-version-ignored/expected-content/test/strict_strict_mode.js +41 -0
  146. package/test/collateral/valid-version-ignored/expected-metadata/test/strict_strict_mode.json +21 -0
  147. package/test/collateral/valid-version-ignored/fake-test262/harness/assert.js +17 -0
  148. package/test/collateral/valid-version-ignored/fake-test262/harness/doneprintHandle.js +6 -0
  149. package/test/collateral/valid-version-ignored/fake-test262/harness/sta.js +12 -0
  150. package/test/collateral/valid-version-ignored/fake-test262/package.json +3 -0
  151. package/test/collateral/valid-version-ignored/fake-test262/test/strict.js +9 -0
  152. package/test/collateral/valid-version-supported/expected-content/test/strict_strict_mode.js +41 -0
  153. package/test/collateral/valid-version-supported/expected-metadata/test/strict_strict_mode.json +21 -0
  154. package/test/collateral/valid-version-supported/fake-test262/harness/assert.js +17 -0
  155. package/test/collateral/valid-version-supported/fake-test262/harness/doneprintHandle.js +6 -0
  156. package/test/collateral/valid-version-supported/fake-test262/harness/sta.js +12 -0
  157. package/test/collateral/valid-version-supported/fake-test262/package.json +3 -0
  158. package/test/collateral/valid-version-supported/fake-test262/test/strict.js +9 -0
  159. package/test/collateral/valid-with-hashbang/expected-content/test/missing-raw-flag_default.js +44 -0
  160. package/test/collateral/valid-with-hashbang/expected-content/test/missing-raw-flag_strict_mode.js +45 -0
  161. package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls-and-license-on-same-line_default.js +20 -0
  162. package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls-multiline-block_default.js +18 -0
  163. package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls_default.js +17 -0
  164. package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps-and-license-on-same-line_default.js +20 -0
  165. package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps-multiline-block_default.js +18 -0
  166. package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps_default.js +17 -0
  167. package/test/collateral/valid-with-hashbang/expected-content/test/rawWithLicense_default.js +21 -0
  168. package/test/collateral/valid-with-hashbang/expected-content/test/raw_default.js +17 -0
  169. package/test/collateral/valid-with-hashbang/expected-metadata/test/missing-raw-flag_default.json +22 -0
  170. package/test/collateral/valid-with-hashbang/expected-metadata/test/missing-raw-flag_strict_mode.json +22 -0
  171. package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls-and-license-on-same-line_default.json +21 -0
  172. package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls-multiline-block_default.json +21 -0
  173. package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls_default.json +21 -0
  174. package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps-and-license-on-same-line_default.json +21 -0
  175. package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps-multiline-block_default.json +21 -0
  176. package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps_default.json +21 -0
  177. package/test/collateral/valid-with-hashbang/expected-metadata/test/rawWithLicense_default.json +21 -0
  178. package/test/collateral/valid-with-hashbang/expected-metadata/test/raw_default.json +21 -0
  179. package/test/collateral/valid-with-hashbang/fake-test262/harness/assert.js +17 -0
  180. package/test/collateral/valid-with-hashbang/fake-test262/harness/doneprintHandle.js +6 -0
  181. package/test/collateral/valid-with-hashbang/fake-test262/harness/sta.js +12 -0
  182. package/test/collateral/valid-with-hashbang/fake-test262/test/missing-raw-flag.js +13 -0
  183. package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls-and-license-on-same-line.js +20 -0
  184. package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls-multiline-block.js +18 -0
  185. package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls.js +17 -0
  186. package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps-and-license-on-same-line.js +20 -0
  187. package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps-multiline-block.js +18 -0
  188. package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps.js +17 -0
  189. package/test/collateral/valid-with-hashbang/fake-test262/test/raw.js +17 -0
  190. package/test/collateral/valid-with-hashbang/fake-test262/test/rawWithLicense.js +21 -0
  191. package/test/collateral/valid-with-includes/custom-includes/assert.js +17 -0
  192. package/test/collateral/valid-with-includes/custom-includes/doneprintHandle.js +9 -0
  193. package/test/collateral/valid-with-includes/custom-includes/sta.js +13 -0
  194. package/test/collateral/valid-with-includes/expected-content/test/async_default.js +52 -0
  195. package/test/collateral/valid-with-includes/expected-content/test/async_strict_mode.js +53 -0
  196. package/test/collateral/valid-with-includes/expected-content/test/bothStrict_default.js +47 -0
  197. package/test/collateral/valid-with-includes/expected-content/test/bothStrict_strict_mode.js +48 -0
  198. package/test/collateral/valid-with-includes/expected-metadata/test/async_default.json +18 -0
  199. package/test/collateral/valid-with-includes/expected-metadata/test/async_strict_mode.json +18 -0
  200. package/test/collateral/valid-with-includes/expected-metadata/test/bothStrict_default.json +24 -0
  201. package/test/collateral/valid-with-includes/expected-metadata/test/bothStrict_strict_mode.json +24 -0
  202. package/test/collateral/valid-with-includes/fake-test262/harness/assert.js +17 -0
  203. package/test/collateral/valid-with-includes/fake-test262/harness/doneprintHandle.js +6 -0
  204. package/test/collateral/valid-with-includes/fake-test262/test/async.js +10 -0
  205. package/test/collateral/valid-with-includes/fake-test262/test/bothStrict.js +15 -0
  206. package/test/collateral/valid-with-paths/expected-content/test/async/asyncNegative_default.js +49 -0
  207. package/test/collateral/valid-with-paths/expected-content/test/async/asyncNegative_strict_mode.js +50 -0
  208. package/test/collateral/valid-with-paths/expected-content/test/async/async_default.js +48 -0
  209. package/test/collateral/valid-with-paths/expected-content/test/async/async_strict_mode.js +49 -0
  210. package/test/collateral/valid-with-paths/expected-content/test/bothStrict_default.js +46 -0
  211. package/test/collateral/valid-with-paths/expected-content/test/bothStrict_strict_mode.js +47 -0
  212. package/test/collateral/valid-with-paths/expected-content/test/strict/no/noStrict_default.js +36 -0
  213. package/test/collateral/valid-with-paths/expected-content/test/strict/no/rawNoStrict_default.js +14 -0
  214. package/test/collateral/valid-with-paths/expected-metadata/test/async/asyncNegative_default.json +22 -0
  215. package/test/collateral/valid-with-paths/expected-metadata/test/async/asyncNegative_strict_mode.json +22 -0
  216. package/test/collateral/valid-with-paths/expected-metadata/test/async/async_default.json +18 -0
  217. package/test/collateral/valid-with-paths/expected-metadata/test/async/async_strict_mode.json +18 -0
  218. package/test/collateral/valid-with-paths/expected-metadata/test/bothStrict_default.json +24 -0
  219. package/test/collateral/valid-with-paths/expected-metadata/test/bothStrict_strict_mode.json +24 -0
  220. package/test/collateral/valid-with-paths/expected-metadata/test/strict/no/noStrict_default.json +17 -0
  221. package/test/collateral/valid-with-paths/expected-metadata/test/strict/no/rawNoStrict_default.json +14 -0
  222. package/test/collateral/valid-with-paths/fake-test262/harness/assert.js +17 -0
  223. package/test/collateral/valid-with-paths/fake-test262/harness/doneprintHandle.js +6 -0
  224. package/test/collateral/valid-with-paths/fake-test262/harness/sta.js +12 -0
  225. package/test/collateral/valid-with-paths/fake-test262/test/async/async.js +10 -0
  226. package/test/collateral/valid-with-paths/fake-test262/test/async/asyncNegative.js +11 -0
  227. package/test/collateral/valid-with-paths/fake-test262/test/bothStrict.js +15 -0
  228. package/test/collateral/valid-with-paths/fake-test262/test/error.js +8 -0
  229. package/test/collateral/valid-with-paths/fake-test262/test/negative-empty.js +6 -0
  230. package/test/collateral/valid-with-paths/fake-test262/test/strict/no/noStrict.js +5 -0
  231. package/test/collateral/valid-with-paths/fake-test262/test/strict/no/rawNoStrict.js +14 -0
  232. package/test/collateral/valid-with-paths/fake-test262/test/strict/rawStrict.js +15 -0
  233. package/test/collateral/valid-with-paths/fake-test262/test/strict/strict.js +9 -0
  234. package/test/test.js +319 -0
@@ -0,0 +1,18 @@
1
+ {
2
+ "file": "test/async/async.js",
3
+ "contents": "(The value of this property is over-sized, so it is validated independently.)",
4
+ "attrs": {
5
+ "description": "Async test",
6
+ "flags": {
7
+ "async": true
8
+ },
9
+ "includes": [
10
+ "assert.js",
11
+ "sta.js",
12
+ "doneprintHandle.js"
13
+ ]
14
+ },
15
+ "copyright": "",
16
+ "scenario": "default",
17
+ "insertionIndex": 564
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "file": "test/async/async.js",
3
+ "contents": "(The value of this property is over-sized, so it is validated independently.)",
4
+ "attrs": {
5
+ "description": "Async test (Strict Mode)",
6
+ "flags": {
7
+ "async": true
8
+ },
9
+ "includes": [
10
+ "assert.js",
11
+ "sta.js",
12
+ "doneprintHandle.js"
13
+ ]
14
+ },
15
+ "copyright": "",
16
+ "scenario": "strict mode",
17
+ "insertionIndex": 578
18
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "file": "test/bothStrict.js",
3
+ "contents": "(The value of this property is over-sized, so it is validated independently.)",
4
+ "attrs": {
5
+ "description": "Should test in both modes",
6
+ "features": [
7
+ "var",
8
+ "try",
9
+ "if"
10
+ ],
11
+ "negative": {
12
+ "phase": "runtime",
13
+ "type": "ReferenceError"
14
+ },
15
+ "flags": {},
16
+ "includes": [
17
+ "assert.js",
18
+ "sta.js"
19
+ ]
20
+ },
21
+ "copyright": "",
22
+ "scenario": "default",
23
+ "insertionIndex": 439
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "file": "test/bothStrict.js",
3
+ "contents": "(The value of this property is over-sized, so it is validated independently.)",
4
+ "attrs": {
5
+ "description": "Should test in both modes (Strict Mode)",
6
+ "features": [
7
+ "var",
8
+ "try",
9
+ "if"
10
+ ],
11
+ "negative": {
12
+ "phase": "runtime",
13
+ "type": "ReferenceError"
14
+ },
15
+ "flags": {},
16
+ "includes": [
17
+ "assert.js",
18
+ "sta.js"
19
+ ]
20
+ },
21
+ "copyright": "",
22
+ "scenario": "strict mode",
23
+ "insertionIndex": 453
24
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "file": "test/strict/no/noStrict.js",
3
+ "contents": "(The value of this property is over-sized, so it is validated independently.)",
4
+ "attrs": {
5
+ "description": "Should not test in strict mode",
6
+ "flags": {
7
+ "noStrict": true
8
+ },
9
+ "includes": [
10
+ "assert.js",
11
+ "sta.js"
12
+ ]
13
+ },
14
+ "copyright": "",
15
+ "scenario": "default",
16
+ "insertionIndex": 439
17
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "file": "test/strict/no/rawNoStrict.js",
3
+ "contents": "(The value of this property is over-sized, so it is validated independently.)",
4
+ "attrs": {
5
+ "description": "Should not test in strict mode",
6
+ "flags": {
7
+ "raw": true
8
+ },
9
+ "includes": []
10
+ },
11
+ "copyright": "",
12
+ "scenario": "default",
13
+ "insertionIndex": -1
14
+ }
@@ -0,0 +1,17 @@
1
+ // This is assert.js
2
+
3
+ 'It has some contents';
4
+
5
+ /* that
6
+ *
7
+ * should
8
+
9
+ * not
10
+ */
11
+
12
+ `be ${ "modified" }`;
13
+
14
+ var including, trailing;
15
+ whitespace: ;
16
+
17
+ void "end of assert.js";
@@ -0,0 +1,6 @@
1
+ function $DONE(){
2
+ if(!arguments[0])
3
+ print('Test262:AsyncTestComplete');
4
+ else
5
+ print('Error: ' + arguments[0]);
6
+ }
@@ -0,0 +1,12 @@
1
+ function Test262Error(message) {
2
+ this.message = message || "";
3
+ }
4
+
5
+ Test262Error.prototype.toString = function () {
6
+ return "Test262Error: " + this.message;
7
+ };
8
+
9
+ var $ERROR;
10
+ $ERROR = function $ERROR(message) {
11
+ throw new Test262Error(message);
12
+ };
@@ -0,0 +1,10 @@
1
+ /*---
2
+ description: Async test
3
+ flags: [async]
4
+ ---*/
5
+
6
+ var p = new Promise(function(resolve) {
7
+ resolve();
8
+ });
9
+
10
+ p.then($DONE, $DONE);
@@ -0,0 +1,11 @@
1
+ /*---
2
+ description: Async negative test
3
+ negative:
4
+ phase: runtime
5
+ type: RangeError
6
+ flags: [async]
7
+ ---*/
8
+
9
+ setTimeout(function() {
10
+ $DONE(new RangeError());
11
+ }, 1000);
@@ -0,0 +1,15 @@
1
+ /*---
2
+ description: Should test in both modes
3
+ features: [var, try, if]
4
+ negative:
5
+ phase: runtime
6
+ type: ReferenceError
7
+ ---*/
8
+ var strict;
9
+ try { x = 1; strict = false;} catch(e) { strict = true }
10
+
11
+ if(strict) {
12
+ y = 1;
13
+ } else {
14
+ throw new ReferenceError();
15
+ }
@@ -0,0 +1,8 @@
1
+ /*---
2
+ description: Fails by calling $ERROR
3
+ negative:
4
+ phase: runtime
5
+ type: Test262Error
6
+ ---*/
7
+
8
+ $ERROR('failure message');
@@ -0,0 +1,6 @@
1
+ /*---
2
+ description: Should report the expected error indicated by the "negative" frontmatter
3
+ negative:
4
+ phase: runtime
5
+ type: Test262Error
6
+ ---*/
@@ -0,0 +1,5 @@
1
+ /*---
2
+ description: Should not test in strict mode
3
+ flags: [noStrict]
4
+ ---*/
5
+ x = 5;
@@ -0,0 +1,14 @@
1
+ /*---
2
+ description: Should not test in strict mode
3
+ flags: [raw]
4
+ ---*/
5
+ var seemsStrict;
6
+ try {
7
+ x = 1;
8
+ } catch (err) {
9
+ seemsStrict = err.constructor === ReferenceError;
10
+ }
11
+
12
+ if (seemsStrict) {
13
+ throw new Error('Script erroneously interpreted in strict mode.');
14
+ }
@@ -0,0 +1,15 @@
1
+ /*---
2
+ description: Should not test in strict mode (but allow strict mode to be enabled)
3
+ flags: [raw]
4
+ ---*/
5
+ 'use strict';
6
+ var seemsStrict;
7
+ try {
8
+ x = 1;
9
+ } catch (err) {
10
+ seemsStrict = err.constructor === ReferenceError;
11
+ }
12
+
13
+ if (!seemsStrict) {
14
+ throw new Error('Script erroneously not interpreted in strict mode.');
15
+ }
@@ -0,0 +1,9 @@
1
+ /*---
2
+ description: Should not test in sloppy mode
3
+ flags: [onlyStrict]
4
+ negative:
5
+ phase: runtime
6
+ type: ReferenceError
7
+ ---*/
8
+ x = 5;
9
+ $ERROR('Not in strict mode');
package/test/test.js ADDED
@@ -0,0 +1,319 @@
1
+ 'use strict';
2
+ const fs = require('fs');
3
+ const mkdirp = require('mkdirp');
4
+ const path = require('path');
5
+ const rimraf = require('rimraf');
6
+ const tape = require('tape');
7
+
8
+ const TestStream = require('..');
9
+ const scenarios = /^(strict mode|default)$/;
10
+
11
+ const RECORDING = !!process.env.RECORD;
12
+
13
+ // Properties to exclude when validating metadata. The values are
14
+ // inconsequential; they have been selected to aid in discoverability in the
15
+ // programatically-generated "expectations" files.
16
+ const blankOut = {
17
+ contents: '(The value of this property is over-sized, so it is validated independently.)'
18
+ };
19
+
20
+ function makeDataHandler(t, ids, fixtureDir) {
21
+ const test262Dir = path.join(fixtureDir, 'fake-test262');
22
+ const expectedContentDir = path.join(fixtureDir, 'expected-content');
23
+ const expectedMetadataDir = path.join(fixtureDir, 'expected-metadata');
24
+
25
+ if (RECORDING) {
26
+ rimraf.sync(expectedContentDir);
27
+ rimraf.sync(expectedMetadataDir);
28
+ }
29
+
30
+ return (test) => {
31
+
32
+ if (typeof test !== 'object' || test === null) {
33
+ t.ok(false, 'Emits object values');
34
+ return;
35
+ }
36
+
37
+ const actualContents = test.contents;
38
+ const actualMetadata = Object.assign({}, test, blankOut);
39
+
40
+ if (!fs.existsSync(path.join(test262Dir, test.file))) {
41
+ t.ok(false, 'Source file does not exist: ' + test.file);
42
+ return;
43
+ }
44
+
45
+ // `RegExp.prototype.test` acceptes `undefined`, so an explicit type
46
+ // check is necessary.
47
+ t.equal(typeof test.scenario, 'string', '`scenario` property is a string value');
48
+ t.ok(scenarios.test(test.scenario), '`scenario` property is a valid value');
49
+
50
+ const id = test.file.replace(/\.js$/, '_' + test.scenario.replace(' ', '_'));
51
+ const expectedContentFile = path.join(expectedContentDir, id) + '.js';
52
+ const expectedMetadataFile = path.join(expectedMetadataDir, id) + '.json';
53
+
54
+ t.not(ids.indexOf(id) === -1, 'Emits each test exactly once');
55
+ ids.push(id);
56
+
57
+ if (RECORDING) {
58
+ mkdirp.sync(path.dirname(expectedContentFile));
59
+ fs.writeFileSync(expectedContentFile, actualContents, 'utf-8');
60
+ mkdirp.sync(path.dirname(expectedMetadataFile));
61
+ fs.writeFileSync(expectedMetadataFile, JSON.stringify(actualMetadata, null, 2), 'utf-8');
62
+ return;
63
+ }
64
+
65
+ if (!fs.existsSync(expectedContentFile)) {
66
+ t.ok(false, 'Expected content file not found: ' + expectedContentFile);
67
+ return;
68
+ }
69
+
70
+ if (!fs.existsSync(expectedMetadataFile)) {
71
+ t.ok(false, 'Expected metadata file not found: ' + expectedMetadataFile);
72
+ return;
73
+ }
74
+
75
+ t.deepEqual(actualContents, fs.readFileSync(expectedContentFile, 'utf-8'));
76
+ t.deepEqual(actualMetadata, require(expectedMetadataFile));
77
+ };
78
+ }
79
+
80
+ tape('valid source directory', t => {
81
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-default');
82
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'));
83
+ const ids = [];
84
+
85
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
86
+
87
+ stream.on('error', (error) => {
88
+ t.ok(error);
89
+ t.end(error);
90
+ });
91
+
92
+ stream.on('end', () => {
93
+ t.equal(ids.length, 16, 'Reports every available test');
94
+ t.end();
95
+ });
96
+ });
97
+
98
+ tape('valid source directory (with paths)', t => {
99
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-with-paths');
100
+ const paths = ['test/bothStrict.js', 'test/strict/no', 'test/async'];
101
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'), { paths });
102
+ const ids = [];
103
+
104
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
105
+
106
+ stream.on('error', (error) => {
107
+ t.ok(error);
108
+ t.end(error);
109
+ });
110
+
111
+ stream.on('end', () => {
112
+ t.equal(ids.length, 8, 'Reports every available test');
113
+ t.end();
114
+ });
115
+ });
116
+
117
+ tape('valid source directory (with custom includes)', t => {
118
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-with-includes');
119
+ const includesDir = path.join(fixtureDir, 'custom-includes');
120
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'), { includesDir });
121
+ const ids = [];
122
+
123
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
124
+
125
+ stream.on('error', (error) => {
126
+ t.ok(error);
127
+ t.end(error);
128
+ });
129
+
130
+ stream.on('end', () => {
131
+ t.equal(ids.length, 4, 'Reports every available test');
132
+ t.end();
133
+ });
134
+ });
135
+
136
+ tape('missing `assert.js`', t => {
137
+ const stream = new TestStream(path.join(__dirname, 'collateral', 'invalid-missing-harness'));
138
+
139
+ stream.on('data', () => {
140
+ t.end(new Error('Stream should not emit a `data` event'));
141
+ });
142
+
143
+ stream.on('end', () => {
144
+ t.end(new Error('Stream should not emit an `end` event'));
145
+ });
146
+
147
+ stream.on('error', (error) => {
148
+ t.ok(error, '`error` event should be published with an object');
149
+ t.end();
150
+ });
151
+ });
152
+
153
+ tape.skip('non-existent source directory', t => {
154
+ const stream = new TestStream(path.join(__dirname, 'collateral', 'this-directory-does-not-exist'));
155
+
156
+ stream.on('data', () => {
157
+ t.end(new Error('Stream should not emit a `data` event'));
158
+ });
159
+
160
+ stream.on('end', () => {
161
+ t.end(new Error('Stream should not emit an `end` event'));
162
+ });
163
+
164
+ stream.on('error', (error) => {
165
+ t.ok(error, '`error` event should be published with an object');
166
+ t.end();
167
+ });
168
+ });
169
+
170
+ tape('valid source directory (with a supported version)', t => {
171
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-version-supported');
172
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'));
173
+ const ids = [];
174
+
175
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
176
+
177
+ stream.on('error', (error) => {
178
+ t.ok(error);
179
+ t.end(error);
180
+ });
181
+
182
+ stream.on('end', () => {
183
+ t.equal(ids.length, 1, 'Reports every available test');
184
+ t.end();
185
+ });
186
+ });
187
+
188
+ tape('invalid source directory (with an unsupported version)', t => {
189
+ const fixtureDir = path.join(__dirname, 'collateral', 'invalid-version-unsupported');
190
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'));
191
+
192
+ stream.on('data', () => {
193
+ t.end(new Error('Stream should not emit a `data` event'));
194
+ });
195
+
196
+ stream.on('end', () => {
197
+ t.end(new Error('Stream should not emit an `end` event'));
198
+ });
199
+
200
+ stream.on('error', (error) => {
201
+ t.ok(error, '`error` event should be published with an object');
202
+ t.end();
203
+ });
204
+ });
205
+
206
+ tape('invalid source directory (accepting newer version)', t => {
207
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-version-ignored');
208
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'), {
209
+ acceptVersion: '999.0.0'
210
+ });
211
+ const ids = [];
212
+
213
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
214
+
215
+ stream.on('error', (error) => {
216
+ t.ok(error);
217
+ t.end(error);
218
+ });
219
+
220
+ stream.on('end', () => {
221
+ t.equal(ids.length, 1, 'Reports every available test');
222
+ t.end();
223
+ });
224
+ });
225
+
226
+ tape('invalid source directory (with a version that differs from the "accepted" versoin)', t => {
227
+ const fixtureDir = path.join(__dirname, 'collateral', 'invalid-version-other-accepted');
228
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'), {
229
+ acceptVersion: '3.0.1'
230
+ });
231
+
232
+ stream.on('data', () => {
233
+ t.end(new Error('Stream should not emit a `data` event'));
234
+ });
235
+
236
+ stream.on('end', () => {
237
+ t.end(new Error('Stream should not emit an `end` event'));
238
+ });
239
+
240
+ stream.on('error', (error) => {
241
+ t.ok(error, '`error` event should be published with an object');
242
+ t.end();
243
+ });
244
+ });
245
+
246
+ tape('omit runtime', t => {
247
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-omit-runtime');
248
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'), {
249
+ omitRuntime: true
250
+ });
251
+ const ids = [];
252
+
253
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
254
+
255
+ stream.on('error', (error) => {
256
+ t.ok(error);
257
+ t.end(error);
258
+ });
259
+
260
+ stream.on('end', () => {
261
+ t.equal(ids.length, 16, 'Reports every available test');
262
+ t.end();
263
+ });
264
+ });
265
+
266
+ tape('completion detection when final files visited are not tests', t => {
267
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-extra-files');
268
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'));
269
+ const ids = [];
270
+
271
+ global.mike = true;
272
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
273
+
274
+ stream.on('error', (error) => {
275
+ t.ok(error);
276
+ t.end(error);
277
+ });
278
+
279
+ stream.on('end', () => {
280
+ t.equal(ids.length, 2, 'Reports every available test');
281
+ t.end();
282
+ });
283
+ });
284
+
285
+ tape('valid source directory (with hashbang tests)', t => {
286
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-with-hashbang');
287
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'));
288
+ const ids = [];
289
+
290
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
291
+
292
+ stream.on('error', (error) => {
293
+ t.ok(error);
294
+ t.end(error);
295
+ });
296
+
297
+ stream.on('end', () => {
298
+ t.equal(ids.length, 10, 'Reports every available test');
299
+ t.end();
300
+ });
301
+ });
302
+
303
+ tape('copyright and insertionIndex integrity', t => {
304
+ const fixtureDir = path.join(__dirname, 'collateral', 'valid-insertionindex-with-copyright');
305
+ const stream = new TestStream(path.join(fixtureDir, 'fake-test262'));
306
+ const ids = [];
307
+
308
+ stream.on('data', makeDataHandler(t, ids, fixtureDir));
309
+
310
+ stream.on('error', (error) => {
311
+ t.ok(error);
312
+ t.end(error);
313
+ });
314
+
315
+ stream.on('end', () => {
316
+ t.equal(ids.length, 3, 'Reports every available test');
317
+ t.end();
318
+ });
319
+ });