New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow testing logs with @babel/helper-transform-fixture-test-runner
#10326
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6ba5dff
Add support for logs to transform-fixture-test-runner
nicolo-ribaudo 5502993
Test some warnings
nicolo-ribaudo baa8ea5
Use stderr/stdout, and add a validateLogs test option
nicolo-ribaudo 64ba603
Normalize CWD in logs and rename vars
nicolo-ribaudo 6228c59
Silence preset-env tests
nicolo-ribaudo 0158a6f
Restore old methos
nicolo-ribaudo File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...s/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"validateLogs": true, | ||
"plugins": [ | ||
"syntax-dynamic-import", | ||
"transform-modules-systemjs", | ||
|
3 changes: 3 additions & 0 deletions
3
...ges/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/stderr.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
WARNING: Dynamic import() transformation must be enabled using the | ||
@babel/plugin-proposal-dynamic-import plugin. Babel 8 will | ||
no longer transform import() without using that plugin. |
1 change: 1 addition & 0 deletions
1
...ages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [ | ||
[ | ||
"../../../../lib", | ||
|
33 changes: 33 additions & 0 deletions
33
packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/stdout.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@babel/preset-env: `DEBUG` option | ||
|
||
Using targets: | ||
{ | ||
"chrome": "61", | ||
"edge": "16", | ||
"firefox": "60", | ||
"ios": "10.3", | ||
"opera": "48", | ||
"safari": "10.1" | ||
} | ||
|
||
Using modules transform: false | ||
|
||
Using plugins: | ||
transform-template-literals { "ios":"10.3", "safari":"10.1" } | ||
transform-function-name { "edge":"16" } | ||
transform-dotall-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
transform-unicode-regex { "ios":"10.3", "safari":"10.1" } | ||
transform-parameters { "edge":"16" } | ||
transform-block-scoping { "ios":"10.3", "safari":"10.1" } | ||
transform-async-to-generator { "ios":"10.3", "safari":"10.1" } | ||
proposal-async-generator-functions { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } | ||
proposal-unicode-property-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
proposal-json-strings { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
proposal-optional-catch-binding { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
transform-named-capturing-groups-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
|
||
Using polyfills with `usage` option: | ||
|
||
[<CWD>/packages/babel-preset-env/test/fixtures/corejs2/usage-browserslist-config-ignore/input.mjs] Added following core-js polyfill: | ||
web.dom.iterable { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } |
Empty file.
1 change: 1 addition & 0 deletions
1
...ages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [ | ||
[ | ||
"../../../../lib", | ||
|
34 changes: 34 additions & 0 deletions
34
packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/stdout.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@babel/preset-env: `DEBUG` option | ||
|
||
Using targets: | ||
{ | ||
"chrome": "61", | ||
"edge": "16", | ||
"firefox": "60", | ||
"ios": "10.3", | ||
"opera": "48", | ||
"safari": "10.1" | ||
} | ||
|
||
Using modules transform: false | ||
|
||
Using plugins: | ||
transform-template-literals { "ios":"10.3", "safari":"10.1" } | ||
transform-function-name { "edge":"16" } | ||
transform-dotall-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
transform-unicode-regex { "ios":"10.3", "safari":"10.1" } | ||
transform-parameters { "edge":"16" } | ||
transform-block-scoping { "ios":"10.3", "safari":"10.1" } | ||
transform-async-to-generator { "ios":"10.3", "safari":"10.1" } | ||
proposal-async-generator-functions { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
proposal-object-rest-spread { "edge":"16", "ios":"10.3", "safari":"10.1" } | ||
proposal-unicode-property-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
proposal-json-strings { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
proposal-optional-catch-binding { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
transform-named-capturing-groups-regex { "chrome":"61", "edge":"16", "firefox":"60", "ios":"10.3", "opera":"48", "safari":"10.1" } | ||
|
||
Using polyfills with `usage` option: | ||
|
||
[<CWD>/packages/babel-preset-env/test/fixtures/corejs3/usage-browserslist-config-ignore/input.mjs] Added following core-js polyfills: | ||
es.array.iterator { "chrome":"61", "opera":"48" } | ||
web.dom-collections.iterator { "chrome":"61", "edge":"16", "ios":"10.3", "opera":"48", "safari":"10.1" } |
1 change: 1 addition & 0 deletions
1
...-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-supported/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"validateLogs": true, | ||
"caller": { | ||
"name": "test-fixture", | ||
"supportsStaticESM": true, | ||
|
1 change: 1 addition & 0 deletions
1
...reset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"validateLogs": true, | ||
"caller": { | ||
"name": "test-fixture", | ||
"supportsStaticESM": true, | ||
|
1 change: 1 addition & 0 deletions
1
...-preset-env/test/fixtures/dynamic-import/auto-esm-supported-import-unsupported/stderr.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. |
1 change: 1 addition & 0 deletions
1
...set-env/test/fixtures/dynamic-import/auto-esm-unsupported-import-unsupported/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"validateLogs": true, | ||
"caller": { | ||
"name": "test-fixture", | ||
"supportsStaticESM": false, | ||
|
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/dynamic-import/modules-amd/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [["env", { "modules": "amd" }]] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/dynamic-import/modules-cjs/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [["env", { "modules": "cjs" }]] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/dynamic-import/modules-false/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [["env", { "modules": false }]] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/dynamic-import/modules-systemjs/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [["env", { "modules": "systemjs" }]] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [["env", { "modules": "umd" }]] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/dynamic-import/modules-umd/stderr.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dynamic import can only be supported when transforming ES modules to AMD, CommonJS or SystemJS. Only the parser plugin will be enabled. |
1 change: 1 addition & 0 deletions
1
packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"validateLogs": true, | ||
"presets": [ | ||
[ | ||
"../../../../lib", | ||
|
24 changes: 24 additions & 0 deletions
24
packages/babel-preset-env/test/fixtures/preset-options/safari-10_3-block-scoped/stdout.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@babel/preset-env: `DEBUG` option | ||
|
||
Using targets: | ||
{ | ||
"safari": "10" | ||
} | ||
|
||
Using modules transform: auto | ||
|
||
Using plugins: | ||
transform-template-literals { "safari":"10" } | ||
transform-dotall-regex { "safari":"10" } | ||
transform-unicode-regex { "safari":"10" } | ||
transform-block-scoping { "safari":"10" } | ||
transform-exponentiation-operator { "safari":"10" } | ||
transform-async-to-generator { "safari":"10" } | ||
proposal-async-generator-functions { "safari":"10" } | ||
proposal-object-rest-spread { "safari":"10" } | ||
proposal-unicode-property-regex { "safari":"10" } | ||
proposal-json-strings { "safari":"10" } | ||
proposal-optional-catch-binding { "safari":"10" } | ||
transform-named-capturing-groups-regex { "safari":"10" } | ||
|
||
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't restore the
console.log
mock, would this line go to theactualLogs
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is expected.
Updated test file: foo.js
is used to remind the developer and therefore should always print to stdout, regardless ofvalidateLogs
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I meant: "You are right, I will fix it" 😅