Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31,422 changes: 14,831 additions & 16,591 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions packages/blocks/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ module.exports = {

// Adds Jest support for TypeScript using ts-jest.
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},

// Run code before each file in the suite is tested.
Expand All @@ -16,15 +21,10 @@ module.exports = {
// ESM Support
// @link https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
extensionsToTreatAsEsm: ['.ts'],
globals: {
'ts-jest': {
useESM: true,
},
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
collectCoverage: true,
collectCoverage: false,
coverageReporters: ['json', 'html'],
passWithNoTests: true,
};
15 changes: 8 additions & 7 deletions packages/faustwp-cli/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ export default {

// Adds Jest support for TypeScript using ts-jest.
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
testEnvironment: 'jsdom',
// Run code before each file in the suite is tested.
Expand All @@ -16,15 +21,11 @@ export default {
// ESM Support
// @link https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
extensionsToTreatAsEsm: ['.ts'],
globals: {
'ts-jest': {
useESM: true,
},
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
collectCoverage: true,
collectCoverage: false,
coverageProvider: 'v8',
coverageReporters: ['json', 'html'],
passWithNoTests: true,
};
1 change: 1 addition & 0 deletions packages/faustwp-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@isaacs/brace-expansion": "^5.0.0",
"archiver": "^6.0.1",
"chalk": "^4.1.2",
"dotenv-flow": "^3.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ describe('healthCheck/validateNextWordPressUrl', () => {

await validateNextWordPressUrl();
expect(consoleLogSpy).toHaveBeenCalledWith(
expect.stringContaining('Validation Failed, Faust is shutting down:'),
expect.stringContaining(
'Validation Failed: Your Faust front-end site URL value is misconfigured. It should NOT match the `NEXT_PUBLIC_WORDPRESS_URL.',
'Your Faust front-end site URL value is misconfigured',
),
);
expect(mockExit).toHaveBeenCalledWith(1);
Expand Down
18 changes: 9 additions & 9 deletions packages/faustwp-core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ module.exports = {

// Adds Jest support for TypeScript using ts-jest.
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
isolatedModules: true,
},
],
},

// Run code before each file in the suite is tested.
Expand All @@ -16,17 +22,11 @@ module.exports = {
// ESM Support
// @link https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/
extensionsToTreatAsEsm: ['.ts', '.tsx'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
isolatedModules: true,
useESM: true,
},
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
collectCoverage: true,
collectCoverage: false,
coverageReporters: ['json', 'html'],
coverageProvider: 'v8',
passWithNoTests: true,
};
3 changes: 2 additions & 1 deletion packages/faustwp-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"sass": "^1.80.3",
"shx": "^0.3.4",
"throat": "^6.0.2",
"ts-jest": "^27.0.7",
"ts-jest": "^29.4.6",
"ts-loader": "^9.2.6",
"typedarray-to-buffer": "4.0.0",
"typescript": "^4.4.4",
Expand All @@ -45,6 +45,7 @@
"classnames": "^2.3.2",
"cookie": "^0.7.0",
"deepmerge": "^4.2.2",
"exit-x": "^0.2.2",
"fast-xml-parser": "^5.3.4",
"isomorphic-fetch": "^3.0.0",
"js-cookie": "^3.0.5",
Expand Down
90 changes: 19 additions & 71 deletions packages/faustwp-core/tests/components/Toolbar/Toolbar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,7 @@ test('renders a default list of nodes in the primary section if seedNode is not
await waitFor(() => queryByAttribute('id', dom.container, 'wpadminbar'));
const toolBars = screen.getAllByRole('list', { name: /toolbar/i });
// Primary Toolbar
testToolBarNode(
toolBars[0],
3,
`
Array [
"WordPress",
"",
"GraphiQL IDE",
]
`,
);
testToolBarNode(toolBars[0], 3, ['WordPress', '', 'GraphiQL IDE']);
});

