Skip to content

Commit 3484361

Browse files
committed
fix: Update faustwp-cli jest config and refresh snapshots
1 parent 49a2bd9 commit 3484361

File tree

3 files changed

+81
-80
lines changed

3 files changed

+81
-80
lines changed

packages/faustwp-cli/jest.config.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ export default {
33

44
// Adds Jest support for TypeScript using ts-jest.
55
transform: {
6-
'^.+\\.tsx?$': 'ts-jest',
6+
'^.+\\.tsx?$': [
7+
'ts-jest',
8+
{
9+
useESM: true,
10+
},
11+
],
712
},
813
testEnvironment: 'jsdom',
914
// Run code before each file in the suite is tested.
@@ -16,15 +21,11 @@ export default {
1621
// ESM Support
1722
// @link https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
1823
extensionsToTreatAsEsm: ['.ts'],
19-
globals: {
20-
'ts-jest': {
21-
useESM: true,
22-
},
23-
},
2424
moduleNameMapper: {
2525
'^(\\.{1,2}/.*)\\.js$': '$1',
2626
},
2727
collectCoverage: true,
28+
coverageProvider: 'v8',
2829
coverageReporters: ['json', 'html'],
2930
passWithNoTests: true,
3031
};

packages/faustwp-core/tests/config/withFaust.test.ts

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,33 @@ describe('withFaust', () => {
2929
);
3030
const redirects = await finalConfig.redirects!();
3131
expect(redirects).toMatchInlineSnapshot(`
32-
Array [
33-
Object {
34-
"destination": "/preview",
35-
"has": Array [
36-
Object {
37-
"key": "preview",
38-
"type": "query",
39-
"value": "true",
40-
},
41-
],
42-
"permanent": false,
43-
"source": "/((?!preview).*)",
44-
},
45-
Object {
46-
"destination": "/preview",
47-
"has": Array [
48-
Object {
49-
"key": "preview",
50-
"type": "query",
51-
"value": "true",
52-
},
53-
],
54-
"permanent": false,
55-
"source": "/((?!preview).*)",
56-
},
57-
]
58-
`);
32+
[
33+
{
34+
"destination": "/preview",
35+
"has": [
36+
{
37+
"key": "preview",
38+
"type": "query",
39+
"value": "true",
40+
},
41+
],
42+
"permanent": false,
43+
"source": "/((?!preview).*)",
44+
},
45+
{
46+
"destination": "/preview",
47+
"has": [
48+
{
49+
"key": "preview",
50+
"type": "query",
51+
"value": "true",
52+
},
53+
],
54+
"permanent": false,
55+
"source": "/((?!preview).*)",
56+
},
57+
]
58+
`);
5959
});
6060
test('it allows a custom preview destination', async () => {
6161
const finalConfig = withFaust(defaultNextConfig, {
@@ -64,44 +64,44 @@ describe('withFaust', () => {
6464
});
6565
const redirects = await finalConfig.redirects!();
6666
expect(redirects).toMatchInlineSnapshot(`
67-
Array [
68-
Object {
69-
"destination": "/demo",
70-
"has": Array [
71-
Object {
72-
"key": "preview",
73-
"type": "query",
74-
"value": "true",
75-
},
76-
],
77-
"permanent": false,
78-
"source": "/((?!demo).*)",
79-
},
80-
Object {
81-
"destination": "/preview",
82-
"has": Array [
83-
Object {
84-
"key": "preview",
85-
"type": "query",
86-
"value": "true",
87-
},
88-
],
89-
"permanent": false,
90-
"source": "/((?!preview).*)",
91-
},
92-
Object {
93-
"destination": "/preview",
94-
"has": Array [
95-
Object {
96-
"key": "preview",
97-
"type": "query",
98-
"value": "true",
99-
},
100-
],
101-
"permanent": false,
102-
"source": "/((?!preview).*)",
103-
},
104-
]
105-
`);
67+
[
68+
{
69+
"destination": "/demo",
70+
"has": [
71+
{
72+
"key": "preview",
73+
"type": "query",
74+
"value": "true",
75+
},
76+
],
77+
"permanent": false,
78+
"source": "/((?!demo).*)",
79+
},
80+
{
81+
"destination": "/preview",
82+
"has": [
83+
{
84+
"key": "preview",
85+
"type": "query",
86+
"value": "true",
87+
},
88+
],
89+
"permanent": false,
90+
"source": "/((?!preview).*)",
91+
},
92+
{
93+
"destination": "/preview",
94+
"has": [
95+
{
96+
"key": "preview",
97+
"type": "query",
98+
"value": "true",
99+
},
100+
],
101+
"permanent": false,
102+
"source": "/((?!preview).*)",
103+
},
104+
]
105+
`);
106106
});
107107
});

packages/faustwp-core/tests/server/sitemaps/__snapshots__/sitemapUtils.test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`createSitemap() returns a sitemap with no links 1`] = `
4-
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
5-
<urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\">
4+
"<?xml version="1.0" encoding="UTF-8"?>
5+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
66
77
</urlset>"
88
`;
99

1010
exports[`createSitemap() returns a sitemap with specified urls 1`] = `
11-
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
12-
<urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\">
11+
"<?xml version="1.0" encoding="UTF-8"?>
12+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
1313
<url>
1414
<loc>http://localhost:3000/</loc>
1515
<lastmod>2022-01-01</lastmod>
@@ -40,15 +40,15 @@ exports[`createSitemap() returns a sitemap with specified urls 1`] = `
4040
`;
4141

4242
exports[`createSitemapIndex() returns a sitemap index with no sitemaps 1`] = `
43-
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
44-
<sitemapindex xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\">
43+
"<?xml version="1.0" encoding="UTF-8"?>
44+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
4545
4646
</sitemapindex>"
4747
`;
4848

4949
exports[`createSitemapIndex() returns a sitemap index with specified sitemaps 1`] = `
50-
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
51-
<sitemapindex xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\">
50+
"<?xml version="1.0" encoding="UTF-8"?>
51+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
5252
<sitemap>
5353
<loc>http://localhost:3000/post-sitemap.xml</loc>
5454
<lastmod>2022-01-01</lastmod>

0 commit comments

Comments
 (0)