From 0cd0d22c5dbcc4a39f163448f2d9ce8d3e2cbe6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Zugmeyer?= Date: Mon, 22 Apr 2024 14:50:14 +0200 Subject: [PATCH] fix: drop jest (3/4): make tests discoverable by node --test --- .editorconfig | 2 +- .gitattributes | 2 +- .prettierignore | 2 +- src/__tests__/__snapshots__/extract.js.snap | 228 ------------------ .../TransformableString.js | 0 src/{__tests__ => test}/extract.js | 0 src/{__tests__ => test}/fixtures/cdata.html | 0 src/{__tests__ => test}/fixtures/cdata.xhtml | 0 .../fixtures/crlf-newlines.html | 0 .../fixtures/eol-last.html | 0 .../fixtures/error-at-the-beginning.html | 0 src/{__tests__ => test}/fixtures/fix-bom.html | 0 src/{__tests__ => test}/fixtures/fix.html | 0 .../fixtures/indent-setting.html | 0 .../fixtures/inline-disabled-rule.html | 0 .../fixtures/javascript-mime-types.html | 0 .../fixtures/javascript.js | 0 .../other-html-plugins-compatibility.html | 0 .../fixtures/report-bad-indent-setting.html | 0 .../fixtures/scope-sharing.html | 0 .../fixtures/self-closing-tags.xhtml | 0 src/{__tests__ => test}/fixtures/simple.html | 0 src/{__tests__ => test}/getFileMode.js | 0 src/{__tests__ => test}/plugin.js | 0 24 files changed, 3 insertions(+), 231 deletions(-) delete mode 100644 src/__tests__/__snapshots__/extract.js.snap rename src/{__tests__ => test}/TransformableString.js (100%) rename src/{__tests__ => test}/extract.js (100%) rename src/{__tests__ => test}/fixtures/cdata.html (100%) rename src/{__tests__ => test}/fixtures/cdata.xhtml (100%) rename src/{__tests__ => test}/fixtures/crlf-newlines.html (100%) rename src/{__tests__ => test}/fixtures/eol-last.html (100%) rename src/{__tests__ => test}/fixtures/error-at-the-beginning.html (100%) rename src/{__tests__ => test}/fixtures/fix-bom.html (100%) rename src/{__tests__ => test}/fixtures/fix.html (100%) rename src/{__tests__ => test}/fixtures/indent-setting.html (100%) rename src/{__tests__ => test}/fixtures/inline-disabled-rule.html (100%) rename src/{__tests__ => test}/fixtures/javascript-mime-types.html (100%) rename src/{__tests__ => test}/fixtures/javascript.js (100%) rename src/{__tests__ => test}/fixtures/other-html-plugins-compatibility.html (100%) rename src/{__tests__ => test}/fixtures/report-bad-indent-setting.html (100%) rename src/{__tests__ => test}/fixtures/scope-sharing.html (100%) rename src/{__tests__ => test}/fixtures/self-closing-tags.xhtml (100%) rename src/{__tests__ => test}/fixtures/simple.html (100%) rename src/{__tests__ => test}/getFileMode.js (100%) rename src/{__tests__ => test}/plugin.js (100%) diff --git a/.editorconfig b/.editorconfig index e0d8795..3e7026b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,5 +7,5 @@ indent_size = 2 indent_style = space insert_final_newline = true -[src/__tests__/fixtures/crlf-newlines.html] +[src/test/fixtures/crlf-newlines.html] end_of_line = crlf diff --git a/.gitattributes b/.gitattributes index d622a62..9d7de3e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ # ignore test fixtures -src/__tests__/fixtures/* -text +src/test/fixtures/* -text diff --git a/.prettierignore b/.prettierignore index 8a65452..5fc97d7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1 @@ -/src/__tests__/fixtures +/src/test/fixtures diff --git a/src/__tests__/__snapshots__/extract.js.snap b/src/__tests__/__snapshots__/extract.js.snap deleted file mode 100644 index 2d573ee..0000000 --- a/src/__tests__/__snapshots__/extract.js.snap +++ /dev/null @@ -1,228 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`collects bad indentations 1`] = ` -[ - "a; -a; - a; -", -] -`; - -exports[`disable comments ignores next script 1`] = ` -[ - "var bar = 2; -", -] -`; - -exports[`disable comments ignores script 1`] = ` -[ - "var bar = 2; -", -] -`; - -exports[`extract empty script tag (#7) 1`] = ` -[ - "", -] -`; - -exports[`extract indented javascript 1`] = ` -[ - "var foo = 1; -", -] -`; - -exports[`extract javascript with first line next to the script tag 1`] = ` -[ - "var foo = 1; -var baz = 1; -", -] -`; - -exports[`extract javascript with last line next to the script tag 1`] = ` -[ - "var foo = 1; -var baz = 1;", -] -`; - -exports[`extract multiple script tags 1`] = ` -[ - "var foo = 1; -", - "var bar = 1; -", -] -`; - -exports[`extract multiple tags types 1`] = ` -[ - "var foo = 1; -", - "var bar = 1; -", -] -`; - -exports[`extract script containing 'lower than' characters correctly (#1) 1`] = ` -[ - "if (a < b) { doit(); } -", -] -`; - -exports[`extract simple javascript 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=application/babel 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=application/javascript 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=application/x-babel 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=application/x-javascript 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=text/babel 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=text/javascript 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=text/x-babel 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`extracts a script tag with type=text/x-javascript 1`] = ` -[ - "var foo = 1;", -] -`; - -exports[`handles empty input 1`] = `[]`; - -exports[`handles self closing script tags in xhtml mode 1`] = `[]`; - -exports[`handles the isJavaScriptMIMEType option 1`] = ` -[ - "a -", - "b -", -] -`; - -exports[`indent option absolute indent with spaces 1`] = ` -[ - " - a; -a; -a; -", -] -`; - -exports[`indent option absolute indent with tabs 1`] = ` -[ - " - a; -a; -a; -", -] -`; - -exports[`indent option relative indent with spaces 1`] = ` -[ - "a; - a; -a; -", -] -`; - -exports[`indent option relative indent with tabs 1`] = ` -[ - "a; - a; -a; -", -] -`; - -exports[`keeps empty lines after the last html tags 1`] = ` -[ - "a -", -] -`; - -exports[`skips script with src attributes 1`] = `[]`; - -exports[`skips script without type attribute 1`] = `[]`; - -exports[`trim last line spaces 1`] = ` -[ - "var foo = 1; -", -] -`; - -exports[`trim last line spaces ignoring CDATA 1`] = ` -[ - " -var foo = 1; -", -] -`; - -exports[`works with CDATA 1`] = ` -[ - "a; - -b; - -c; -", -] -`; - -exports[`works with crlf new lines 1`] = ` -[ - "foo; -bar; - baz; -", -] -`; diff --git a/src/__tests__/TransformableString.js b/src/test/TransformableString.js similarity index 100% rename from src/__tests__/TransformableString.js rename to src/test/TransformableString.js diff --git a/src/__tests__/extract.js b/src/test/extract.js similarity index 100% rename from src/__tests__/extract.js rename to src/test/extract.js diff --git a/src/__tests__/fixtures/cdata.html b/src/test/fixtures/cdata.html similarity index 100% rename from src/__tests__/fixtures/cdata.html rename to src/test/fixtures/cdata.html diff --git a/src/__tests__/fixtures/cdata.xhtml b/src/test/fixtures/cdata.xhtml similarity index 100% rename from src/__tests__/fixtures/cdata.xhtml rename to src/test/fixtures/cdata.xhtml diff --git a/src/__tests__/fixtures/crlf-newlines.html b/src/test/fixtures/crlf-newlines.html similarity index 100% rename from src/__tests__/fixtures/crlf-newlines.html rename to src/test/fixtures/crlf-newlines.html diff --git a/src/__tests__/fixtures/eol-last.html b/src/test/fixtures/eol-last.html similarity index 100% rename from src/__tests__/fixtures/eol-last.html rename to src/test/fixtures/eol-last.html diff --git a/src/__tests__/fixtures/error-at-the-beginning.html b/src/test/fixtures/error-at-the-beginning.html similarity index 100% rename from src/__tests__/fixtures/error-at-the-beginning.html rename to src/test/fixtures/error-at-the-beginning.html diff --git a/src/__tests__/fixtures/fix-bom.html b/src/test/fixtures/fix-bom.html similarity index 100% rename from src/__tests__/fixtures/fix-bom.html rename to src/test/fixtures/fix-bom.html diff --git a/src/__tests__/fixtures/fix.html b/src/test/fixtures/fix.html similarity index 100% rename from src/__tests__/fixtures/fix.html rename to src/test/fixtures/fix.html diff --git a/src/__tests__/fixtures/indent-setting.html b/src/test/fixtures/indent-setting.html similarity index 100% rename from src/__tests__/fixtures/indent-setting.html rename to src/test/fixtures/indent-setting.html diff --git a/src/__tests__/fixtures/inline-disabled-rule.html b/src/test/fixtures/inline-disabled-rule.html similarity index 100% rename from src/__tests__/fixtures/inline-disabled-rule.html rename to src/test/fixtures/inline-disabled-rule.html diff --git a/src/__tests__/fixtures/javascript-mime-types.html b/src/test/fixtures/javascript-mime-types.html similarity index 100% rename from src/__tests__/fixtures/javascript-mime-types.html rename to src/test/fixtures/javascript-mime-types.html diff --git a/src/__tests__/fixtures/javascript.js b/src/test/fixtures/javascript.js similarity index 100% rename from src/__tests__/fixtures/javascript.js rename to src/test/fixtures/javascript.js diff --git a/src/__tests__/fixtures/other-html-plugins-compatibility.html b/src/test/fixtures/other-html-plugins-compatibility.html similarity index 100% rename from src/__tests__/fixtures/other-html-plugins-compatibility.html rename to src/test/fixtures/other-html-plugins-compatibility.html diff --git a/src/__tests__/fixtures/report-bad-indent-setting.html b/src/test/fixtures/report-bad-indent-setting.html similarity index 100% rename from src/__tests__/fixtures/report-bad-indent-setting.html rename to src/test/fixtures/report-bad-indent-setting.html diff --git a/src/__tests__/fixtures/scope-sharing.html b/src/test/fixtures/scope-sharing.html similarity index 100% rename from src/__tests__/fixtures/scope-sharing.html rename to src/test/fixtures/scope-sharing.html diff --git a/src/__tests__/fixtures/self-closing-tags.xhtml b/src/test/fixtures/self-closing-tags.xhtml similarity index 100% rename from src/__tests__/fixtures/self-closing-tags.xhtml rename to src/test/fixtures/self-closing-tags.xhtml diff --git a/src/__tests__/fixtures/simple.html b/src/test/fixtures/simple.html similarity index 100% rename from src/__tests__/fixtures/simple.html rename to src/test/fixtures/simple.html diff --git a/src/__tests__/getFileMode.js b/src/test/getFileMode.js similarity index 100% rename from src/__tests__/getFileMode.js rename to src/test/getFileMode.js diff --git a/src/__tests__/plugin.js b/src/test/plugin.js similarity index 100% rename from src/__tests__/plugin.js rename to src/test/plugin.js