Skip to content

Commit

Permalink
Merge pull request #78 from HubSpot/jm/test-dx
Browse files Browse the repository at this point in the history
Update Prettier package test setup
  • Loading branch information
j-malt authored May 16, 2024
2 parents 5c26803 + eeb467a commit ac9e522
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 169 deletions.
8 changes: 0 additions & 8 deletions prettier/configuration/jest.config.cjs

This file was deleted.

17 changes: 0 additions & 17 deletions prettier/configuration/raw-serializer.js

This file was deleted.

117 changes: 0 additions & 117 deletions prettier/configuration/run_spec.js

This file was deleted.

2 changes: 1 addition & 1 deletion prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"scripts": {
"build": "rm -rf ./dist && tsc",
"start": "nodemon --config ./configuration/nodemon.inline.json",
"test": "node --experimental-vm-modules ../node_modules/jest/bin/jest.js -c ./configuration/jest.config.cjs",
"test": "node --experimental-vm-modules ../node_modules/jest/bin/jest.js -c ./tests/configuration/jest.config.ts",
"watch": "nodemon",
"update-test": "tsc && jest -c ./configuration/jest.config.js --update-snapshot",
"test-inline": "tsc && node ./src/test-inline.ts"
Expand Down
52 changes: 26 additions & 26 deletions prettier/tests/__snapshots__/run_tests.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`404.html 1`] = `
exports[`formats 404.html correctly 1`] = `
<!--
templateType: error_page
isAvailableForNewContent: true
Expand Down Expand Up @@ -70,7 +70,7 @@ exports[`404.html 1`] = `
`;

