@babel/test262-stream 1.4.0 → 2.0.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.
- package/LICENSE-BOCOUP.txt +27 -0
- package/LICENSE.txt +1 -1
- package/README.md +11 -1
- package/lib/builder.js +50 -15
- package/lib/compile.js +14 -11
- package/lib/create-scenarios.js +41 -10
- package/lib/index.d.ts +137 -0
- package/lib/index.js +202 -58
- package/lib/test-file.js +34 -11
- package/package.json +18 -9
- package/.jshintignore +0 -2
- package/.jshintrc +0 -6
- package/.travis.yml +0 -5
- package/CONTRIBUTING.md +0 -37
- package/test/collateral/invalid-missing-harness/fake-test262/test/a-test-file.js +0 -16
- package/test/collateral/invalid-version-other-accepted/fake-test262/harness/assert.js +0 -17
- package/test/collateral/invalid-version-other-accepted/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/invalid-version-other-accepted/fake-test262/harness/sta.js +0 -12
- package/test/collateral/invalid-version-other-accepted/fake-test262/package.json +0 -3
- package/test/collateral/invalid-version-other-accepted/fake-test262/test/strict.js +0 -9
- package/test/collateral/invalid-version-unsupported/fake-test262/harness/assert.js +0 -17
- package/test/collateral/invalid-version-unsupported/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/invalid-version-unsupported/fake-test262/harness/sta.js +0 -12
- package/test/collateral/invalid-version-unsupported/fake-test262/package.json +0 -3
- package/test/collateral/invalid-version-unsupported/fake-test262/test/strict.js +0 -9
- package/test/collateral/valid-default/expected-content/test/asyncNegative_default.js +0 -49
- package/test/collateral/valid-default/expected-content/test/asyncNegative_strict_mode.js +0 -50
- package/test/collateral/valid-default/expected-content/test/async_default.js +0 -48
- package/test/collateral/valid-default/expected-content/test/async_strict_mode.js +0 -49
- package/test/collateral/valid-default/expected-content/test/bothStrict_default.js +0 -46
- package/test/collateral/valid-default/expected-content/test/bothStrict_strict_mode.js +0 -47
- package/test/collateral/valid-default/expected-content/test/error_default.js +0 -39
- package/test/collateral/valid-default/expected-content/test/error_strict_mode.js +0 -40
- package/test/collateral/valid-default/expected-content/test/module_default.js +0 -37
- package/test/collateral/valid-default/expected-content/test/module_strict_mode.js +0 -38
- package/test/collateral/valid-default/expected-content/test/negative-empty_default.js +0 -37
- package/test/collateral/valid-default/expected-content/test/negative-empty_strict_mode.js +0 -38
- package/test/collateral/valid-default/expected-content/test/noStrict_default.js +0 -36
- package/test/collateral/valid-default/expected-content/test/rawNoStrict_default.js +0 -14
- package/test/collateral/valid-default/expected-content/test/rawStrict_default.js +0 -15
- package/test/collateral/valid-default/expected-content/test/strict_strict_mode.js +0 -41
- package/test/collateral/valid-default/expected-metadata/test/asyncNegative_default.json +0 -22
- package/test/collateral/valid-default/expected-metadata/test/asyncNegative_strict_mode.json +0 -22
- package/test/collateral/valid-default/expected-metadata/test/async_default.json +0 -18
- package/test/collateral/valid-default/expected-metadata/test/async_strict_mode.json +0 -18
- package/test/collateral/valid-default/expected-metadata/test/bothStrict_default.json +0 -24
- package/test/collateral/valid-default/expected-metadata/test/bothStrict_strict_mode.json +0 -24
- package/test/collateral/valid-default/expected-metadata/test/error_default.json +0 -19
- package/test/collateral/valid-default/expected-metadata/test/error_strict_mode.json +0 -19
- package/test/collateral/valid-default/expected-metadata/test/module_default.json +0 -17
- package/test/collateral/valid-default/expected-metadata/test/module_strict_mode.json +0 -17
- package/test/collateral/valid-default/expected-metadata/test/negative-empty_default.json +0 -19
- package/test/collateral/valid-default/expected-metadata/test/negative-empty_strict_mode.json +0 -19
- package/test/collateral/valid-default/expected-metadata/test/noStrict_default.json +0 -17
- package/test/collateral/valid-default/expected-metadata/test/rawNoStrict_default.json +0 -14
- package/test/collateral/valid-default/expected-metadata/test/rawStrict_default.json +0 -14
- package/test/collateral/valid-default/expected-metadata/test/strict_strict_mode.json +0 -21
- package/test/collateral/valid-default/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-default/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-default/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-default/fake-test262/test/async.js +0 -10
- package/test/collateral/valid-default/fake-test262/test/asyncNegative.js +0 -11
- package/test/collateral/valid-default/fake-test262/test/bothStrict.js +0 -15
- package/test/collateral/valid-default/fake-test262/test/error.js +0 -8
- package/test/collateral/valid-default/fake-test262/test/module.js +0 -6
- package/test/collateral/valid-default/fake-test262/test/module_FIXTURE.js +0 -2
- package/test/collateral/valid-default/fake-test262/test/negative-empty.js +0 -6
- package/test/collateral/valid-default/fake-test262/test/noStrict.js +0 -5
- package/test/collateral/valid-default/fake-test262/test/rawNoStrict.js +0 -14
- package/test/collateral/valid-default/fake-test262/test/rawStrict.js +0 -15
- package/test/collateral/valid-default/fake-test262/test/strict.js +0 -9
- package/test/collateral/valid-extra-files/expected-content/test/bothStrict_default.js +0 -46
- package/test/collateral/valid-extra-files/expected-content/test/bothStrict_strict_mode.js +0 -47
- package/test/collateral/valid-extra-files/expected-metadata/test/bothStrict_default.json +0 -24
- package/test/collateral/valid-extra-files/expected-metadata/test/bothStrict_strict_mode.json +0 -24
- package/test/collateral/valid-extra-files/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-extra-files/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-extra-files/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-extra-files/fake-test262/test/bothStrict.js +0 -15
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-0_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-1_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-2_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-3_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-4_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-5_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-6_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-7_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-8_FIXTURE.js +0 -2
- package/test/collateral/valid-extra-files/fake-test262/test/zzz-9_FIXTURE.txt +0 -2
- package/test/collateral/valid-insertionindex-with-copyright/expected-content/test/raw_default.js +0 -15
- package/test/collateral/valid-insertionindex-with-copyright/expected-content/test/runtime_default.js +0 -38
- package/test/collateral/valid-insertionindex-with-copyright/expected-content/test/runtime_strict_mode.js +0 -39
- package/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/raw_default.json +0 -14
- package/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/runtime_default.json +0 -15
- package/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/runtime_strict_mode.json +0 -15
- package/test/collateral/valid-insertionindex-with-copyright/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-insertionindex-with-copyright/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-insertionindex-with-copyright/fake-test262/test/raw.js +0 -15
- package/test/collateral/valid-insertionindex-with-copyright/fake-test262/test/runtime.js +0 -7
- package/test/collateral/valid-omit-runtime/expected-content/test/asyncNegative_default.js +0 -11
- package/test/collateral/valid-omit-runtime/expected-content/test/asyncNegative_strict_mode.js +0 -12
- package/test/collateral/valid-omit-runtime/expected-content/test/async_default.js +0 -10
- package/test/collateral/valid-omit-runtime/expected-content/test/async_strict_mode.js +0 -11
- package/test/collateral/valid-omit-runtime/expected-content/test/bothStrict_default.js +0 -15
- package/test/collateral/valid-omit-runtime/expected-content/test/bothStrict_strict_mode.js +0 -16
- package/test/collateral/valid-omit-runtime/expected-content/test/error_default.js +0 -8
- package/test/collateral/valid-omit-runtime/expected-content/test/error_strict_mode.js +0 -9
- package/test/collateral/valid-omit-runtime/expected-content/test/module_default.js +0 -6
- package/test/collateral/valid-omit-runtime/expected-content/test/module_strict_mode.js +0 -7
- package/test/collateral/valid-omit-runtime/expected-content/test/negative-empty_default.js +0 -6
- package/test/collateral/valid-omit-runtime/expected-content/test/negative-empty_strict_mode.js +0 -7
- package/test/collateral/valid-omit-runtime/expected-content/test/noStrict_default.js +0 -5
- package/test/collateral/valid-omit-runtime/expected-content/test/rawNoStrict_default.js +0 -14
- package/test/collateral/valid-omit-runtime/expected-content/test/rawStrict_default.js +0 -15
- package/test/collateral/valid-omit-runtime/expected-content/test/strict_strict_mode.js +0 -10
- package/test/collateral/valid-omit-runtime/expected-metadata/test/asyncNegative_default.json +0 -18
- package/test/collateral/valid-omit-runtime/expected-metadata/test/asyncNegative_strict_mode.json +0 -18
- package/test/collateral/valid-omit-runtime/expected-metadata/test/async_default.json +0 -14
- package/test/collateral/valid-omit-runtime/expected-metadata/test/async_strict_mode.json +0 -14
- package/test/collateral/valid-omit-runtime/expected-metadata/test/bothStrict_default.json +0 -21
- package/test/collateral/valid-omit-runtime/expected-metadata/test/bothStrict_strict_mode.json +0 -21
- package/test/collateral/valid-omit-runtime/expected-metadata/test/error_default.json +0 -16
- package/test/collateral/valid-omit-runtime/expected-metadata/test/error_strict_mode.json +0 -16
- package/test/collateral/valid-omit-runtime/expected-metadata/test/module_default.json +0 -14
- package/test/collateral/valid-omit-runtime/expected-metadata/test/module_strict_mode.json +0 -14
- package/test/collateral/valid-omit-runtime/expected-metadata/test/negative-empty_default.json +0 -16
- package/test/collateral/valid-omit-runtime/expected-metadata/test/negative-empty_strict_mode.json +0 -16
- package/test/collateral/valid-omit-runtime/expected-metadata/test/noStrict_default.json +0 -14
- package/test/collateral/valid-omit-runtime/expected-metadata/test/rawNoStrict_default.json +0 -14
- package/test/collateral/valid-omit-runtime/expected-metadata/test/rawStrict_default.json +0 -14
- package/test/collateral/valid-omit-runtime/expected-metadata/test/strict_strict_mode.json +0 -18
- package/test/collateral/valid-omit-runtime/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-omit-runtime/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-omit-runtime/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-omit-runtime/fake-test262/test/async.js +0 -10
- package/test/collateral/valid-omit-runtime/fake-test262/test/asyncNegative.js +0 -11
- package/test/collateral/valid-omit-runtime/fake-test262/test/bothStrict.js +0 -15
- package/test/collateral/valid-omit-runtime/fake-test262/test/error.js +0 -8
- package/test/collateral/valid-omit-runtime/fake-test262/test/module.js +0 -6
- package/test/collateral/valid-omit-runtime/fake-test262/test/module_FIXTURE.js +0 -2
- package/test/collateral/valid-omit-runtime/fake-test262/test/negative-empty.js +0 -6
- package/test/collateral/valid-omit-runtime/fake-test262/test/noStrict.js +0 -5
- package/test/collateral/valid-omit-runtime/fake-test262/test/rawNoStrict.js +0 -14
- package/test/collateral/valid-omit-runtime/fake-test262/test/rawStrict.js +0 -15
- package/test/collateral/valid-omit-runtime/fake-test262/test/strict.js +0 -9
- package/test/collateral/valid-version-ignored/expected-content/test/strict_strict_mode.js +0 -41
- package/test/collateral/valid-version-ignored/expected-metadata/test/strict_strict_mode.json +0 -21
- package/test/collateral/valid-version-ignored/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-version-ignored/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-version-ignored/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-version-ignored/fake-test262/package.json +0 -3
- package/test/collateral/valid-version-ignored/fake-test262/test/strict.js +0 -9
- package/test/collateral/valid-version-supported/expected-content/test/strict_strict_mode.js +0 -41
- package/test/collateral/valid-version-supported/expected-metadata/test/strict_strict_mode.json +0 -21
- package/test/collateral/valid-version-supported/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-version-supported/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-version-supported/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-version-supported/fake-test262/package.json +0 -3
- package/test/collateral/valid-version-supported/fake-test262/test/strict.js +0 -9
- package/test/collateral/valid-with-hashbang/expected-content/test/missing-raw-flag_default.js +0 -44
- package/test/collateral/valid-with-hashbang/expected-content/test/missing-raw-flag_strict_mode.js +0 -45
- package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls-and-license-on-same-line_default.js +0 -20
- package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls-multiline-block_default.js +0 -18
- package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls_default.js +0 -17
- package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps-and-license-on-same-line_default.js +0 -20
- package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps-multiline-block_default.js +0 -18
- package/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps_default.js +0 -17
- package/test/collateral/valid-with-hashbang/expected-content/test/rawWithLicense_default.js +0 -21
- package/test/collateral/valid-with-hashbang/expected-content/test/raw_default.js +0 -17
- package/test/collateral/valid-with-hashbang/expected-metadata/test/missing-raw-flag_default.json +0 -22
- package/test/collateral/valid-with-hashbang/expected-metadata/test/missing-raw-flag_strict_mode.json +0 -22
- package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls-and-license-on-same-line_default.json +0 -21
- package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls-multiline-block_default.json +0 -21
- package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls_default.json +0 -21
- package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps-and-license-on-same-line_default.json +0 -21
- package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps-multiline-block_default.json +0 -21
- package/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps_default.json +0 -21
- package/test/collateral/valid-with-hashbang/expected-metadata/test/rawWithLicense_default.json +0 -21
- package/test/collateral/valid-with-hashbang/expected-metadata/test/raw_default.json +0 -21
- package/test/collateral/valid-with-hashbang/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-with-hashbang/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-with-hashbang/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-with-hashbang/fake-test262/test/missing-raw-flag.js +0 -13
- package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls-and-license-on-same-line.js +0 -20
- package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls-multiline-block.js +0 -18
- package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls.js +0 -17
- package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps-and-license-on-same-line.js +0 -20
- package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps-multiline-block.js +0 -18
- package/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps.js +0 -17
- package/test/collateral/valid-with-hashbang/fake-test262/test/raw.js +0 -17
- package/test/collateral/valid-with-hashbang/fake-test262/test/rawWithLicense.js +0 -21
- package/test/collateral/valid-with-includes/custom-includes/assert.js +0 -17
- package/test/collateral/valid-with-includes/custom-includes/doneprintHandle.js +0 -9
- package/test/collateral/valid-with-includes/custom-includes/sta.js +0 -13
- package/test/collateral/valid-with-includes/expected-content/test/async_default.js +0 -52
- package/test/collateral/valid-with-includes/expected-content/test/async_strict_mode.js +0 -53
- package/test/collateral/valid-with-includes/expected-content/test/bothStrict_default.js +0 -47
- package/test/collateral/valid-with-includes/expected-content/test/bothStrict_strict_mode.js +0 -48
- package/test/collateral/valid-with-includes/expected-metadata/test/async_default.json +0 -18
- package/test/collateral/valid-with-includes/expected-metadata/test/async_strict_mode.json +0 -18
- package/test/collateral/valid-with-includes/expected-metadata/test/bothStrict_default.json +0 -24
- package/test/collateral/valid-with-includes/expected-metadata/test/bothStrict_strict_mode.json +0 -24
- package/test/collateral/valid-with-includes/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-with-includes/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-with-includes/fake-test262/test/async.js +0 -10
- package/test/collateral/valid-with-includes/fake-test262/test/bothStrict.js +0 -15
- package/test/collateral/valid-with-paths/expected-content/test/async/asyncNegative_default.js +0 -49
- package/test/collateral/valid-with-paths/expected-content/test/async/asyncNegative_strict_mode.js +0 -50
- package/test/collateral/valid-with-paths/expected-content/test/async/async_default.js +0 -48
- package/test/collateral/valid-with-paths/expected-content/test/async/async_strict_mode.js +0 -49
- package/test/collateral/valid-with-paths/expected-content/test/bothStrict_default.js +0 -46
- package/test/collateral/valid-with-paths/expected-content/test/bothStrict_strict_mode.js +0 -47
- package/test/collateral/valid-with-paths/expected-content/test/strict/no/noStrict_default.js +0 -36
- package/test/collateral/valid-with-paths/expected-content/test/strict/no/rawNoStrict_default.js +0 -14
- package/test/collateral/valid-with-paths/expected-metadata/test/async/asyncNegative_default.json +0 -22
- package/test/collateral/valid-with-paths/expected-metadata/test/async/asyncNegative_strict_mode.json +0 -22
- package/test/collateral/valid-with-paths/expected-metadata/test/async/async_default.json +0 -18
- package/test/collateral/valid-with-paths/expected-metadata/test/async/async_strict_mode.json +0 -18
- package/test/collateral/valid-with-paths/expected-metadata/test/bothStrict_default.json +0 -24
- package/test/collateral/valid-with-paths/expected-metadata/test/bothStrict_strict_mode.json +0 -24
- package/test/collateral/valid-with-paths/expected-metadata/test/strict/no/noStrict_default.json +0 -17
- package/test/collateral/valid-with-paths/expected-metadata/test/strict/no/rawNoStrict_default.json +0 -14
- package/test/collateral/valid-with-paths/fake-test262/harness/assert.js +0 -17
- package/test/collateral/valid-with-paths/fake-test262/harness/doneprintHandle.js +0 -6
- package/test/collateral/valid-with-paths/fake-test262/harness/sta.js +0 -12
- package/test/collateral/valid-with-paths/fake-test262/test/async/async.js +0 -10
- package/test/collateral/valid-with-paths/fake-test262/test/async/asyncNegative.js +0 -11
- package/test/collateral/valid-with-paths/fake-test262/test/bothStrict.js +0 -15
- package/test/collateral/valid-with-paths/fake-test262/test/error.js +0 -8
- package/test/collateral/valid-with-paths/fake-test262/test/negative-empty.js +0 -6
- package/test/collateral/valid-with-paths/fake-test262/test/strict/no/noStrict.js +0 -5
- package/test/collateral/valid-with-paths/fake-test262/test/strict/no/rawNoStrict.js +0 -14
- package/test/collateral/valid-with-paths/fake-test262/test/strict/rawStrict.js +0 -15
- package/test/collateral/valid-with-paths/fake-test262/test/strict/strict.js +0 -9
- package/test/test.js +0 -319
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2017, Bocoup LLC
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of [project] nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/LICENSE.txt
CHANGED
package/README.md
CHANGED
|
@@ -66,6 +66,16 @@ stream.on('error', function(err) {
|
|
|
66
66
|
});
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
The package includes TypeScript typings, in which the stream's tests are of
|
|
70
|
+
type `TestStream.Test`.
|
|
71
|
+
|
|
72
|
+
Tests are emitted in no specified order: files are read concurrently, so the
|
|
73
|
+
tests of different files, and of different `paths`, may be interleaved.
|
|
74
|
+
|
|
75
|
+
An error, such as a file that cannot be read or invalid frontmatter, ends the
|
|
76
|
+
stream: it emits an `error` event, and no further tests or `end` event.
|
|
77
|
+
|
|
69
78
|
## License
|
|
70
79
|
|
|
71
|
-
Copyright 2017, Bocoup LLC under the 3-Clause BSD
|
|
80
|
+
Copyright 2026, Babel contributors, and 2017, Bocoup LLC, under the 3-Clause BSD
|
|
81
|
+
License (see `LICENSE.txt` and `LICENSE-BOCOUP.txt`)
|
package/lib/builder.js
CHANGED
|
@@ -3,6 +3,30 @@ const fs = require('fs');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const TestFile = require('./test-file');
|
|
5
5
|
|
|
6
|
+
// Harness files are the same for every test, so a stream reads each of them
|
|
7
|
+
// once rather than once per test.
|
|
8
|
+
function readInclude(options, name) {
|
|
9
|
+
const cache = options.includesCache;
|
|
10
|
+
let contents = cache && cache.get(name);
|
|
11
|
+
|
|
12
|
+
if (contents === undefined) {
|
|
13
|
+
contents = fs.readFileSync(path.join(options.includesDir, name), 'utf-8');
|
|
14
|
+
if (cache) {
|
|
15
|
+
cache.set(name, contents);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return contents;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function concatIncludes(options, includes) {
|
|
23
|
+
let includeContents = '';
|
|
24
|
+
for (let i = 0; i < includes.length; i++) {
|
|
25
|
+
includeContents += readInclude(options, includes[i]) + '\n';
|
|
26
|
+
}
|
|
27
|
+
return includeContents;
|
|
28
|
+
}
|
|
29
|
+
|
|
6
30
|
module.exports = function builder(file, contents, options) {
|
|
7
31
|
options = options || {};
|
|
8
32
|
if (!options.test262Dir && !options.includesDir) {
|
|
@@ -20,23 +44,34 @@ module.exports = function builder(file, contents, options) {
|
|
|
20
44
|
return test;
|
|
21
45
|
}
|
|
22
46
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
// Prepend assert.js, sta.js, and (if needed) doneprintHandle.js,
|
|
48
|
+
// preserving their relative order. Building a new list is faster than
|
|
49
|
+
// prepending to the test's.
|
|
50
|
+
// https://github.com/tc39/test262/blob/main/INTERPRETING.md#includes
|
|
51
|
+
const includes = test.attrs.flags.async ?
|
|
52
|
+
['assert.js', 'sta.js', 'doneprintHandle.js'] :
|
|
53
|
+
['assert.js', 'sta.js'];
|
|
54
|
+
const testIncludes = test.attrs.includes;
|
|
55
|
+
for (let i = 0; i < testIncludes.length; i++) {
|
|
56
|
+
includes.push(testIncludes[i]);
|
|
32
57
|
}
|
|
58
|
+
test.attrs.includes = includes;
|
|
33
59
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
60
|
+
// Most tests only include the harness files that every test, or every
|
|
61
|
+
// async test, includes, so a stream concatenates these once. File names
|
|
62
|
+
// cannot contain "\0", so the keys do not clash with theirs.
|
|
63
|
+
const cache = options.includesCache;
|
|
64
|
+
let includeContents;
|
|
65
|
+
|
|
66
|
+
if (cache && testIncludes.length === 0) {
|
|
67
|
+
const key = test.attrs.flags.async ? '\0async' : '\0default';
|
|
68
|
+
includeContents = cache.get(key);
|
|
69
|
+
if (includeContents === undefined) {
|
|
70
|
+
includeContents = concatIncludes(options, includes);
|
|
71
|
+
cache.set(key, includeContents);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
includeContents = concatIncludes(options, includes);
|
|
40
75
|
}
|
|
41
76
|
|
|
42
77
|
test.contents = includeContents + test.contents;
|
package/lib/compile.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
3
|
const builder = require('./builder');
|
|
5
4
|
const createScenarios = require('./create-scenarios');
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
// `file` is the path of the file relative to `options.test262Dir`.
|
|
7
|
+
module.exports = function(filePath, file, options, done) {
|
|
8
8
|
fs.readFile(filePath, 'utf-8', (error, contents) => {
|
|
9
9
|
if (error) {
|
|
10
10
|
done(error);
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
14
|
+
let tests;
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
tests = createScenarios(
|
|
18
|
+
builder(file, contents, options)
|
|
19
|
+
);
|
|
20
|
+
} catch (error) {
|
|
21
|
+
done(error);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
done(null, tests);
|
|
23
26
|
});
|
|
24
27
|
};
|
package/lib/create-scenarios.js
CHANGED
|
@@ -2,22 +2,53 @@
|
|
|
2
2
|
const usd = '"use strict";\n';
|
|
3
3
|
const usdLength = usd.length;
|
|
4
4
|
|
|
5
|
+
// Copies attributes, and their lists and mappings, such as `includes`,
|
|
6
|
+
// `features` and `negative`, so that changing those of one scenario does not
|
|
7
|
+
// change the other's.
|
|
8
|
+
function copyAttrs(attrs) {
|
|
9
|
+
const copy = Object.assign({}, attrs);
|
|
10
|
+
const keys = Object.keys(copy);
|
|
11
|
+
|
|
12
|
+
for (let i = 0; i < keys.length; i++) {
|
|
13
|
+
const value = copy[keys[i]];
|
|
14
|
+
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
copy[keys[i]] = value.slice();
|
|
17
|
+
} else if (typeof value === 'object' && value !== null) {
|
|
18
|
+
copy[keys[i]] = Object.assign({}, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return copy;
|
|
23
|
+
}
|
|
24
|
+
|
|
5
25
|
module.exports = function scenariosForTest(test) {
|
|
6
26
|
const scenarios = [];
|
|
7
27
|
|
|
8
|
-
if (
|
|
28
|
+
if (test.attrs.flags.module) {
|
|
9
29
|
test.scenario = 'default';
|
|
10
30
|
scenarios.push(test);
|
|
11
|
-
}
|
|
31
|
+
} else {
|
|
32
|
+
if (!test.attrs.flags.onlyStrict) {
|
|
33
|
+
test.scenario = 'default';
|
|
34
|
+
scenarios.push(test);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!test.attrs.flags.noStrict && !test.attrs.flags.raw) {
|
|
38
|
+
const attrs = copyAttrs(test.attrs);
|
|
39
|
+
attrs.description += ' (Strict Mode)';
|
|
12
40
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
// The properties of a Test262File, in order. A literal is faster to
|
|
42
|
+
// create than a copy with Object.assign.
|
|
43
|
+
scenarios.push({
|
|
44
|
+
file: test.file,
|
|
45
|
+
contents: usd + test.contents,
|
|
46
|
+
attrs,
|
|
47
|
+
copyright: test.copyright,
|
|
48
|
+
scenario: 'strict mode',
|
|
49
|
+
insertionIndex: test.insertionIndex + usdLength
|
|
50
|
+
});
|
|
51
|
+
}
|
|
21
52
|
}
|
|
22
53
|
|
|
23
54
|
return scenarios;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Readable, ReadableOptions } from 'stream';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Node.js readable stream that emits an object for every test in a Test262
|
|
5
|
+
* directory.
|
|
6
|
+
*
|
|
7
|
+
* Tests are emitted in no specified order: files are read concurrently, so
|
|
8
|
+
* the tests of different files, and of different `paths`, may be interleaved.
|
|
9
|
+
*
|
|
10
|
+
* An error, such as a file that cannot be read or invalid frontmatter, ends
|
|
11
|
+
* the stream: it emits an `error` event, and no further tests or `end` event.
|
|
12
|
+
*/
|
|
13
|
+
declare class TestStream extends Readable {
|
|
14
|
+
/**
|
|
15
|
+
* @param test262Dir - path to a directory containing Test262
|
|
16
|
+
*/
|
|
17
|
+
constructor(test262Dir: string, options?: TestStream.Options);
|
|
18
|
+
|
|
19
|
+
read(size?: number): TestStream.Test | null;
|
|
20
|
+
|
|
21
|
+
[Symbol.asyncIterator](): TestStream.TestIterator;
|
|
22
|
+
|
|
23
|
+
addListener(event: 'data', listener: (test: TestStream.Test) => void): this;
|
|
24
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
25
|
+
on(event: 'data', listener: (test: TestStream.Test) => void): this;
|
|
26
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
27
|
+
once(event: 'data', listener: (test: TestStream.Test) => void): this;
|
|
28
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
29
|
+
prependListener(event: 'data', listener: (test: TestStream.Test) => void): this;
|
|
30
|
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
31
|
+
prependOnceListener(event: 'data', listener: (test: TestStream.Test) => void): this;
|
|
32
|
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare namespace TestStream {
|
|
36
|
+
interface Options extends Omit<ReadableOptions, 'objectMode' | 'read'> {
|
|
37
|
+
/**
|
|
38
|
+
* Directory from which to load "includes" files; defaults to the
|
|
39
|
+
* `harness` directory of `test262Dir`.
|
|
40
|
+
*/
|
|
41
|
+
includesDir?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Files and directories, relative to `test262Dir`, to read tests from;
|
|
44
|
+
* defaults to `['test']`.
|
|
45
|
+
*/
|
|
46
|
+
paths?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* Whether to leave out the code that tests need to run, such as
|
|
49
|
+
* assert.js and the "includes" files; defaults to `false`.
|
|
50
|
+
*/
|
|
51
|
+
omitRuntime?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Version of Test262 to accept although this library does not support
|
|
54
|
+
* it. Use of this option may cause the stream to emit invalid tests.
|
|
55
|
+
*/
|
|
56
|
+
acceptVersion?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The iterator of the tests of a stream, which `for await` uses: the
|
|
61
|
+
* iterator of Readable streams, whose type depends on the version of
|
|
62
|
+
* @types/node, with its values typed as tests.
|
|
63
|
+
*/
|
|
64
|
+
interface TestIterator extends Omit<
|
|
65
|
+
ReturnType<Readable[typeof Symbol.asyncIterator]>,
|
|
66
|
+
'next' | 'return' | 'throw' | typeof Symbol.asyncIterator
|
|
67
|
+
> {
|
|
68
|
+
next(...args: [] | [unknown]): Promise<IteratorResult<Test, any>>;
|
|
69
|
+
return?(value?: any): Promise<IteratorResult<Test, any>>;
|
|
70
|
+
throw?(error?: any): Promise<IteratorResult<Test, any>>;
|
|
71
|
+
[Symbol.asyncIterator](): TestIterator;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface Test {
|
|
75
|
+
/** Path of the test's file, relative to `test262Dir`. */
|
|
76
|
+
file: string;
|
|
77
|
+
/**
|
|
78
|
+
* Source text of the test, including the "includes" files and any
|
|
79
|
+
* scenario transformation, such as a "use strict" directive.
|
|
80
|
+
*/
|
|
81
|
+
contents: string;
|
|
82
|
+
/** Metadata from the test's YAML frontmatter. */
|
|
83
|
+
attrs: Attrs;
|
|
84
|
+
/** Copyright line of the test, or `''` if it has none. */
|
|
85
|
+
copyright: string;
|
|
86
|
+
/** How the test's file was interpreted to create the test. */
|
|
87
|
+
scenario: 'default' | 'strict mode';
|
|
88
|
+
/**
|
|
89
|
+
* Offset in `contents` at which statements may be inserted without
|
|
90
|
+
* necessarily invalidating the test, or -1 for `raw` tests.
|
|
91
|
+
*/
|
|
92
|
+
insertionIndex: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Metadata from a test's YAML frontmatter.
|
|
97
|
+
* https://github.com/tc39/test262/blob/main/INTERPRETING.md#metadata
|
|
98
|
+
*/
|
|
99
|
+
interface Attrs {
|
|
100
|
+
description: string;
|
|
101
|
+
/** Harness files to include, including the default ones. */
|
|
102
|
+
includes: string[];
|
|
103
|
+
flags: Flags;
|
|
104
|
+
negative?: Negative;
|
|
105
|
+
features?: string[];
|
|
106
|
+
locale?: string | string[];
|
|
107
|
+
esid?: string;
|
|
108
|
+
es5id?: string | number;
|
|
109
|
+
es6id?: string | number;
|
|
110
|
+
info?: string;
|
|
111
|
+
author?: string;
|
|
112
|
+
[key: string]: unknown;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Flags of a test, each `true` if the test has it.
|
|
117
|
+
*/
|
|
118
|
+
interface Flags {
|
|
119
|
+
onlyStrict?: true;
|
|
120
|
+
noStrict?: true;
|
|
121
|
+
module?: true;
|
|
122
|
+
raw?: true;
|
|
123
|
+
async?: true;
|
|
124
|
+
generated?: true;
|
|
125
|
+
CanBlockIsFalse?: true;
|
|
126
|
+
CanBlockIsTrue?: true;
|
|
127
|
+
[flag: string]: true | undefined;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface Negative {
|
|
131
|
+
phase: 'parse' | 'resolution' | 'runtime';
|
|
132
|
+
/** Name of the error constructor, such as `SyntaxError`. */
|
|
133
|
+
type: string;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export = TestStream;
|