summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-08-02 15:52:48 +0200
committerGitHub <noreply@github.com>2024-08-02 13:52:48 +0000
commit0da81205d57e947e82aa02206f8ba6822c624ebc (patch)
tree4472cc6281aca813adc3c2a06321701ea3c3008f /tests
parent2aad92c30b327b9db352e8a2c024671205eed9f6 (diff)
feat(unstable/fmt): move yaml formatting behind unstable flag (#24848)
This moves YAML formatting behind an unstable flag for Deno 1.46. This will make it opt-in to start and then we can remove the flag to make it on by default in version of Deno after that. This can be specified by doing `deno fmt --unstable-yaml` or by specifying the following in a deno.json file: ```json { "unstable": ["fmt-yaml"] } ```
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/fmt_tests.rs3
-rw-r--r--tests/integration/upgrade_tests.rs2
-rw-r--r--tests/specs/fmt/unstable_yaml/__test__.jsonc25
-rw-r--r--tests/specs/fmt/unstable_yaml/badly_formatted.yml3
4 files changed, 32 insertions, 1 deletions
diff --git a/tests/integration/fmt_tests.rs b/tests/integration/fmt_tests.rs
index 17adef6f8..dab2b2ce4 100644
--- a/tests/integration/fmt_tests.rs
+++ b/tests/integration/fmt_tests.rs
@@ -49,6 +49,7 @@ fn fmt_test() {
.current_dir(&testdata_fmt_dir)
.args_vec(vec![
"fmt".to_string(),
+ "--unstable-yaml".to_string(),
format!(
"--ignore={badly_formatted_js},{badly_formatted_md},{badly_formatted_json},{badly_formatted_yaml},{badly_formatted_ipynb}",
),
@@ -69,6 +70,7 @@ fn fmt_test() {
.args_vec(vec![
"fmt".to_string(),
"--check".to_string(),
+ "--unstable-yaml".to_string(),
badly_formatted_js.to_string(),
badly_formatted_md.to_string(),
badly_formatted_json.to_string(),
@@ -86,6 +88,7 @@ fn fmt_test() {
.current_dir(&testdata_fmt_dir)
.args_vec(vec![
"fmt".to_string(),
+ "--unstable-yaml".to_string(),
badly_formatted_js.to_string(),
badly_formatted_md.to_string(),
badly_formatted_json.to_string(),
diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs
index 844401d4e..6af73f65f 100644
--- a/tests/integration/upgrade_tests.rs
+++ b/tests/integration/upgrade_tests.rs
@@ -145,7 +145,7 @@ fn upgrade_with_out_in_tmpdir() {
assert!(v.contains("1.11.5"));
}
-#[test]
+#[flaky_test::flaky_test]
fn upgrade_invalid_stable_version() {
let context = upgrade_context();
let temp_dir = context.temp_dir();
diff --git a/tests/specs/fmt/unstable_yaml/__test__.jsonc b/tests/specs/fmt/unstable_yaml/__test__.jsonc
new file mode 100644
index 000000000..885db59b9
--- /dev/null
+++ b/tests/specs/fmt/unstable_yaml/__test__.jsonc
@@ -0,0 +1,25 @@
+{
+ "tempDir": true,
+ "tests": {
+ "nothing": {
+ "args": "fmt",
+ "output": "Checked 1 file\n"
+ },
+ "flag": {
+ "args": "fmt --unstable-yaml",
+ "output": "[WILDLINE]badly_formatted.yml\nChecked 1 file\n"
+ },
+ "config_file": {
+ "steps": [{
+ "args": [
+ "eval",
+ "Deno.writeTextFile('deno.json', '{\\n \"unstable\": [\"fmt-yaml\"]\\n}\\n')"
+ ],
+ "output": "[WILDCARD]"
+ }, {
+ "args": "fmt",
+ "output": "[WILDLINE]badly_formatted.yml\nChecked 2 files\n"
+ }]
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/specs/fmt/unstable_yaml/badly_formatted.yml b/tests/specs/fmt/unstable_yaml/badly_formatted.yml
new file mode 100644
index 000000000..49646f320
--- /dev/null
+++ b/tests/specs/fmt/unstable_yaml/badly_formatted.yml
@@ -0,0 +1,3 @@
+- Test
+ - Test
+ - Test \ No newline at end of file