Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Ensure e2e tests work with TS (#6173)
Browse files Browse the repository at this point in the history
* Cleanup e2e jest config from moduleFileExtensions

moduleFileExtensions by default support js, ts, tsx etc.

* convert legacy-template-blocks e2e test to TS

* clean up jest.config.json moduleFileExtensions

unnecessary defaults override
  • Loading branch information
tomasztunik authored and tjcafferkey committed Apr 5, 2022
1 parent 9a12f37 commit 0074783
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 0 additions & 3 deletions tests/e2e/config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,

// An array of file extensions your modules use
moduleFileExtensions: [ 'js', 'ts' ],

moduleNameMapper: {
'@woocommerce/blocks-test-utils': '<rootDir>/tests/utils',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ describe( 'Classic Template blocks', () => {
it( 'renders a list of products with their count and pagination', async () => {
const { productArchivePage } = SELECTORS;

await page.goto( new URL( '/?post_type=product', BASE_URL ) );
await page.goto(
new URL( '/?post_type=product', BASE_URL ).toString()
);

await page.waitForSelector( productArchivePage.productsList );
await page.waitForSelector( productArchivePage.resultsCount );
Expand Down Expand Up @@ -74,7 +76,7 @@ describe( 'Classic Template blocks', () => {
new URL(
`/product-category/${ CATEGORY_NAME.toLowerCase() }`,
BASE_URL
)
).toString()
);

await expect( page ).toMatchElement( productArchivePage.title, {
Expand Down Expand Up @@ -109,7 +111,10 @@ describe( 'Classic Template blocks', () => {
const { productArchivePage } = SELECTORS;

await page.goto(
new URL( `/product-tag/${ TAG_NAME.toLowerCase() }`, BASE_URL )
new URL(
`/product-tag/${ TAG_NAME.toLowerCase() }`,
BASE_URL
).toString()
);

await expect( page ).toMatchElement( productArchivePage.title, {
Expand Down
3 changes: 1 addition & 2 deletions tests/js/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@
"transform": {
"^.+\\.(js|ts|tsx)$": "<rootDir>/tests/js/jestPreprocess.js"
},
"verbose": true,
"moduleFileExtensions": [ "js", "jsx", "ts", "tsx", "json", "node" ]
"verbose": true
}

0 comments on commit 0074783

Please sign in to comment.