test('renders an Edit Post Node, in the primary section if seedNode is provided', async () => {
Expand All @@ -156,17 +146,7 @@ test('renders an Edit Post Node, in the primary section if seedNode is provided
await waitFor(() => queryByAttribute('id', dom.container, 'wpadminbar'));
const toolBars = screen.getAllByRole('list', { name: /toolbar/i });
// Primary Toolbar
testToolBarNode(
toolBars[0],
3,
`
Array [
"WordPress",
"Edit Post",
"GraphiQL IDE",
]
`,
);
testToolBarNode(toolBars[0], 3, ['WordPress', 'Edit Post', 'GraphiQL IDE']);
});

test('renders an Account Node in the secondary section', async () => {
Expand All @@ -184,18 +164,12 @@ test('renders an Account Node in the secondary section', async () => {
await waitFor(() => queryByAttribute('id', dom.container, 'wpadminbar'));
const toolBars = screen.getAllByRole('list', { name: /toolbar/i });
// Secondary Toolbar
testToolBarNode(
toolBars[1],
4,
`
Array [
"Howdy, Edit ProfileLog Out",
"",
"Edit Profile",
"Log Out",
]
`,
);
testToolBarNode(toolBars[1], 4, [
'Howdy, Edit ProfileLog Out',
'',
'Edit Profile',
'Log Out',
]);
});

test('renders an Edit Post Node, if seedNode is not provided and is preview', async () => {
Expand All @@ -215,17 +189,7 @@ test('renders an Edit Post Node, if seedNode is not provided and is preview', as
await waitFor(() => queryByAttribute('id', dom.container, 'wpadminbar'));
const toolBars = screen.getAllByRole('list', { name: /toolbar/i });
// Primary Toolbar
testToolBarNode(
toolBars[0],
3,
`
Array [
"WordPress",
"Edit Post",
"GraphiQL IDE",
]
`,
);
testToolBarNode(toolBars[0], 3, ['WordPress', 'Edit Post', 'GraphiQL IDE']);
});

test('does not render an Edit Post Node, if there is no seedNode and it is not a preview', async () => {
Expand All @@ -241,17 +205,7 @@ test('does not render an Edit Post Node, if there is no seedNode and it is not a
await waitFor(() => queryByAttribute('id', dom.container, 'wpadminbar'));
const toolBars = screen.getAllByRole('list', { name: /toolbar/i });
// Primary Toolbar
testToolBarNode(
toolBars[0],
3,
`
Array [
"WordPress",
"",
"GraphiQL IDE",
]
`,
);
testToolBarNode(toolBars[0], 3, ['WordPress', '', 'GraphiQL IDE']);
});

test('Uses `toolbarNodes` hook to add nodes', async () => {
Expand All @@ -276,19 +230,13 @@ test('Uses `toolbarNodes` hook to add nodes', async () => {
);
await waitFor(() => queryByAttribute('id', dom.container, 'wpadminbar'));
const toolBars = screen.getAllByRole('list', { name: /toolbar/i });
// Secondary Toolbar
testToolBarNode(
toolBars[0],
4,
`
Array [
"WordPress",
"Edit Post",
"GraphiQL IDE",
"Test Node",
]
`,
);
// Primary Toolbar
testToolBarNode(toolBars[0], 4, [
'WordPress',
'Edit Post',
'GraphiQL IDE',
'Test Node',
]);
});

class TestAddToolbarNodePlugin {
Expand Down Expand Up @@ -318,11 +266,11 @@ class TestAddToolbarNodePlugin {
function testToolBarNode(
toolBar: HTMLElement,
expectedLen: number,
expectedContent: string,
expectedContent: (string | null)[],
) {
const { getAllByRole } = within(toolBar);
const items = getAllByRole('listitem');
expect(items.length).toBe(expectedLen);
const toolBarNames = items.map((item) => item.textContent);
expect(toolBarNames).toMatchInlineSnapshot(expectedContent);
expect(toolBarNames).toEqual(expectedContent);
}
Loading
Loading