exports[`basic.html 1`] = `
exports[`formats basic.html correctly 1`] = `
<html><div>{% set x, s = "T" %}{% form "my_form" label="My Form", custom_form_html=None, no_title=False,title="", test1=None, test2=False,title="", test3=None, test4=False,title="" %}
</div><img src="">
{{- variable|upper -}}
Expand Down Expand Up @@ -109,7 +109,7 @@ NO
`;
exports[`blog-listing.html 1`] = `
exports[`formats blog-listing.html correctly 1`] = `
<!--
templateType: blog_listing
isAvailableForNewContent: true
Expand Down Expand Up @@ -252,7 +252,7 @@ screenshotPath: ../images/template-previews/blog-index.png
`;
exports[`blog-post.html 1`] = `
exports[`formats blog-post.html correctly 1`] = `
<!--
templateType: blog_post
isAvailableForNewContent: true
Expand Down Expand Up @@ -448,7 +448,7 @@ screenshotPath: ../images/template-previews/blog-post.png
`;
exports[`brackets.html 1`] = `
exports[`formats brackets.html correctly 1`] = `
{% set test_object = {
"foo bar": "baz",
"another test value": "blah",
Expand Down Expand Up @@ -478,7 +478,7 @@ exports[`brackets.html 1`] = `
`;
exports[`comments.html 1`] = `
exports[`formats comments.html correctly 1`] = `
<div>
{# A comment #}
</div>
Expand Down Expand Up @@ -506,7 +506,7 @@ exports[`comments.html 1`] = `
`;
exports[`complex.html 1`] = `
exports[`formats complex.html correctly 1`] = `
<!--
templateType: none
-->
Expand Down Expand Up @@ -600,7 +600,7 @@ templateType: none
`;
exports[`contact.html 1`] = `
exports[`formats contact.html correctly 1`] = `
<!--
templateType: page
isAvailableForNewContent: true
Expand Down Expand Up @@ -644,7 +644,7 @@ exports[`contact.html 1`] = `
`;
exports[`css.html 1`] = `
exports[`formats css.html correctly 1`] = `
{# Module styles #}
{% require_css %}
Expand Down Expand Up @@ -799,7 +799,7 @@ border-radius: {{ module.styles.active.corner.radius ~ "px" }};
`;
exports[`for.html 1`] = `
exports[`formats for.html correctly 1`] = `
{% for key, val in request.query_dict.items() %}
{{ key }}:{{ val }}
{% endfor %}
Expand All @@ -810,7 +810,7 @@ exports[`for.html 1`] = `
`;
exports[`home.html 1`] = `
exports[`formats home.html correctly 1`] = `
<!--
templateType: page
isAvailableForNewContent: true
Expand Down Expand Up @@ -939,7 +939,7 @@ exports[`home.html 1`] = `
`;
exports[`hubdb.html 1`] = `
exports[`formats hubdb.html correctly 1`] = `
<!--
templateType: page
isAvailableForNewContent: false
Expand Down Expand Up @@ -1187,7 +1187,7 @@ screenshotPath: ../images/template-previews/hubdb.png
`;
exports[`if.html 1`] = `
exports[`formats if.html correctly 1`] = `
<div class="{% if true %}foo{% endif %}">
Content
</div>
Expand Down Expand Up @@ -1226,7 +1226,7 @@ Text that should get indented
`;
exports[`json.html 1`] = `
exports[`formats json.html correctly 1`] = `
{% module_attribute "social_link" is_json=True %}
[{"social_account":"facebook-f", "social_account":"linkedin-f"},{"social_account":"twitter", "social_account":"instagram"}]
{% end_module_attribute %}
Expand All @@ -1240,7 +1240,7 @@ exports[`json.html 1`] = `
`;
exports[`landing-page.html 1`] = `
exports[`formats landing-page.html correctly 1`] = `
<!--
templateType: page
isAvailableForNewContent: true
Expand Down Expand Up @@ -1318,7 +1318,7 @@ exports[`landing-page.html 1`] = `
`;
exports[`membership-login.html 1`] = `
exports[`formats membership-login.html correctly 1`] = `
<!--
templateType: membership_login_page
isAvailableForNewContent: true
Expand Down Expand Up @@ -1406,7 +1406,7 @@ exports[`membership-login.html 1`] = `
`;
exports[`minimal_nested.html 1`] = `
exports[`formats minimal_nested.html correctly 1`] = `
<div class="what">
{% dnd_column %}
{% dnd_row %}
Expand Down Expand Up @@ -1435,7 +1435,7 @@ exports[`minimal_nested.html 1`] = `
`;
exports[`misc.html 1`] = `
exports[`formats misc.html correctly 1`] = `
{% if sky != 'blue' %}
Clouds
{% endif %}
Expand Down Expand Up @@ -1835,7 +1835,7 @@ What is this element?
`;
exports[`nestedHtmlTags.html 1`] = `
exports[`formats nestedHtmlTags.html correctly 1`] = `
{% require_css %}
<style>
.list-wrapper {{ tagVariable }} {
Expand Down Expand Up @@ -1864,7 +1864,7 @@ exports[`nestedHtmlTags.html 1`] = `
`;
exports[`pre.html 1`] = `
exports[`formats pre.html correctly 1`] = `
{% block x %}
<div>
<pre>
Expand Down Expand Up @@ -1969,7 +1969,7 @@ exports[`pre.html 1`] = `
`;
exports[`qatest.html 1`] = `
exports[`formats qatest.html correctly 1`] = `
<!--
templateType: page
isAvailableForNewContent: false
Expand Down Expand Up @@ -3257,7 +3257,7 @@ exports[`qatest.html 1`] = `
`;
exports[`set.html 1`] = `
exports[`formats set.html correctly 1`] = `
{% set my_string = "my value"
%}
{% set my_var =
Expand Down Expand Up @@ -3329,7 +3329,7 @@ a_var %}
`;
exports[`tags.html 1`] = `
exports[`formats tags.html correctly 1`] = `
{% extends "custom/page/web_page_basic/my_template.html" %}
{% block my_sidebar %}
<!--Content that will render within a block of the same name in the parent template-->
Expand Down Expand Up @@ -4338,7 +4338,7 @@ This is a simple dialog rendered by using a macro and a call block.
`;
exports[`ternary.html 1`] = `
exports[`formats ternary.html correctly 1`] = `
{{ "x" == 0 ? "hello" : "bye" }}
{% set x = blue === red ? yellow : orange %}
Expand All @@ -4361,7 +4361,7 @@ exports[`ternary.html 1`] = `
`;
exports[`website-header.html 1`] = `
exports[`formats website-header.html correctly 1`] = `
<!--
templateType: global_partial
label: Website header
Expand Down Expand Up @@ -4531,7 +4531,7 @@ exports[`website-header.html 1`] = `
`;
exports[`whitespace.html 1`] = `
exports[`formats whitespace.html correctly 1`] = `
{{- foo }}
{{- bar -}}
{{ baz -}}
Expand Down
12 changes: 12 additions & 0 deletions prettier/tests/configuration/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Config } from "jest";

const config: Config = {
preset: "ts-jest",
setupFilesAfterEnv: ["./configuration/run_spec.ts"],
testEnvironment: "node",
testRegex: "run_tests.js$",
rootDir: "..",
transform: {},
};

export default config;
Loading

0 comments on commit ac9e522

Please sign in to comment.